Microsoft SQL Server MCP Server (v2)
A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.
This is a fork of RichardHan/mssql_mcp_server (original copyright Dana K. Williams, MIT licensed), ported to the
mcp2.xon_*-handler server API and republished under a new package name so it can be installed independently of the original. See Credits below. No changes have been proposed back to the upstream repo.
Features
- 🔍 List database tables
- 📊 Execute SQL queries (SELECT, INSERT, UPDATE, DELETE)
- 🔐 Multiple authentication methods (SQL, Windows, Azure AD)
- 🏢 LocalDB and Azure SQL support
- 🔌 Custom port configuration
Quick Start
Install with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mssql": {
"command": "uvx",
"args": ["--from", "mssql-mcp-server-v2", "mssql_mcp_server"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_DATABASE": "your_database",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password"
}
}
}
}
--from is required because the PyPI package name (mssql-mcp-server-v2) is
different from the command it provides (mssql_mcp_server) — without it,
uvx tries to fetch a package literally named mssql_mcp_server, which
doesn't exist.
On Windows, use mssql_mcp_server.exe (with the .exe suffix) as the
last arg instead of mssql_mcp_server:
"args": ["--from", "mssql-mcp-server-v2", "mssql_mcp_server.exe"],
Configuration
Basic SQL Authentication
MSSQL_SERVER=localhost # Required
MSSQL_DATABASE=your_database # Required
MSSQL_USER=your_username # Required for SQL auth
MSSQL_PASSWORD=your_password # Required for SQL auth
Windows Authentication
MSSQL_SERVER=localhost
MSSQL_DATABASE=your_database
MSSQL_WINDOWS_AUTH=true # Use Windows credentials
Azure SQL Database
MSSQL_SERVER=your-server.database.windows.net
MSSQL_DATABASE=your_database
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
# Encryption is automatic for Azure
Optional Settings
MSSQL_PORT=1433 # Custom port (default: 1433)
MSSQL_ENCRYPT=true # Force encryption
Alternative Installation Methods
Using pip
pip install mssql-mcp-server-v2
Then in claude_desktop_config.json:
{
"mcpServers": {
"mssql": {
"command": "python",
"args": ["-m", "mssql_mcp_server"],
"env": { ... }
}
}
}
Development
git clone https://github.com/SL33PiNg/mssql_mcp_server.git
cd mssql_mcp_server
pip install -e .
Requirements
Requires mcp>=2.0.0, which uses the constructor on_*-handler Server API
(no @app.list_resources()-style decorators). If you're pinned to mcp<2
for another server, install this package in an isolated environment (e.g.
via uvx --from mssql-mcp-server-v2 mssql_mcp_server, as above) rather than
the same venv.
Security
- Create a dedicated SQL user with minimal permissions
- Never use admin/sa accounts
- Use Windows Authentication when possible
- Enable encryption for sensitive data
Credits
This project is a fork of RichardHan/mssql_mcp_server,
originally licensed MIT under copyright Dana K. Williams (see LICENSE).
All credit for the original design and implementation goes to them. This fork
exists solely to port the server to the mcp 2.x server API and publish it
under a distinct package name (mssql-mcp-server-v2) independent of the
original, since the original package still targets mcp 1.x.
License
MIT
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 mssql_mcp_server_v2-0.2.0.tar.gz.
File metadata
- Download URL: mssql_mcp_server_v2-0.2.0.tar.gz
- Upload date:
- Size: 70.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1f019ce7f509ede4457df7e2ec226404f76c177834472bc494f5e3c9744ed69
|
|
| MD5 |
b2f78930477e2285068467ddcba8f82e
|
|
| BLAKE2b-256 |
22e0b4247250f29105b2e2d3d01e214206962ceeabb42ccfbd5093f5ae73112d
|
Provenance
The following attestation bundles were made for mssql_mcp_server_v2-0.2.0.tar.gz:
Publisher:
publish.yml on SL33PiNg/mssql_mcp_server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mssql_mcp_server_v2-0.2.0.tar.gz -
Subject digest:
a1f019ce7f509ede4457df7e2ec226404f76c177834472bc494f5e3c9744ed69 - Sigstore transparency entry: 2287085212
- Sigstore integration time:
-
Permalink:
SL33PiNg/mssql_mcp_server@2d4a4d03b35dc92338296548c7b0eb711e6c8aed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/SL33PiNg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2d4a4d03b35dc92338296548c7b0eb711e6c8aed -
Trigger Event:
release
-
Statement type:
File details
Details for the file mssql_mcp_server_v2-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mssql_mcp_server_v2-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5d7bbe66419b8a805f30250c520226644fe193c22f05fc5f6ae0cdd4a0c4a28
|
|
| MD5 |
a3118dfb0c1e420689abe180f08c9220
|
|
| BLAKE2b-256 |
542a8dc4c3975c89bf60879f2649df54f39de9fbafc065fe2017bd22c6a870b5
|
Provenance
The following attestation bundles were made for mssql_mcp_server_v2-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on SL33PiNg/mssql_mcp_server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mssql_mcp_server_v2-0.2.0-py3-none-any.whl -
Subject digest:
e5d7bbe66419b8a805f30250c520226644fe193c22f05fc5f6ae0cdd4a0c4a28 - Sigstore transparency entry: 2287085225
- Sigstore integration time:
-
Permalink:
SL33PiNg/mssql_mcp_server@2d4a4d03b35dc92338296548c7b0eb711e6c8aed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/SL33PiNg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2d4a4d03b35dc92338296548c7b0eb711e6c8aed -
Trigger Event:
release
-
Statement type: