Microsoft SQL Server MCP is an MCP server that provides AI agents with direct access to Microsoft SQL Server databases. Built as a .NET application utilizing Akka.NET for internal coordination and the official MCP C# SDK, it allows database administrators, software engineers, and data analysts to inspect schemas and run queries directly from compatible MCP clients. The server enables users to connect to local SQL Server instances, Azure SQL databases, or remote enterprise deployments using standard connection strings with Windows or SQL Server authentication. Through its protocol tools, AI models can discover schemas, view existing tables with row counts, and execute full SQL operations including SELECT, INSERT, UPDATE, DELETE, and DDL commands. The server validates connections automatically on startup, formats query outputs into structured tables suitable for language model consumption, and provides detailed error messages when queries fail. It can be run either as a compiled local .NET binary or as an isolated Docker container configured through environment variables.
Category: Databases & Data Stores
Tags: database, dotnet, mssql, sql server
Visit Microsoft SQL Server MCP
bash git clone https://github.com/Aaronontheweb/mssql-mcp.git cd mssql-mcp dotnet publish --os linux --arch x64 /t:PublishContainer 2. Open your client configuration file, such as Claude Desktop's claude_desktop_config.json or Cursor's Model Context Protocol settings. 3. Add the mssql server configuration using Docker: json { "mcpServers": { "mssql": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "MSSQL_CONNECTION_STRING", "mssql-mcp:latest" ], "env": { "MSSQL_CONNECTION_STRING": "Server=host.docker.internal,1533; Database=MyDb; User Id=myUser; Password=My(!)Password;TrustServerCertificate=true;" } } } } 4. Alternatively, point the command directly to the compiled binary /path/to/mssql-mcp/src/MSSQL.MCP/bin/Release/net9.0/MSSQL.MCP and restart your client.Part of MCP Servers
You can install Microsoft SQL Server MCP by cloning its GitHub repository and building the container using the dotnet publish container command. Once the Docker image is built, you register it in your MCP client configuration file by invoking the docker run command with the MSSQL_CONNECTION_STRING environment variable. Alternatively, you can build and run the .NET binary directly.
Microsoft SQL Server MCP provides three primary tools: list_schemas to view available schemas and databases, list_tables to inspect table names along with types and row counts, and execute_sql to run arbitrary SQL statements including SELECT, INSERT, UPDATE, DELETE, and DDL statements. Query outputs are returned in readable table formats for LLMs.
It works with any standard Model Context Protocol client that supports stdio process execution. The project includes explicit configuration instructions for Claude Desktop and the Cursor IDE, executing either through a local Docker container or directly as a standalone .NET executable.
When running the MCP server inside Docker, replace localhost with host.docker.internal in the MSSQL_CONNECTION_STRING environment variable. This allows the Docker container to route traffic back to the host machine where your SQL Server instance is listening, such as on port 1433 or a custom port.