Mssql Mcp Server
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
Mssql Mcp Server scores 38 (Limited), licensed MIT and written in Python. It installs as a local process. It declares 3 tools. Filed under Databases. GitHub shows 63 stars. Package registries report about 822 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Limited trust
38 of 100 from six public signals. Nobody can buy a point.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade B
79/100 for listing completeness. Lost points: 1 of 3 tools barely described, short summary, no docs link.
How quality is graded
Where the 38 comes from
0 + 6 + 11 + 10 + 4 + 7 = 38. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 0 of 30 points.How recently the repository saw a commit or release.
Maintenance: 6 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 11 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 7 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "jexinsam-mssql-mcp-server": { "command": "uvx", "args": [ "mssql_mcp_server" ] } }}
Environment variables
This server does not declare environment variables.
Tools3Tool docs quality grade D
All capabilitiesexecute_sqltoolExecute any SQL statement (SELECT, INSERT, UPDATE, DELETE, DDL)
list_tablestoolList all tables in the database
query_sqltoolExecute read-only SELECT queries
About
MSSQL MCP Server
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:
- List available tables
- Read table contents
- Execute SQL queries with controlled access
Built on MCP SDK v2 (2026-07-28 spec) with support for both stdio and Streamable HTTP transports.
Features
- Secure MSSQL Database Access through environment variables
- SQL Injection Protection with identifier validation
- Read-Only & Write Tools with appropriate MCP annotations
- Windows Authentication support via Trusted Connection
- Dual Transport — stdio (default) and HTTP
- Docker Support with pre-configured ODBC drivers
- Comprehensive Logging for monitoring queries and operations
Installation
pip install mssql-mcp-server
Configuration
Set 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
Available Tools
| 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 |
Usage
With Claude Desktop
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"
}
}
}
}
With Cursor IDE
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"
}
}
}
}
With pip install (global)
{
"mcpServers": {
"mssql": {
"command": "mssql_mcp_server",
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}
With Docker
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
Running as a Standalone 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
Development & Testing
# 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.py
Troubleshooting
"Program Not Found" Error
This usually means the mssql_mcp_server command is not in your PATH. Solutions:
- Use
uv(recommended): Configure your MCP client to useuv --directory path/to/mssql_mcp_server run mssql_mcp_server - Use full path: Find the install location with
pip show mssql-mcp-serverand use the scripts directory - Use
python -m: Run aspython -m mssql_mcp_server
MSSQL Driver Issues
The default driver is SQL Server (built into Windows). For Linux/macOS or newer features:
- Install Microsoft ODBC Driver 18
- Set
MSSQL_DRIVER="ODBC Driver 18 for SQL Server"
Connection Timeouts
If using MSSQL_SERVER from other projects, this server supports both MSSQL_HOST and MSSQL_SERVER env vars (with MSSQL_HOST taking priority).
Security Considerations
- Use a dedicated MSSQL user with minimal privileges.
- Never use root credentials or full administrative accounts.
- Restrict database access to only necessary operations (e.g. use
GRANT SELECTonly if the model should not modify data). ThereadOnlyHintanddestructiveHintannotations are for client UX; security is enforced entirely by your database credentials. - Enable logging and auditing for security monitoring.
- Regularly review permissions to ensure least privilege access.
Security Best Practices
For a secure setup:
- Create a dedicated MSSQL user with restricted permissions.
- Avoid hardcoding credentials—use environment variables instead.
- Restrict access to necessary tables and operations only.
- Enable SQL Server logging and monitoring for auditing.
- Review database access regularly to prevent unauthorized access.
For detailed instructions, refer to the MSSQL Security Configuration Guide.
⚠️ IMPORTANT: Always follow the Principle of Least Privilege when configuring database access.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request.
Need Help?
For any questions or issues, feel free to open a GitHub Issue or reach out to the maintainers.
Frequently asked questions
What is Mssql Mcp Server?
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
How do I install Mssql Mcp Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. Mssql Mcp Server runs locally from the PyPI package mssql_mcp_server with the command uvx mssql_mcp_server.
Is Mssql Mcp Server free and open source?
Yes. Mssql Mcp Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does Mssql Mcp Server support remote (HTTP) connections?
No remote endpoint is listed for Mssql Mcp Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does Mssql Mcp Server provide?
Mssql Mcp Server provides 3 tools: execute_sql, list_tables, and query_sql. See the full tool list for descriptions and parameters.
How is Mssql Mcp Server's trust score calculated?
Mssql Mcp Server scores 38 out of 100 (Limited). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.
