
SQL Safe MCP
io.github.proprock由 GitHub 账号 proprock 发布v1.5.2更新于 Oct 24, 2026
Minimal, read-only, PII-safe MCP server for SQL databases.
发布方自己的服务:Google Analytics (unofficial)
概览
只读的 MCP 服务器,让编码助手了解 SQL Server、MySQL 和 MariaDB 的表结构,并在受保护的 PII 列以令牌返回的前提下执行受限 SELECT 查询。
- 可以做什么
- 列出已配置的服务器别名以及凭据可见的数据库
- 按架构或名称浏览基础表,并读取单张表的列、键、约束和索引
- 列出存储过程并读取单个存储过程的定义(需 meta_and_code 或 all_pii_safe 权限)
- 在 all_pii_safe 别名上执行一条受限且经校验的 SELECT,受保护列以绑定别名的令牌返回,可用于 = 和 IN 过滤
- 适用场景
- 适合编码助手需要理解现有 SQL Server、MySQL 或 MariaDB 表结构以编写正确代码,或需要查看真实数据行但不想暴露个人信息的场景。也适合希望数据库访问不包含任何写入工具、并使用最小权限账号的团队。
- 运行要求
- 通过 uvx 或 pip 以 stdio 方式在本机运行(Python 3.12–3.14);连接 SQL Server 需 Microsoft ODBC Driver 18,MySQL 和 MariaDB 使用内置 PyMySQL 驱动。需要由 SQL_SAFE_MCP_CONFIG(或 --config)指向的 YAML 配置文件,以及存放连接 URL 和 PII 密钥的环境变量;还需数据库凭据和到实例的网络访问。
安装
在 SourceWeft 中
- 打开 控制台中的 SQL Safe MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
sql-safe-mcp
A PII-safe, read-only MCP server for coding agents working with SQL Server, MySQL and MariaDB: schema knowledge and safe queries without write-capable tools or plaintext exposure of configured PII columns.
[CI] [Release] [PyPI Version] [Python] [License: MIT]
[Model Context Protocol compatible] [MCP Registry: io.github.proprock/sql-safe-mcp]
[Read the data. Protect the identity.]Read the data. Protect the identity.
Give a coding agent the schema knowledge it needs to write correct code - servers, databases,
tables, columns, keys, indexes, and stored procedures. On aliases you mark all_pii_safe, it can also
query real rows while configured personal data stays hidden behind authenticated tokens.
PII-safe by default. Read-only by design.
- PII-safe by default - on an
all_pii_safeserver, the columns you configure come back as alias-bound, authenticated tokens (pii:v1:...), never as plaintext. An agent can still project, count, and filter on them with=andINusing tokens it was given, so it can follow a record without reading it. Tokens do not work on another server alias or with another key. - Read-only by construction - seven tools, all annotated read-only. No tool writes data, and
the server never executes SQL an agent wrote: metadata comes from SQLAlchemy Inspector and fixed
catalog queries, and
execute_sqlruns only a validated, regeneratedSELECT. - Multiple servers, isolated policies - one MCP process can expose multiple named SQL Server, MySQL, and MariaDB instances. Each alias has its own connection, access level, and, when enabled, PII key and protection rules. Every database operation targets an explicit alias; there is no network discovery.
Operational safeguards
- Fails closed - SQL validation is an allowlist. Unknown syntax, unresolved lineage, and unsupported protected-value types are refused, not guessed at. The verification evidence is in the security model.
- Least access first -
access_level: metadata(the default) exposes database navigation and table structure;meta_and_codeadditionally exposes stored procedures;execute_sqlneeds an explicitall_pii_safealias with its own key. Database permissions stay the primary control, so use a least-privilege login. - Secrets stay out of sight - connection URLs live in YAML with
${NAME}placeholders resolved from the environment. They never appear in logs or model-visible errors. - Compact, predictable output - object-rooted results with stable sorting, literal case-insensitive name filters, and stored procedure lists that do not expand definitions.
- Errors an agent can act on - an ambiguous name lists the candidate schemas. Errors never contain connection details, credentials, keys, tokens, or rows.
- Tested against attacks, not just examples - the SQL and PII boundary is checked with an adversarial corpus of hostile statements, property-based tests (token isolation, tamper resistance), a live attack run against a really writable login with before/after snapshots, and mutation testing. Results are in Verification of the SQL boundary.
- Diagnosable failures - a timeout or connection error carries a
Reference, and the stderr log records the connection stage, elapsed time, and driver error for the same reference, with credentials removed. See Logging.
[!NOTE] Status: SQL Server supports every tool. MySQL and MariaDB (
engine: mysqlormariadb,mysql+pymysqlURLs) support every tool too.schemais alwaysnullthere because the database is the catalog, andexecute_sqlusesLIMITinstead ofTOP. See architecture.md.
Quick start
Install
or
Pin a version when you want a fixed surface: uvx sql-safe-mcp==1.5.2.
Requires Python 3.12–3.14, uv (or pip), and
Microsoft ODBC Driver 18 for SQL Server
when you connect to SQL Server. MySQL and MariaDB use the bundled PyMySQL driver and need nothing
else.
Verified against SQL Server 2022, MySQL 8.4, and MariaDB 11.4 (see checks.md).
Or you can even ask an agent to install it
Configure server
Copy sql-safe-mcp.example-simple.yaml to
sql-safe-mcp.yaml. This smallest configuration exposes schema metadata from one SQL Server
instance and does not allow row queries. Keep the complete connection URL in an environment
variable:
Here reporting is the value an agent passes as server. A missing variable, or an engine that
does not match the URL dialect, stops the MCP server at startup. For multiple servers, local PII
rules, shared PII rule sets, logging, and runtime limits, use the commented examples in the
configuration reference.
Check the configuration
After defining every environment variable referenced by the YAML file, point the server at it with
SQL_SAFE_MCP_CONFIG (or --config) and check it without connecting to any database:
Configuration is validated at startup, and an error names the problem without printing a URL or secret. Keep credentials in the host's own configuration and never commit them. The server acts with the database account's permissions, so use a dedicated login with the least access the job needs.
Connect an MCP client
Every client configuration needs SQL_SAFE_MCP_CONFIG plus the environment variables referenced
by your YAML file. Keep connection URLs and PII keys in the MCP host's environment or
configuration, never in the YAML file or other tracked files.
Claude Code
Put at least one other option between the last --env and the server name, as above. Otherwise,
the CLI reads the name as another KEY=value pair.
Claude Desktop
Add the server to claude_desktop_config.json:
Codex CLI
Any other stdio host
Use command uvx, argument sql-safe-mcp, and set SQL_SAFE_MCP_CONFIG plus every environment
variable referenced by the configuration file. The server writes MCP messages to stdout and logs
only to stderr.
PII-safe queries
execute_sql on the billing alias allows one restricted SELECT. For example, these arguments:
can return a row such as [42, "pii:v1:..."]: the agent can follow the customer without reading
the email address. A token is accepted only in = and IN predicates on the same server alias.
If FirstName is protected, SELECT FirstName FROM Users WHERE FirstName = 'Alice' is rejected
before it reaches the database. Filter protected columns only with authentic pii:v1:... tokens
returned by execute_sql for the same alias; a matching prefix alone is not enough. Each token is
authenticated and alias-bound, then validated and converted to a bound database value.
Protection covers the columns you list, so list every column that holds personal data.
Documentation
- Configuration reference - aliases, connection URLs, PII rules, runtime limits, and logging.
- Tool reference - arguments, responses, errors, and the accepted SQL subset.
- Security model - trust boundaries, guarantees, limitations, and verification.
- Checks - local, integration, and security verification commands.
Security
The MCP caller, SQL input, database metadata, rows, and tokens are untrusted. Database permissions remain the primary authorization control - this server never widens them. Read the full security model, including its limitations and verification evidence. To report a vulnerability, use the private channel in SECURITY.md.
Contributing
Setup, checks, the test commands, the branch and commit conventions, and the release model are in CONTRIBUTING.md. Changes that affect someone running the server are recorded in CHANGELOG.md.
License
MIT.
来源:README.md,提交 9dd2a69
工具
0版本历史
6- v1.5.2最新Oct 6, 2026
- v1.5.1Sep 23, 2026
- v1.5.0Sep 23, 2026
- v1.4.0Sep 22, 2026
- v1.3.1Sep 21, 2026
- v1.2.0Sep 21, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Safe-Mcp 集成

Google Analytics (unofficial)
com.safe-mcp官方发布者
非官方远程 MCP 服务器,让助手用自然语言查询 GA4、Google Search Console 和 Bing Webmaster 数据,生成报表与漏斗分析。

TypeSafe MCP
由 GitHub 账号 Renwang-Huang 发布
为助手提供类型化决策原语——分类、评分、检查、验证、门控、路由、评审——由 TypeSafe Jev 模型驱动。

Proton Safe MCP
由 GitHub 账号 fbossiere 发布
本地 MCP 服务器,让助手通过 Proton Mail Bridge 读取和搜索 Proton Mail,并创建需确认的草稿,但绝不发送邮件。