# SQL Safe MCP

> SQL Safe MCP is an MCP server for databases. Read-only SQL Server, MySQL and MariaDB MCP server that tokenizes configured PII columns. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/proprock/sql-safe-mcp
- **MCP Registry name:** io.github.proprock/sql-safe-mcp
- **Categories:** [databases](https://ai-powered.com/categories/databases), [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add sql-safe-mcp -- uvx sql-safe-mcp
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add sql-safe-mcp -- uvx sql-safe-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.sql-safe-mcp]
command = "uvx"
args = ["sql-safe-mcp"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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 (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "sql-safe-mcp": {
      "command": "uvx",
      "args": [
        "sql-safe-mcp"
      ]
    }
  }
}
```

## Tools

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_servers` (name suggests: reads): Lists configured server aliases.
- `list_databases` (name suggests: reads): Lists databases visible to the credentials.
- `list_tables` (name suggests: reads): Lists base tables filtered by schema or name.
- `get_table_definition` (name suggests: reads): Returns columns, keys, constraints and indexes of a table.
- `list_stored_procedures` (name suggests: reads): Lists stored procedures without definitions.
- `get_stored_procedure` (name suggests: reads): Returns one stored procedure definition.
- `execute_sql` (name suggests: changes): Runs one restricted SELECT on an all_pii_safe server.

## 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.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [AiSOC](https://ai-powered.com/mcp/aisoc): AiSOC is an open-source MCP server for ai models and llm tooling.
- [x64dbg-mcp-server](https://ai-powered.com/mcp/x64dbg-mcp-server): x64dbg-mcp-server is an open-source MCP server for ai models and llm tooling.
- [redamon](https://ai-powered.com/mcp/redamon): redamon is an open-source MCP server for ai models and llm tooling.
- [Treasure Map](https://ai-powered.com/mcp/treasure-map): Treasure Map is an open-source MCP server for security.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [NostrPulse](https://ai-powered.com/mcp/nostrpulse): NostrPulse is an open-source MCP server for finance and payments.
- [Runeward](https://ai-powered.com/mcp/runeward): Runeward is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/sql-safe-mcp
