MCP server for Microsoft SQL Server databases
Project description
mssql-mcp
An MCP (Model Context Protocol) server for Microsoft SQL Server databases. Enables AI assistants like Claude to interact with SQL Server through a standardized protocol.
Features
- Query Execution: Run SELECT queries with safety limits
- Schema Discovery: List tables, views, and column information
- CRUD Operations: Read, insert, update, and delete rows
- Stored Procedures: Execute stored procedures with parameters
- Export: Export query results to JSON or CSV
- Safety Controls: Command blocklist, read-only mode, row limits, query timeouts
Installation
pip install mssql-mcp
Or install from source:
git clone https://github.com/yourusername/mssql-mcp.git
cd mssql-mcp
pip install -e ".[dev]"
Configuration
Copy .env.sample to .env and configure your settings:
cp .env.sample .env
Required environment variables:
| Variable | Description |
|---|---|
MSSQL_HOST |
SQL Server hostname |
MSSQL_USER |
Database username |
MSSQL_PASSWORD |
Database password |
MSSQL_DATABASE |
Database name |
Optional settings:
| Variable | Default | Description |
|---|---|---|
MSSQL_PORT |
1433 |
Server port |
MSSQL_READ_ONLY |
false |
Block write operations |
MSSQL_MAX_ROWS |
1000 |
Query row limit |
MSSQL_QUERY_TIMEOUT |
60 |
Query timeout (seconds) |
Usage
With Claude Code
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"mssql": {
"command": "mssql-mcp",
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "sa",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}
Standalone
# Run with stdio transport (default)
mssql-mcp
# Run with HTTP transport
mssql-mcp --http
Available Tools
| Tool | Description |
|---|---|
execute_query |
Run a SELECT query |
validate_query |
Check if a query is safe to execute |
list_tables |
List tables and views |
describe_table |
Get column information for a table |
read_rows |
Read rows by ID or filter |
insert_row |
Insert a new row |
update_row |
Update an existing row |
delete_row |
Delete a row |
call_stored_proc |
Execute a stored procedure |
export_to_json |
Export query results to JSON |
export_to_csv |
Export query results to CSV |
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check .
ruff format .
# Type check
mypy src/
License
Apache-2.0
Project details
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 pymssql_mcp-0.2.0.tar.gz.
File metadata
- Download URL: pymssql_mcp-0.2.0.tar.gz
- Upload date:
- Size: 50.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c552e993f3487da7c4adb51952b074b4d4589466decbcf452e7b100676814efa
|
|
| MD5 |
40c48d7c29562a6a496ec6ffa036877d
|
|
| BLAKE2b-256 |
4c2032e2d62d5279fccd813f5f1fa2b5c9b9eba386e803f883b08a384c9a5a1a
|
Provenance
The following attestation bundles were made for pymssql_mcp-0.2.0.tar.gz:
Publisher:
publish.yml on bpamiri/pymssql-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymssql_mcp-0.2.0.tar.gz -
Subject digest:
c552e993f3487da7c4adb51952b074b4d4589466decbcf452e7b100676814efa - Sigstore transparency entry: 774215311
- Sigstore integration time:
-
Permalink:
bpamiri/pymssql-mcp@94f470a15f6a988dc895b8c115f984e25b11cf7e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/bpamiri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94f470a15f6a988dc895b8c115f984e25b11cf7e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pymssql_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pymssql_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 49.4 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 |
58870064821754ff08919b362fc2780cc1b9accd89d6dc343f88bb35637e2a7d
|
|
| MD5 |
45bca9b185e5c2761c29a4ac05450418
|
|
| BLAKE2b-256 |
1e8296abcc0fbea9ef42ecc8778e504e9e10fe2e4c6d18aba4ac76611b9284fe
|
Provenance
The following attestation bundles were made for pymssql_mcp-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on bpamiri/pymssql-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymssql_mcp-0.2.0-py3-none-any.whl -
Subject digest:
58870064821754ff08919b362fc2780cc1b9accd89d6dc343f88bb35637e2a7d - Sigstore transparency entry: 774215315
- Sigstore integration time:
-
Permalink:
bpamiri/pymssql-mcp@94f470a15f6a988dc895b8c115f984e25b11cf7e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/bpamiri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94f470a15f6a988dc895b8c115f984e25b11cf7e -
Trigger Event:
push
-
Statement type: