MSSQL MCP Server
Features CI/CD integration through GitHub Actions for automated testing as indicated by the tests workflow badge
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MSSQL MCP Servershow me the top 10 customers by total purchase amount"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: MCP SQL Server
Installation
pip install mssql-mcp-serverConfiguration
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 HTTPAvailable Tools
Tool | Description | Annotations |
| List all tables in the database | Read-only, Idempotent |
| Execute read-only SELECT queries | Read-only, Idempotent |
| 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-serverRunning 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_serverDevelopment & 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.pyTroubleshooting
"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_serverUse full path: Find the install location with
pip show mssql-mcp-serverand use the scripts directoryUse
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-featureCommit your changes:
git commit -m 'Add amazing feature'Push to the branch:
git push origin feature/amazing-featureOpen a Pull Request.
Need Help?
For any questions or issues, feel free to open a GitHub Issue or reach out to the maintainers.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.1386MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI assistants with comprehensive access to SQL databases, enabling schema inspection, query execution, and database operations with enterprise-grade security.467MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides comprehensive access to Microsoft SQL Server databases, enabling Language Models to inspect schemas, execute queries, manage database objects, and perform advanced database operations.8
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol (MCP) server that enables AI agents to interact with Microsoft SQL Server databases through secure, intelligent database operations. This server provides comprehensive CRUD capabilities, schema introspection, stored procedure execution, transaction management, and bulk opera82940MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JexinSam/mssql_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server