MSSQL
Enables AI assistants to interact with Microsoft SQL Server databases through a standardized interface. Supports executing SQL queries, browsing database schemas, and viewing table data with flexible authentication options for both local and Azure SQ
What is MSSQL?
MSSQL is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables ai assistants to interact with microsoft sql server databases through a standardized interface. supports executing sql queries, browsing database schemas, and viewing table data with flexible ...
Enables AI assistants to interact with Microsoft SQL Server databases through a standardized interface. Supports executing SQL queries, browsing database schemas, and viewing table data with flexible authentication options for both local and Azure SQ
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Enables AI assistants to interact with Microsoft SQL Server
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mssql-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MSSQL
MSSQL MCP Server is a Model Context Protocol server that gives AI assistants secure, structured access to Microsoft SQL Server databases. It exposes tools for listing tables, reading table contents, and executing SQL queries with controlled permissions and comprehensive logging. Developers and analysts use it to let Claude or other AI clients query production or staging SQL Server instances without requiring direct database tooling.
Prerequisites
- Python 3.8+ with pip installed
- A running Microsoft SQL Server instance (local or Azure SQL)
- An MSSQL user account with the minimum required read/write privileges
- uv package manager (recommended) or pip
- An MCP-compatible client such as Claude Desktop
Install the package
Install the mssql-mcp-server package from PyPI using pip or uv.
pip install mssql-mcp-serverCreate a dedicated database user
For security, create a least-privilege SQL Server login that only has SELECT (and any needed write) permissions on the target database. Never use an admin account.
Set environment variables
Export the required connection variables. MSSQL_DRIVER should match your installed ODBC driver name (e.g. 'ODBC Driver 18 for SQL Server'). Set TrustServerCertificate=yes for local self-signed certs.
export MSSQL_DRIVER="ODBC Driver 18 for SQL Server"
export MSSQL_HOST=localhost
export MSSQL_USER=your_username
export MSSQL_PASSWORD=your_password
export MSSQL_DATABASE=your_database
export TrustServerCertificate=yesRun the server
Start the server directly with Python to verify it connects successfully before wiring it to a client.
python -m mssql_mcp_serverConfigure your MCP client
Add the server block to your Claude Desktop config file (claude_desktop_config.json). The uv --directory form lets you run from a local clone; adjust the path to where you installed the package.
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"/path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}MSSQL Examples
Client configuration
Claude Desktop config using uv to run the mssql_mcp_server package with connection details supplied as environment variables.
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"/path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
"MSSQL_HOST": "my-sql-server.database.windows.net",
"MSSQL_USER": "reportuser",
"MSSQL_PASSWORD": "s3cret!",
"MSSQL_DATABASE": "SalesDB"
}
}
}
}Prompts to try
Sample prompts that exercise the available tools once Claude Desktop is connected.
- "List all tables in the connected SQL Server database."
- "Show me the first 20 rows of the Orders table."
- "Run this query: SELECT TOP 10 CustomerID, SUM(TotalAmount) as Revenue FROM Orders GROUP BY CustomerID ORDER BY Revenue DESC"
- "Describe the schema of the Products table including column types."
- "How many rows are in the Invoices table?"Troubleshooting MSSQL
Connection fails with 'No module named pyodbc' or ODBC driver not found
Install the Microsoft ODBC Driver for SQL Server for your OS (e.g. 'ODBC Driver 18 for SQL Server'), then set MSSQL_DRIVER to the exact driver string shown in odbcinst -q -d.
Authentication error: 'Login failed for user'
Verify MSSQL_USER and MSSQL_PASSWORD are correct, that SQL Server Authentication is enabled on the server, and that the user has been granted access to the target MSSQL_DATABASE.
SSL/TLS certificate error on local dev instances
Set the environment variable TrustServerCertificate=yes. Do not use this setting in production — install a valid certificate instead.
Frequently Asked Questions about MSSQL
What is MSSQL?
MSSQL is a Model Context Protocol (MCP) server that enables ai assistants to interact with microsoft sql server databases through a standardized interface. supports executing sql queries, browsing database schemas, and viewing table data with flexible authentication options for both local and azure sq It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MSSQL?
Follow the installation instructions on the MSSQL GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MSSQL?
MSSQL works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MSSQL free to use?
Yes, MSSQL is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MSSQL Alternatives — Similar Databases Servers
Looking for alternatives to MSSQL? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MSSQL in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MSSQL?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.