Provides AI agents robust access to Microsoft SQL Server with schema discovery, query execution, and readable results.
Configuration
View docs{
"mcpServers": {
"aaronontheweb-mssql-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MSSQL_CONNECTION_STRING",
"mssql-mcp:latest"
],
"env": {
"MSSQL_CONNECTION_STRING": "Server=host.docker.internal;Database=MyDb;User Id=myUser;Password=myPassword;TrustServerCertificate=true;"
}
}
}
}You run a Microsoft SQL Server MCP server powered by .NET to give AI agents reliable, structured access to your databases. It supports schema discovery, SQL execution across DDL and DML, automatic startup checks, clean error messages, and readable table formatting, with Docker support for easy deployment.
Start by running the MCP server in an environment that can reach your SQL Server instance. You will connect your MCP client (Cursor, Claude Desktop, or another MCP client) to the server using either a local binary or a Docker container. The server exposes tools to discover schemas, list tables, and execute SQL queries. Use AI prompts to describe the data you want and the server will translate that into safe SQL, return results in readable tables, and handle errors clearly.
Prerequisites you need to prepare before running the MCP server:
Install Docker on your machine to run the MCP server container.
Option A: Run the MCP server with Docker (recommended) using the following command pattern.
1) Pull and run the container with your MSSQL connection string.
The MCP server requires a single environment variable to connect to your SQL Server instance.
Follow best practices for database access control. Grant the minimum permissions needed by the MCP user and prefer encrypted connections for production use. Regularly review access, rotate credentials, and enable audit logging on the SQL Server where possible.
If you cannot reach SQL Server from within Docker, verify networking settings and ensure host accessibility, using host.docker.internal or proper network configuration per your platform.
Execute any SQL query against the connected SQL Server database, returning results or acknowledging DML/DDL operations.
List all tables with schema, name, type, and row count to help agents understand database structure.
List all available schemas/databases in the SQL Server instance for rapid exploration.