SqlServer.McpServer 1.0.0

{
  "inputs": [
    {
      "type": "promptString",
      "id": "SQLSERVER_CONNECTION_STRING",
      "description": "SQL Server connection string"
    }
  ],
  "servers": {
    "SqlServer.McpServer": {
      "type": "stdio",
      "command": "dnx",
      "args": ["SqlServer.McpServer@1.0.0", "--yes"],
      "env": {
        "SQLSERVER_CONNECTION_STRING": "${input:SQLSERVER_CONNECTION_STRING}"
      }
    }
  }
}
                    
This package contains an MCP Server. The server can be used in VS Code by copying the generated JSON to your VS Code workspace's .vscode/mcp.json settings file.
dotnet tool install --global SqlServer.McpServer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SqlServer.McpServer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SqlServer.McpServer&version=1.0.0
                    
nuke :add-package SqlServer.McpServer --version 1.0.0
                    

SQL Server MCP Server (SqlServer.McpServer)

Read-only SQL Server Model Context Protocol (MCP) server that enables AI assistants (VS Code Copilot, Claude Desktop, Antigravity, Cursor, etc.) to query any SQL Server database.

Features

  • Read-Only Safety: Restricts queries strictly to read-only SELECT and WITH queries. Blocks INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, EXEC, etc.
  • Cross-Platform: Self-contained binaries for win-x64, win-arm64, osx-x64, osx-arm64, linux-x64, and linux-arm64.
  • Flexible Configuration: Accepts database connection strings via environment variables (SQLSERVER_CONNECTION_STRING).

Quickstart Configuration

Add SqlServer.McpServer to your MCP configuration file (e.g. mcp_config.json or .mcp.json):

Using dnx (NuGet Package)

{
  "mcpServers": {
    "sql-server": {
      "command": "dnx",
      "args": [
        "SqlServer.McpServer",
        "--version",
        "1.0.0",
        "--yes"
      ],
      "env": {
        "SQLSERVER_CONNECTION_STRING": "Server=your-host;Database=YourDb;User Id=sa;Password=your_password;Encrypt=True;TrustServerCertificate=True;"
      }
    }
  }
}

Direct Local Execution (dotnet run)

{
  "mcpServers": {
    "sql-server": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "D:\\path\\to\\sql-server-mcp\\sql-server-mcp.csproj"
      ],
      "env": {
        "SQLSERVER_CONNECTION_STRING": "Server=your-host;Database=YourDb;User Id=sa;Password=your_password;Encrypt=True;TrustServerCertificate=True;"
      }
    }
  }
}

Tools Available

execute_select_query

Executes a read-only SQL SELECT statement on the configured database and returns the result set as JSON.

  • Parameter: query (string) - The read-only SQL query to execute.

Environment Variables

Variable Required Description
SQLSERVER_CONNECTION_STRING Yes Standard ADO.NET SQL Server connection string

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.0 124 8/24/2026