Microsoft SQL Server
A Model Context Protocol (MCP) server for Microsoft SQL Server that enables secure database interactions through a controlled interface. Allows AI assistants to safely list tables, read data, and execute SQL queries while maintaining security and str
What is Microsoft SQL Server?
Microsoft SQL Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server for microsoft sql server that enables secure database interactions through a controlled interface. allows ai assistants to safely list tables, read data, and execut...
A Model Context Protocol (MCP) server for Microsoft SQL Server that enables secure database interactions through a controlled interface. Allows AI assistants to safely list tables, read data, and execute SQL queries while maintaining security and str
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol (MCP) server for Microsoft SQL Serv
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx microsoft-sql-server-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Microsoft SQL Server
The Microsoft SQL Server MCP server gives AI assistants like Claude a controlled, secure interface to query and manage data in Microsoft SQL Server databases, including on-premises instances, LocalDB, and Azure SQL. It exposes tools to list all tables in a database, read table contents, and execute arbitrary SQL statements (SELECT, INSERT, UPDATE, DELETE) through a standardized MCP protocol. Data engineers and developers use it to let Claude write and run SQL queries, explore schemas, and automate database tasks without exposing raw connection strings in prompts.
Prerequisites
- Python 3.9 or newer
- Microsoft SQL Server instance accessible over the network (on-premises, LocalDB, or Azure SQL)
- SQL Server credentials: hostname, database name, username, and password (or Windows Authentication)
- uvx (from the uv package manager) for the recommended zero-install startup method
- An MCP client such as Claude Desktop
Install the package (optional, for direct Python use)
The server can be run with uvx without any prior installation. Alternatively, install it via pip for permanent availability.
pip install microsoft_sql_server_mcpTest connectivity to your SQL Server
Before configuring the MCP server, confirm your SQL Server is reachable on the expected port (default 1433) and that your credentials work.
# Using sqlcmd or any SQL client to test
sqlcmd -S your_server -d your_database -U your_user -P your_password -Q "SELECT 1"Add the MCP server to Claude Desktop configuration
Open the Claude Desktop config file and add an entry for the MSSQL server. The required environment variables are MSSQL_SERVER and MSSQL_DATABASE, plus credentials for SQL authentication.
{
"mcpServers": {
"mssql": {
"command": "uvx",
"args": ["microsoft_sql_server_mcp"],
"env": {
"MSSQL_SERVER": "your-server-host",
"MSSQL_DATABASE": "your_database",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_PORT": "1433"
}
}
}
}Configure Windows Authentication (if applicable)
For Windows Authentication instead of SQL login, set MSSQL_WINDOWS_AUTH to true and omit MSSQL_USER and MSSQL_PASSWORD. This only works when Claude Desktop runs on a Windows machine joined to the same domain.
{
"mcpServers": {
"mssql": {
"command": "uvx",
"args": ["microsoft_sql_server_mcp"],
"env": {
"MSSQL_SERVER": "your-server-host",
"MSSQL_DATABASE": "your_database",
"MSSQL_WINDOWS_AUTH": "true"
}
}
}
}Restart Claude Desktop and verify
Save the config and restart Claude Desktop. Ask Claude to list the tables in your database to confirm the connection is working.
Microsoft SQL Server Examples
Client configuration
Standard SQL authentication config using uvx for zero-install startup. Replace server, database, and credentials with your actual values. For Azure SQL, MSSQL_ENCRYPT is recommended.
{
"mcpServers": {
"mssql": {
"command": "uvx",
"args": ["microsoft_sql_server_mcp"],
"env": {
"MSSQL_SERVER": "myserver.database.windows.net",
"MSSQL_DATABASE": "sales_db",
"MSSQL_USER": "sqladmin",
"MSSQL_PASSWORD": "yourpassword",
"MSSQL_PORT": "1433",
"MSSQL_ENCRYPT": "true"
}
}
}
}Prompts to try
These prompts work after the MSSQL MCP server is connected and Claude has access to your database.
- "List all tables in the database and describe what each one likely contains"
- "Show me the top 10 rows from the Orders table where status is 'pending'"
- "Write and execute a query to find customers who have placed more than 5 orders this month"
- "What are the column names and data types in the Products table?"
- "Generate a summary report of total sales by region for the last quarter"Troubleshooting Microsoft SQL Server
Connection timeout or 'Cannot open server' error
Check that your SQL Server allows TCP/IP connections on port 1433 (or your custom MSSQL_PORT). For Azure SQL, confirm the firewall rule allows your IP. For on-premises servers, enable TCP/IP in SQL Server Configuration Manager.
Login failed for user error
Verify MSSQL_USER and MSSQL_PASSWORD are correct. Ensure SQL Server Authentication is enabled on the server (not just Windows Authentication). In SSMS: Server Properties > Security > select 'SQL Server and Windows Authentication mode'.
uvx: command not found
Install uv following instructions at https://docs.astral.sh/uv/. On macOS/Linux: 'curl -LsSf https://astral.sh/uv/install.sh | sh'. Then restart your terminal so uvx is on your PATH.
Frequently Asked Questions about Microsoft SQL Server
What is Microsoft SQL Server?
Microsoft SQL Server is a Model Context Protocol (MCP) server that model context protocol (mcp) server for microsoft sql server that enables secure database interactions through a controlled interface. allows ai assistants to safely list tables, read data, and execute sql queries while maintaining security and str It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Microsoft SQL Server?
Follow the installation instructions on the Microsoft SQL Server GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Microsoft SQL Server?
Microsoft SQL Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Microsoft SQL Server free to use?
Yes, Microsoft SQL Server is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
Microsoft SQL Server Alternatives — Similar Databases Servers
Looking for alternatives to Microsoft SQL Server? 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 Microsoft SQL Server 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 Microsoft SQL Server?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.