Skip to main content

sql-mini-mcp

Compact MCP server for SQL Server metadata. The current Milestone 1 build supports only SQL Server and is metadata-only; PII-safe execute_sql is developed separately in Milestone 2.

Tools

  • list_servers
  • list_databases
  • list_tables
  • get_table_definition
  • list_stored_procedures
  • get_stored_procedure

The server does not discover network servers, expose a full catalog as resources, use an ORM, or execute caller-provided SQL.

Install and run

Python 3.12–3.14 and uv are required. SQL Server uses pyodbc and needs Microsoft ODBC Driver 18 for SQL Server.

uv sync --all-groups --locked
Copy-Item sql-mini-mcp.example.yaml sql-mini-mcp.yaml
$env:SQL_MINI_MCP_CONFIG = "$PWD\sql-mini-mcp.yaml"
uv run sql-mini-mcp --check-config
uv run sql-mini-mcp

sql-mini-mcp speaks MCP over stdio. Configure the same command and environment in the MCP host. All logs go to stderr.

MySQL/MariaDB configuration is intentionally rejected until Milestone 3.

Configuration and secrets

Connection topology stays in YAML while ${NAME} placeholders read process environment values. A placeholder occupying the entire connection_url may contain a complete SQLAlchemy URL; embedded values are URL-encoded before substitution.

Every pii_safe alias requires its own base64-encoded 32-byte key:

$bytes = New-Object byte[] 32
[System.Security.Cryptography.RandomNumberGenerator]::Fill($bytes)
$env:LEGACY_PROD_PII_KEY = [Convert]::ToBase64String($bytes)

Keys are rejected if reused by two aliases. Milestone 2 will authenticate the server alias as AES-GCM associated data, so tokens cannot cross aliases even if keys are accidentally duplicated outside normal config loading. Key rotation or alias renaming will invalidate existing tokens.

See sql-mini-mcp.example.yaml for a complete example.

Development

uv run ruff format --check .
uv run ruff check .
uv run ty check
uv run pytest tests/unit tests/contract -m "not integration"

Live SQL Server gate

The reproducible Windows gate requires Docker Desktop in Linux-container mode and ODBC Driver 18. It starts the digest-pinned SQL Server 2022 service when needed, then reuses the healthy container and its test database on later runs:

.\scripts\test-sqlserver.ps1

Each run creates uniquely named schemas, tables, stored procedures, users, and logins, then removes those objects in finally. The container and its volume remain available for fast repeat runs. To explicitly remove that local test service and its volume:

.\scripts\test-sqlserver.ps1 -Reset

The container runs SQL Server 2022 with the test database at compatibility level 130. That exercises the SQL Server 2016 compatibility surface, but it is not evidence of a run against an actual SQL Server 2016 instance. An external disposable SQL Server can be checked directly:

$env:SQL_MINI_MCP_TEST_SQLSERVER_URL = "mssql+pyodbc://..."
uv run pytest tests/integration/sqlserver -m integration -v

Live and future Milestone 2 security gates are documented in CHECKS.md. Architecture and threat assumptions are in ARCHITECTURE.md and SECURITY.md.

Release files for sql-mini-mcp 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql-mini-mcp 0.9.1
File Size Uploaded
sql_mini_mcp-0.9.1.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-mini-mcp 0.9.1
File Interpreter ABI Platform
sql_mini_mcp-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.5 kB

Release files / sql_mini_mcp-0.9.1.tar.gz

Download URL sql_mini_mcp-0.9.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cc3b4205fd1a98406348d954dc47c433f6b49d72486b9b7b9c6c27eebbfafa0e
BLAKE2b-256 checksum
How to use checksums
eaecabca0317c0d4162b7688cedb755c8f313ac85ab8539f70b00366c60c2c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / sql_mini_mcp-0.9.1-py3-none-any.whl

Download URL sql_mini_mcp-0.9.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84335cee5f5db53b1cfc589f43f4274d81b04b8cf94b39c8a36a2ed276d81f56
BLAKE2b-256 checksum
How to use checksums
4bc389afa840915ca98427e47cd7d3a19e3044169845926b8c3116ae89aa0dca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.0

2 release files

1.0.0

2 release files

This release

0.9.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page