SQL Server

v1.0.0Databasesstable

MCP Server for MSSQL (Microsoft SQL Server)

mcpmcp-servermcp-tools
Share:
9
Stars
0
Downloads
0
Weekly
0/5

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

Query and manage Microsoft SQL Server databases through MCP.
Perform database operations with AI assistance.
MCPRUNNER

Maintainer

LicenseMIT
Languagec#
Versionv1.0.0
UpdatedMay 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mssqlmcp

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

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 mssqlMCP
2

Set 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"
3

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 run
4

Register 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;"
    }
  }
}
5

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.

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.

Quick Config Preview

{ "mcpServers": { "mssqlmcp": { "command": "npx", "args": ["-y", "mssqlmcp"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides