Skip to main content

dreez-mssql-mcp

A Model Context Protocol (MCP) server for SQL Server — built with read-only safety, pyodbc, and full compatibility with uvx.

PyPI version Python License: MIT Author


✨ Features

  • 🔍 Execute read-only SQL queries (SELECT / WITH)
  • 🛡️ READ_ONLY mode — blocks any mutating SQL by default (INSERT, UPDATE, DELETE, DROP, TRUNCATE, ALTER, CREATE, EXEC, MERGE, GRANT, REVOKE)
  • 📋 List tables in any schema
  • 🔎 Describe table columns (types, nullability, defaults)
  • 🗂️ List schemas in the database
  • 📦 List stored procedures
  • ⚡ Compatible with uvx — no global install needed

📦 Installation

Using uvx (recommended — no install required)

uvx dreez-mssql-mcp

Using pip

pip install dreez-mssql-mcp

⚙️ Environment Variables

Variable Required Default Description
MSSQL_SERVER SQL Server hostname or IP
MSSQL_PORT SQL Server port (usually 1433)
MSSQL_DB Database name
MSSQL_USER SQL Server username
MSSQL_PWD SQL Server password
READ_ONLY true Set to false to allow write operations ⚠️

🔧 Client Configuration

Claude Desktop

Edit claude_desktop_config.json:

{
  "mcpServers": {
    "dreez-mssql": {
      "command": "uvx",
      "args": ["dreez-mssql-mcp"],
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_PORT": "1433",
        "MSSQL_DB": "your_database",
        "MSSQL_USER": "your_user",
        "MSSQL_PWD": "your_password",
        "READ_ONLY": "true"
      }
    }
  }
}

Cursor / VS Code

Edit .cursor/mcp.json or .vscode/mcp.json:

{
  "servers": {
    "dreez-mssql": {
      "type": "stdio",
      "command": "uvx",
      "args": ["dreez-mssql-mcp"],
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_PORT": "1433",
        "MSSQL_DB": "your_database",
        "MSSQL_USER": "your_user",
        "MSSQL_PWD": "your_password",
        "READ_ONLY": "true"
      }
    }
  }
}

🛠️ Available Tools

Tool Description
execute_query(sql, max_rows?) Run a SELECT or WITH (CTE) query. Returns JSON. Max 1000 rows.
list_tables(schema?) List all tables in a schema (default: dbo)
describe_table(table_name, schema?) Get columns, types, and nullability for a table
list_schemas() List all schemas in the current database
list_stored_procedures(schema?) List stored procedures in a schema

🛡️ READ_ONLY Mode

By default, READ_ONLY=true. Any query containing write keywords will be blocked immediately before reaching the database:

{
  "error": "Operación bloqueada: el servidor está en modo solo lectura (READ_ONLY=true).",
  "keywords_detectadas": ["DELETE"]
}

Blocked keywords: INSERT, UPDATE, DELETE, DROP, TRUNCATE, ALTER, CREATE, EXEC, EXECUTE, MERGE, REPLACE, GRANT, REVOKE

⚠️ Set READ_ONLY=false only in controlled environments. It is strongly recommended to also use a SQL Server user with read-only database permissions as an extra safety layer.


🚀 Development

# Clone the repo
git clone https://github.com/dreezdev/dreez-mssql-mcp.git
cd dreez-mssql-mcp

# Install with uv
uv sync

# Run locally
uv run dreez-mssql-mcp

📋 Requirements


📄 License

MIT © dreezdev


👤 Author

Made with ❤️ by dreezdev

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dreez_mssql_mcp-1.1.0.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dreez_mssql_mcp-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file dreez_mssql_mcp-1.1.0.tar.gz.

File metadata

  • Download URL: dreez_mssql_mcp-1.1.0.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dreez_mssql_mcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 22e12d6e44422c5a08652de3df89dfdad2a58e3b73f85f6189f43be9da3261fc
MD5 01266bb5f0fd46a5d28d859a2c905d4f
BLAKE2b-256 d40fedf7a2b5fd2c52ff3176977482f2749f4a0e8410c1bc9cbd3d7a6cc0490e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreez_mssql_mcp-1.1.0.tar.gz:

Publisher: publish.yml on DreezDev/mssql-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dreez_mssql_mcp-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dreez_mssql_mcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa23c71adc7a2fbf094881741e7485e11cdfa33206c0b2ece70a5c6a4b3fc461
MD5 ec6c8ee96ecbab2fdc5b6b1067fccf29
BLAKE2b-256 780906776f4051bd63b581797ec543c3e0debb0aa4e138a361f94b2bff2ec770

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreez_mssql_mcp-1.1.0-py3-none-any.whl:

Publisher: publish.yml on DreezDev/mssql-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 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