SQL Server, MySQL, MariaDB에 대해 읽기 전용 SQL 스키마 지식과 PII 안전 쿼리 기능을 코딩 에이전트에게 제공합니다.
다른 이름 proprock/sql-safe-mcp, sql-safe-mcp
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- 521
- 최신 버전
- 2.0.0
- 마지막 커밋
- 2026년 11월 14일
- 라이선스
- MIT
SQL Safe MCP란?
SQL Safe은(는) MCP server입니다. SQL Server, MySQL, MariaDB에 대해 읽기 전용 SQL 스키마 지식과 PII 안전 쿼리 기능을 코딩 에이전트에게 제공합니다.
프로젝트 README에서 생성된 요약
SQL Safe MCP server 정보
SQL Safe MCP는 코딩 에이전트가 SQL Server, MySQL, MariaDB 데이터베이스와 상호작용할 수 있는 안전한 방법을 제공합니다. 데이터 노출이나 권한 없는 수정 위험 없이 AI 모델에 스키마 지식을 제공해야 하는 개발자를 위해 설계되었습니다. 이 서버는 읽기 전용 인터페이스로 작동하여 어떤 도구도 데이터를 쓰거나 변경할 수 없도록 보장합니다. SQLAlchemy Inspector와 고정된 카탈로그 쿼리를 사용하여 테이블, 컬럼, 키, 저장 프로시저와 같은 메타데이터를 제공합니다.
사용자는 uvx 또는 pip를 사용하여 로컬에 서버를 설정하며, 민감한 연결 URL에 대한 환경 변수를 참조하는 YAML 파일을 통해 연결을 구성합니다. 보안을 강화하기 위해 서버를 all_pii_safe 별칭으로 구성할 수 있습니다. 이 모드에서는 민감한 컬럼이 인증 토큰으로 대체되어, 에이전트가 실제 평문 개인 정보를 전혀 보지 않고도 레코드를 필터링하거나 카운트할 수 있습니다. 이는 에이전트가 복잡한 데이터 분석 작업을 수행할 수 있도록 허용하면서도 개인정보를 유지하는 데 이상적입니다.
활용 사례
- 1데이터베이스 구조 탐색에이전트는 유효한 쿼리를 작성하는 방법을 이해하기 위해 컬럼, 키, 인덱스를 포함한 스키마를 가져올 수 있습니다.
- 2PII 노출 없는 데이터 분석개발자는 개인 데이터가 보안 토큰으로 대체된 행을 에이전트가 쿼리할 수 있도록 허용할 수 있습니다.
- 3안전한 데이터 필터링 수행AI는 반환된 토큰을 사용하여 실제 값을 알지 못해도 일치 또는 포함 술어를 통해 결과를 필터링할 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
SQL Safe MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 SQL Safe MCP 설치
$ claude mcp add sql-safe-mcp -- uvx sql-safe-mcpCursor에 SQL Safe MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}VS Code에 SQL Safe MCP 설치
.vscode/mcp.json
{
"servers": {
"sql-safe-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}VS Code CLI에 SQL Safe MCP 설치
$ code --add-mcp '{"name":"sql-safe-mcp","type":"stdio","command":"uvx","args":["sql-safe-mcp"]}'Claude Desktop에 SQL Safe MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}Codex에 SQL Safe MCP 설치
$ codex mcp add sql-safe-mcp -- uvx sql-safe-mcpCodex config.toml에 SQL Safe MCP 설치
~/.codex/config.toml
[mcp_servers.sql-safe-mcp] command = "uvx" args = ["sql-safe-mcp"]
Gemini CLI에 SQL Safe MCP 설치
$ gemini mcp add -s user sql-safe-mcp uvx -- sql-safe-mcpGemini settings.json에 SQL Safe MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"sql-safe-mcp": {
"command": "uvx",
"args": [
"sql-safe-mcp"
]
}
}
}구성
REPORTING_SQL_URLSQL_SAFE_MCP_CONFIG
| 이름 | 설명 | 유형 |
|---|---|---|
| REPORTING_SQL_URL | — | |
| SQL_SAFE_MCP_CONFIG | — |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능proprock/sql-safe-mcp is public and reachablegithub.com/proprock/sql-safe-mcp ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)Sigstore attestation for sql-safe-mcppypi.org/project/sql-safe-mcp/ ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-07github.com/proprock/sql-safe-mcp ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from sql-safe-mcp통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음34 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기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.
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.
| Tool | Access | Purpose |
|---|---|---|
list_servers |
🟢 read | Configured server aliases |
list_databases |
🟢 read | Databases visible to the credentials |
list_tables |
🟢 read | Base tables, filtered by schema or name |
get_table_definition |
🟢 read | Columns, keys, constraints, and indexes of one table |
list_stored_procedures |
🟢 read | Stored procedures, without definitions; requires meta_and_code or all_pii_safe |
get_stored_procedure |
🟢 read | The definition of one stored procedure; requires meta_and_code or all_pii_safe |
execute_sql |
🟢 read | One restricted SELECT on an all_pii_safe server; protected columns return tokens |
[!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
uvx sql-safe-mcp
or
pip install sql-safe-mcp
Pin a version when you want a fixed surface: uvx sql-safe-mcp==2.0.0.
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).
Install sql-safe-mcp as a stdio MCP server.
Ask whether to install it for this project/workspace or at user level. Then:
detect and preserve the host's existing MCP config;
configure the server to run via uvx sql-safe-mcp;
create a YAML config template with env placeholders only;
add SQL_SAFE_MCP_CONFIG;
report the env variables the user must set.
Do not store secrets or connection data in tracked files or output. Validate with
sql-safe-mcp --check-config once variables are available.
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:
version: 1
servers:
reporting:
engine: sqlserver
access_level: metadata
connection_url: "${REPORTING_SQL_URL}"
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:
SQL_SAFE_MCP_CONFIG=sql-safe-mcp.yaml uvx sql-safe-mcp --check-config
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 mcp add --env SQL_SAFE_MCP_CONFIG=/path/to/sql-safe-mcp.yaml --env REPORTING_SQL_URL=mssql+pyodbc://... --transport stdio sql-safe -- uvx sql-safe-mcp
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.
Add the server to claude_desktop_config.json:
{
"mcpServers": {
"sql-safe": {
"command": "uvx",
"args": ["sql-safe-mcp"],
"env": {
"SQL_SAFE_MCP_CONFIG": "/path/to/sql-safe-mcp.yaml",
"REPORTING_SQL_URL": "mssql+pyodbc://..."
}
}
}
}
codex mcp add sql-safe --env SQL_SAFE_MCP_CONFIG=/path/to/sql-safe-mcp.yaml --env REPORTING_SQL_URL=mssql+pyodbc://... -- uvx sql-safe-mcp
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:
{
"server": "billing",
"database": "Billing",
"sql": "SELECT CustomerId, Email FROM dbo.Customers"
}
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.
Hardening for sensitive data
An all_pii_safe alias requires verified TLS in its connection_url and fails at startup without
it; require_tls: false turns the check off and logs a warning at every start
(Verified TLS). Every other control below is opt-in:
- Protect by default -
pii.mode: deny-by-defaultprotects every column not listed inpii.exposed_columns, andpii.denyrejects any query that references a listed column (Deny-by-default). - Check rules against the schema -
sql-safe-mcp --verify-pii-rules [--strict]reports what each rule matches and flags unprotected columns whose names look personal (Verifying PII rules). - Limit token reuse - rules with different
domainvalues reject each other's tokens, andruntime.token_ttl_secondsexpires old tokens (Token domains, Token lifetime). - Keep the key out of the environment -
pii_key_filereads the key from a file whose owner and permissions are checked at startup (Key file). - Suppress small counts -
runtime.min_count_cellreturns small nonzeroCOUNT(*)values asnull(Runtime limits). - Audit reads -
logging.audit: truelogs the tables and columns eachexecute_sqlcall read, without SQL, values, or rows (Audit log).
Tokens hide values but are pseudonyms, not anonymization: what a token still reveals is listed in the security model. For medical deployments, see Health data of minors.
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.
- Health data of minors - requirements, mechanisms, and an operator checklist for medical deployments.
- 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.
SQL Safe MCP 질문
SQL Safe MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add sql-safe-mcp -- uvx sql-safe-mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
SQL Safe MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
이 서버는 어떤 데이터베이스를 지원하나요?
이 서버는 SQL Server, MySQL, MariaDB를 지원합니다.
PII 데이터를 어떻게 보호하나요?
설정된 PII 컬럼은 평문 대신 별칭이 지정된 인증 토큰으로 반환됩니다. 이를 통해 에이전트는 실제 데이터를 보지 않고도 필터링이나 카운트 작업을 수행할 수 있습니다.
여러 데이터베이스에 동시에 연결할 수 있나요?
네, 단일 MCP 프로세스에서 격리된 정책과 연결을 가진 여러 개의 이름 지정 인스턴스를 노출할 수 있습니다.