Get the FREE Ultimate OpenClaw Setup Guide →

mssql

MSSQL Server MCP implementation written in C#

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aaronontheweb-mssql-mcp docker 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;"

How to use

This MCP server provides AI agents with a dedicated interface to interact with a Microsoft SQL Server database. Through the available tools, you can discover database schemas, list tables and schemas, and execute arbitrary SQL queries directly from the MCP layer. The server uses a .NET-based implementation and Akka.NET for coordination, ensuring robust error handling and clean formatting of results for AI consumption. The primary tools exposed are: execute_sql to run any SQL statement, list_tables to retrieve table metadata including schema, name, type, and row count, and list_schemas to enumerate available schemas/databases in the SQL Server instance. To use it, connect via a Docker container (or your preferred deployment method) and supply a valid MSSQL_CONNECTION_STRING so the MCP server can authenticate against your database. The results are formatted into readable tables and error messages are actionable to help troubleshoot database access issues.

How to install

Prerequisites: Docker installed on your system, access to the network to pull the mssql-mcp Docker image, and a valid MSSQL server you can connect to.

  1. Install Docker:
  • Windows: Docker Desktop
  • macOS: Docker Desktop
  • Linux: follow your distro's guide to install Docker Engine
  1. Pull and Run the MCP server via Docker:
# Run the MCP server container with your MSSQL connection string (example)
docker run -it --rm \
  -e MSSQL_CONNECTION_STRING="Server=host.docker.internal,1533;Database=MyDb;User Id=myUser;Password=myPassword;TrustServerCertificate=true;" \
  mssql-mcp:latest
  1. Alternatively, build your own image if you have a custom MSSQL setup:
# If you have a Dockerfile in the repo
git clone https://github.com/Aaronontheweb/mssql-mcp.git
cd mssql-mcp
# Build image locally
docker build -t mssql-mcp:local .
  1. Validate connectivity:
  • Ensure MSSQL_CONNECTION_STRING is correct and that the SQL Server is reachable from your Docker host.
  • Check container logs for startup messages and any connectivity errors.
  1. Optional: integrate with your MCP client (Cursor or Claude Desk-top) using the provided configuration examples in the README.

Additional notes

Notes and tips:

  • Always supply a valid MSSQL_CONNECTION_STRING; incorrect credentials or network access will result in startup or runtime errors.
  • If using Windows Authentication, ensure the connection string is formatted accordingly and that the container can reach the Windows-hosted SQL Server.
  • When running in Docker, use host.docker.internal (or an appropriate host address) to reach a locally hosted SQL Server from inside the container.
  • For production, consider enabling TLS/Encrypt in the connection string and managing secrets securely (do not hard-code credentials in your config).
  • The MCP server supports standard SQL statements (SELECT/INSERT/UPDATE/DELETE) and DDL as needed by your agents; errors are surfaced with actionable messages for easier debugging.
  • If you require multiple MCP servers, repeat the mcpServers entry with distinct names and separate connection strings.

Related MCP Servers

Sponsor this space

Reach thousands of developers