Get the FREE Ultimate OpenClaw Setup Guide →

mssqlMCP

MCP Server for MSSQL (Microsoft SQL Server)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mcprunner-mssqlmcp dotnet run --project mssqlMCP.csproj \
  --env MSSQL_MCP_KEY="Master encryption key for AES-256 (required)" \
  --env MSSQL_MCP_DATA="Optional path for application data (e.g., /var/data)" \
  --env MSSQL_MCP_API_KEY="Master API key for administrative access (required)"

How to use

This MCP server implements a SQL Server (MSSQL) Model Context Protocol server designed to enable VS Code Copilot to interact with one or more SQL Server databases. It exposes MCP endpoints for standard MCP operations, JSON-RPC 2.0 methods (tools/list and tools/call), and direct REST paths for common database operations such as executing queries and retrieving metadata. The server includes a multi-key authentication system, API key management, and AES-256 encrypted storage of connection strings. Available tools follow a consistent mssql_ prefix naming scheme (e.g., mssql_execute_query, mssql_get_table_metadata, mssql_get_schema, mssql_list_databases). You can use the JSON-RPC endpoint to list tools and call them with the appropriate parameters, or leverage the REST endpoints for straightforward operations against configured MSSQL databases. Client examples in C# demonstrate how to invoke mssql tools via the MCP interface and parse the strongly-typed metadata returned for tables, columns, and keys.

How to install

Prerequisites:

  • .NET 9.0 SDK (or later) installed on the host
  • Access to one or more MSSQL Server databases (connection strings)
  • Optional: Docker if you prefer containerized deployment

Installation steps:

  1. Clone the repository: git clone https://github.com/your-org/mcprunner-mssqlmcp.git cd mcprunner-mssqlmcp

  2. Restore and build the project: dotnet restore dotnet build

  3. Configure environment variables (examples):

    • MSSQL_MCP_KEY: your-32-byte-base64-key
    • MSSQL_MCP_API_KEY: your-master-api-key
    • MSSQL_MCP_DATA: /path/to/data (optional)
  4. Run the MCP server: dotnet run --project mssqlMCP.csproj

  5. Optional: run inside Docker

    • Build: docker build -t mssqlmcp:latest -f Dockerfile .
    • Run: docker run -e MSSQL_MCP_KEY=your-key -e MSSQL_MCP_API_KEY=your-api-key -p 5000:5000 mssqlmcp:latest

Additional notes

Security and authentication: The server uses a multi-key API authentication system with master and user keys. Ensure MSSQL_MCP_KEY and MSSQL_MCP_API_KEY are kept secure and rotate keys as needed. Connection strings are encrypted at rest using AES-256. Review the Security Update Documentation for November 2025 migration steps. If API keys are not provided, authentication may be disabled or rely on configuration to limit access. For debugging, enable verbose logging in appsettings.json or via environment-specific configuration. The server supports async/await for database operations and provides detailed metadata (tables, views, stored procedures, functions, keys) to assist Copilot-driven code generation.

Related MCP Servers

Sponsor this space

Reach thousands of developers