MSSQL Server MCP implementation written in C#
# Add to your Claude Code skills
git clone https://github.com/Aaronontheweb/mssql-mcpA .NET-powered Model Context Protocol (MCP) server for Microsoft SQL Server.
Why does this exist? Because the other MCP solutions in market for this are generally janky pieces of shit that don't work - certainly not on Windows.
This MCP server provides AI agents with robust, reliable access to Microsoft SQL Server databases through a clean, well-architected .NET application using Akka.NET for internal coordination and the official MCP C# SDK for protocol compliance.
| Tool | Description |
|------|-------------|
| execute_sql | Execute any SQL query against the database |
| list_tables | List all tables with schema, name, type, and row count |
| list_schemas | List all available schemas/databases in the SQL Server instance |
The MCP server requires a single environment variable:
MSSQL_CONNECTION_STRING: Complete SQL Server connection stringWindows Authentication:
MSSQL_CONNECTION_STRING="Server=localhost;Database=MyDatabase;Trusted_Connection=true;"
SQL Server Authentication:
MSSQL_CONNECTION_STRING="Server=localhost;Database=MyDatabase;User Id=myuser;Password=mypassword;"
Azure SQL Database:
MSSQL_CONNECTION_STRING="Server=myserver.database.windows.net;Database=mydatabase;User Id=myuser;Password=mypassword;Encrypt=true;"
The easiest way to run the MCP server is using Docker with .NET's built-in container support.
Clone the repository
# Clone the repository
git clone https://github.com/Aaronontheweb/mssql-mcp.git
cd mssql-mcp
Build the Docker image
dotnet publish --os linux --arch x64 /t:PublishContainer
You can run the container directly if you wish, but it's probably best to let the MCP server spin up the client:
# Run the container
docker run -it --rm \
-e MSSQL_CONNECTION_STRING="Server=host.docker.internal;Database=MyDB;Trusted_Connection=true;" \
mssql-mcp:latest
Add to your Cursor settings (Cursor Settings > Features > Model Context Protocol):
{
"mcpServers": {
"mssql": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MSSQL_CONNECTION_STRING",
...