
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
MSSQL MCP Server is a Model Context Protocol (MCP) server that enables secure and structured interaction with Microsoft SQL Server (MSSQL) databases. It allows AI assistants to:
Built on MCP SDK v2 (2026-07-28 spec) with support for both stdio and Streamable HTTP transports.
pip install mssql-mcp-serverSet the following environment variables to configure database access:
# Required
MSSQL_DATABASE=your_database
# Authentication (choose one):
# Option 1: SQL Server Authentication
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
# Option 2: Windows / Kerberos Authentication
Trusted_Connection=yes
# Optional
MSSQL_HOST=localhost # or use MSSQL_SERVER
MSSQL_DRIVER=SQL Server # default driver
TrustServerCertificate=no # default: no (set to yes for self-signed certs)
MCP_TRANSPORT=stdio # or "streamable-http" for Streamable HTTP| Tool | Description | Annotations |
|---|---|---|
list_tables | List all tables in the database | Read-only, Idempotent |
query_sql | Execute read-only SELECT queries | Read-only, Idempotent |
execute_sql | Execute any SQL statement (SELECT, INSERT, UPDATE, DELETE, DDL) | Destructive |
Add this configuration to claude_desktop_config.json:
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}Add this to your .cursor/mcp.json:
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}{
"mcpServers": {
"mssql": {
"command": "mssql_mcp_server",
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}docker build -t mssql-mcp-server .
docker run -e MSSQL_HOST=host.docker.internal \
-e MSSQL_USER=your_username \
-e MSSQL_PASSWORD=your_password \
-e MSSQL_DATABASE=your_database \
mssql-mcp-server# Install dependencies
pip install -r requirements.txt
# Run the server (stdio)
python -m mssql_mcp_server
# Run with HTTP transport
MCP_TRANSPORT=streamable-http python -m mssql_mcp_server# Clone the repository
git clone https://github.com/JexinSam/mssql_mcp_server.git
cd mssql_mcp_server
# Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -r requirements-dev.txt
pip install -e .
# Run tests
pytest -v
# Test with MCP Inspector
uv run mcp dev src/mssql_mcp_server/server.pyThis usually means the mssql_mcp_server command is not in your PATH. Solutions:
uv (recommended): Configure your MCP client to use uv --directory path/to/mssql_mcp_server run mssql_mcp_serverpip show mssql-mcp-server and use the scripts directorypython -m: Run as python -m mssql_mcp_serverThe default driver is SQL Server (built into Windows). For Linux/macOS or newer features:
MSSQL_DRIVER="ODBC Driver 18 for SQL Server"If using MSSQL_SERVER from other projects, this server supports both MSSQL_HOST and MSSQL_SERVER env vars (with MSSQL_HOST taking priority).
GRANT SELECT only if the model should not modify data). The readOnlyHint and destructiveHint annotations are for client UX; security is enforced entirely by your database credentials.For a secure setup:
For detailed instructions, refer to the MSSQL Security Configuration Guide.
⚠️ IMPORTANT: Always follow the Principle of Least Privilege when configuring database access.
This project is licensed under the MIT License. See the LICENSE file for details.
We welcome contributions! To contribute:
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureFor any questions or issues, feel free to open a GitHub Issue or reach out to the maintainers.
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add mssql -- uv --directory path/to/mssql_mcp_server run mssql_mcp_server{
"mcpServers": {
"mssql": {
"env": {
"MSSQL_HOST": "",
"MSSQL_USER": "",
"MSSQL_DATABASE": "",
"MSSQL_PASSWORD": ""
},
"args": [
"--directory",
"path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"command": "uv"
}
}
}code --add-mcp '{"name":"mssql","env":{"MSSQL_HOST":"","MSSQL_USER":"","MSSQL_DATABASE":"","MSSQL_PASSWORD":""},"args":["--directory","path/to/mssql_mcp_server","run","mssql_mcp_server"],"command":"uv"}'[mcp_servers.mssql]
command = "uv"
args = ["--directory", "path/to/mssql_mcp_server", "run", "mssql_mcp_server"]Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/mssql-mcp-server to learn what the "MSSQL MCP Server" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
docker run -e MSSQL_HOST=host.docker.internalThis server runs locally, so we can't read its tool list over the web yet.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/mssql-mcp-server)Nothing comparable is listed yet.
v1.0.0Release notesv0.1.2Release notesv0.1.1Release notesv0.1.0Release notesConnect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "mssql-mcp-server" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.