SQL Safe MCP
Read-only SQL Server, MySQL and MariaDB MCP server that tokenizes configured PII columns
SQL Safe MCP is an MCP server for databases. It runs locally on your machine and is started by your AI client.
- Platforms
- CLI, Self-hosted
- Runs
- Locally
- What it can do
- Can change data (1 tool)
- Version
- 2.0.0
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add sql-safe-mcp -- uvx sql-safe-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"sql-safe-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add sql-safe-mcp -- uvx sql-safe-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.sql-safe-mcp]
command = "uvx"
args = ["sql-safe-mcp"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Or run: gemini mcp add -s user sql-safe-mcp uvx -- sql-safe-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "sql-safe-mcp": { "command": "uvx", "args": [ "sql-safe-mcp" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
About SQL Safe MCP
Aimed at coding agents that need to know a database without being able to hurt it or read personal data. The agent gets servers, databases, tables, columns, keys, indexes and stored procedures, and on aliases you mark all_pii_safe it can query real rows where configured PII columns come back as authenticated tokens (pii:v1:...) instead of plaintext. Tokens still allow projecting, counting and filtering with = and IN, so an agent can follow a record without reading it. Tokens are bound to one alias and key.
It is read-only by construction: seven tools, all annotated read-only, and execute_sql only runs a validated, regenerated SELECT. SQL validation is an allowlist, so unknown syntax is refused. Access levels step from metadata (the default) to meta_and_code, which adds stored procedures, to all_pii_safe, which needs its own key. Connection URLs use environment placeholders and never appear in logs or errors.
It installs with uvx sql-safe-mcp on Python 3.12 to 3.14, needs Microsoft ODBC Driver 18 for SQL Server, and is verified against SQL Server 2022, MySQL 8.4 and MariaDB 11.4. The README recommends a least-privilege database login.
Tools this server provides (7)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 7 tools changes data.
From the server's own tool labels and tool names; not verified by us.
- list_serversName suggests: reads
- Lists configured server aliases.
- list_databasesName suggests: reads
- Lists databases visible to the credentials.
- list_tablesName suggests: reads
- Lists base tables filtered by schema or name.
- get_table_definitionName suggests: reads
- Returns columns, keys, constraints and indexes of a table.
- list_stored_proceduresName suggests: reads
- Lists stored procedures without definitions.
- get_stored_procedureName suggests: reads
- Returns one stored procedure definition.
- execute_sqlName suggests: changes
- Runs one restricted SELECT on an all_pii_safe server.
What it does
- PII tokenization
- Configured columns return alias-bound tokens rather than plaintext.
- Read-only tools
- All seven tools are read-only; only a validated SELECT is executed.
- Allowlist validation
- Unknown syntax and unresolved lineage are refused.
- Multiple isolated servers
- Each alias has its own connection, access level and PII rules.
- Context-friendly output
- Compact, stably sorted results with stored procedure lists that skip definitions.
- Config check
- Validate configuration at startup without connecting to a database.
Good for
- Let an agent learn a legacy SQL Server schema
- Query MySQL data without exposing personal columns
- Explore stored procedures while writing code
- Run an agent against several databases with separate policies
SQL Safe MCP FAQ
Which databases are supported?
SQL Server, MySQL and MariaDB.
Can an agent see personal data?
Not in plaintext on configured columns; they are replaced by tokens on all_pii_safe aliases.
Can SQL Safe MCP write data?
No tool writes data, though database permissions remain the primary control so use a least-privilege login.
How do I install SQL Safe MCP?
uvx sql-safe-mcp or pip install sql-safe-mcp, with Python 3.12 to 3.14.
Does SQL Server need a driver?
Yes, Microsoft ODBC Driver 18; MySQL and MariaDB use bundled PyMySQL.
How do I add SQL Safe MCP to Claude Code?
Run this command in your terminal: claude mcp add sql-safe-mcp -- uvx sql-safe-mcp
What are the best alternatives to SQL Safe MCP?
The closest alternatives to SQL Safe MCP are REA, AiSOC, x64dbg-mcp-server, redamon and Treasure Map.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.



