MCP Server custom para SQL Server
Project description
dreez-mssql-mcp
A Model Context Protocol (MCP) server for SQL Server — built with read-only safety, pyodbc, and full compatibility with
uvx.
✨ 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=falseonly 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
- Python >= 3.11
- ODBC Driver 18 for SQL Server
pyodbc >= 5.0.0mcp[cli] >= 1.0.0
📄 License
MIT © dreezdev
👤 Author
Made with ❤️ by dreezdev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dreez_mssql_mcp-1.0.0.tar.gz.
File metadata
- Download URL: dreez_mssql_mcp-1.0.0.tar.gz
- Upload date:
- Size: 52.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abfd5b8e79b13dd97d6aeb1d1bda7e32976225080390c2d57f8fe01a4798065e
|
|
| MD5 |
11c6ef6c59c5fe9bbe6bdbafdb246f33
|
|
| BLAKE2b-256 |
700cf3b01f0f28ee4acf6d1718e8963f85a39736e729be21fd7aa79cd96b2ac9
|
Provenance
The following attestation bundles were made for dreez_mssql_mcp-1.0.0.tar.gz:
Publisher:
publish.yml on DreezDev/mssql-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dreez_mssql_mcp-1.0.0.tar.gz -
Subject digest:
abfd5b8e79b13dd97d6aeb1d1bda7e32976225080390c2d57f8fe01a4798065e - Sigstore transparency entry: 1030868737
- Sigstore integration time:
-
Permalink:
DreezDev/mssql-mcp@e61ef4514a643a6e22fdf4261b54f499fafd68d6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/DreezDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e61ef4514a643a6e22fdf4261b54f499fafd68d6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dreez_mssql_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dreez_mssql_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f87a64bd4a1b005de1ed6fbdb797cca9fe2fc09afa57ad59f415f6f5db9c12
|
|
| MD5 |
5febf789593521891da38ee37ec5ab3b
|
|
| BLAKE2b-256 |
807f635e3c8bd774fbc649b1c232cbbd1a1f3eb39f8910f5ae9f387240ee9313
|
Provenance
The following attestation bundles were made for dreez_mssql_mcp-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on DreezDev/mssql-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dreez_mssql_mcp-1.0.0-py3-none-any.whl -
Subject digest:
63f87a64bd4a1b005de1ed6fbdb797cca9fe2fc09afa57ad59f415f6f5db9c12 - Sigstore transparency entry: 1030868792
- Sigstore integration time:
-
Permalink:
DreezDev/mssql-mcp@e61ef4514a643a6e22fdf4261b54f499fafd68d6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/DreezDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e61ef4514a643a6e22fdf4261b54f499fafd68d6 -
Trigger Event:
push
-
Statement type: