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

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

Metadata

Release files for dreez-mssql-mcp 1.1.0

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

Source distribution (sdist)

Source distribution for dreez-mssql-mcp 1.1.0
File Size Uploaded Provenance Actions
dreez_mssql_mcp-1.1.0.tar.gz 54.1 kB With provenance Details for dreez_mssql_mcp-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dreez-mssql-mcp 1.1.0
File Interpreter ABI Platform Actions
dreez_mssql_mcp-1.1.0-py3-none-any.whl Python 3 none any Details for dreez_mssql_mcp-1.1.0-py3-none-any.whl

Total release size: 60.2 kB

Release files / dreez_mssql_mcp-1.1.0.tar.gz

Download URL dreez_mssql_mcp-1.1.0.tar.gz
Size 54.1 kB
Tags Source
SHA-256 checksum
How to use checksums
22e12d6e44422c5a08652de3df89dfdad2a58e3b73f85f6189f43be9da3261fc
BLAKE2b-256 checksum
How to use checksums
d40fedf7a2b5fd2c52ff3176977482f2749f4a0e8410c1bc9cbd3d7a6cc0490e
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 Aug 27, 2026.

Transparency log

Release files / dreez_mssql_mcp-1.1.0-py3-none-any.whl

Download URL dreez_mssql_mcp-1.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa23c71adc7a2fbf094881741e7485e11cdfa33206c0b2ece70a5c6a4b3fc461
BLAKE2b-256 checksum
How to use checksums
780906776f4051bd63b581797ec543c3e0debb0aa4e138a361f94b2bff2ec770
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 Aug 27, 2026.

Transparency log

Security for dreez-mssql-mcp 1.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dreez_mssql_mcp-1.1.0.tar.gz

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 Aug 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

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