SQL Server
MCP Server for MSSQL (Microsoft SQL Server)
What is SQL Server?
SQL Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server for mssql (microsoft sql server)
MCP Server for MSSQL (Microsoft SQL Server)
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- MCP Server for MSSQL (Microsoft SQL Server)
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mssqlmcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use SQL Server
The mssqlMCP server brings Microsoft SQL Server connectivity into MCP-compatible AI assistants like Claude. Built on .NET 9, it provides AES-256 encrypted connection management, multi-tier API key authentication, and a rich set of tools for querying tables, inspecting schemas, managing SQL Server Agent jobs, and even pulling Azure DevOps analytics—all from natural language prompts.
Prerequisites
- .NET 9.0 SDK installed on the host machine
- A running Microsoft SQL Server instance (local or remote)
- Node.js 18+ if using the npx launch method
- An encryption key value for MSSQL_MCP_KEY (any strong random string)
- An API key value for MSSQL_MCP_API_KEY (used for admin access)
Clone the repository
Pull the mssqlMCP source from GitHub so you can build and run it locally.
git clone https://github.com/MCPRUNNER/mssqlMCP.git
cd mssqlMCPSet required environment variables
Export the master encryption key and master API key before starting the server. These are mandatory—the server will refuse to start without them.
export MSSQL_MCP_KEY="your-strong-encryption-key"
export MSSQL_MCP_API_KEY="your-master-api-key"Run the server
Use the provided PowerShell helper for automated key generation, or start directly with dotnet run for full manual control.
# Automated startup (PowerShell)
.\Scripts\Start-MCP-Encrypted.ps1
# Manual startup (.NET CLI)
dotnet runRegister a SQL Server connection
Use the mssql_add_connection tool to register your first database. Connections are stored encrypted in a local connections.db SQLite file.
# Via MCP tool call (JSON-RPC)
{
"method": "tools/call",
"params": {
"name": "mssql_add_connection",
"arguments": {
"name": "MyDatabase",
"connectionString": "Server=localhost;Database=AdventureWorks2022;User Id=sa;Password=YourPass;"
}
}
}Add the server to Claude Desktop
Edit your claude_desktop_config.json to register the MCP server. Use the Docker image for the simplest setup.
{
"mcpServers": {
"mssqlmcp": {
"command": "docker",
"args": ["run", "-i", "--rm",
"-e", "MSSQL_MCP_KEY=your-encryption-key",
"-e", "MSSQL_MCP_API_KEY=your-api-key",
"mcprunner/mssqlmcp"
]
}
}
}SQL Server Examples
Client configuration
Claude Desktop config using the official Docker image. Replace env values with your actual keys.
{
"mcpServers": {
"mssqlmcp": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MSSQL_MCP_KEY=my-aes-key-here",
"-e", "MSSQL_MCP_API_KEY=my-admin-key-here",
"mcprunner/mssqlmcp"
]
}
}
}Prompts to try
Example natural language prompts once the server is connected to Claude.
- "List all tables in the dbo schema of MyDatabase"
- "Run SELECT TOP 10 * FROM Sales.Customer and show me the results"
- "What stored procedures exist in the AdventureWorks2022 database?"
- "Show me the SQL Server Agent jobs and their last run status"
- "Generate a summary of the columns and data types in the Orders table"Troubleshooting SQL Server
Server refuses to start with a missing key error
Both MSSQL_MCP_KEY and MSSQL_MCP_API_KEY must be set as environment variables before running. Export them in the same shell session where you call dotnet run.
Connection test fails even though SQL Server is running
Verify the connection string format includes the correct Server, Database, User Id, and Password fields. For Windows Authentication use 'Integrated Security=True' instead of credentials. Also confirm TCP/IP is enabled in SQL Server Configuration Manager.
401 Unauthorized when calling tools via REST
Pass your API key in the Authorization header as 'Bearer your-api-key', or use the X-API-Key header. User-scoped keys created with mssql_create_key work for non-admin tools.
Frequently Asked Questions about SQL Server
What is SQL Server?
SQL Server is a Model Context Protocol (MCP) server that mcp server for mssql (microsoft sql server) It connects AI assistants to external tools and data sources through a standardized interface.
How do I install SQL Server?
Follow the installation instructions on the SQL Server GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with SQL Server?
SQL Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is SQL Server free to use?
Yes, SQL Server is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
SQL Server Alternatives — Similar Databases Servers
Looking for alternatives to 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 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 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.