SqlServer.Mcp.Server 1.0.3

dotnet tool install --global SqlServer.Mcp.Server --version 1.0.3
                    
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.Mcp.Server --version 1.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SqlServer.Mcp.Server&version=1.0.3
                    
nuke :add-package SqlServer.Mcp.Server --version 1.0.3
                    

SQL Server MCP Server 🚀

A professional-grade Model Context Protocol (MCP) server for Microsoft SQL Server, developed by Faizan Shaik.

This server enables AI agents (Claude, Cursor, etc.) to safely interact with your databases for schema exploration, query execution, and data analysis.


✨ Capabilities

  • Natural Language Data Extraction: Ask questions in plain English and get structured data results directly.
  • Natural Language Query Generation: Automatically translate complex requests into optimized SQL queries.
  • Schema Exploration: List databases, tables, columns, data types, indexes, and foreign keys.
  • Query Execution: Run standard SELECT queries with automatic pagination and file-based output for large results.
  • Stored Procedures & Functions: Inspect definitions and execute stored procedures/functions.
  • Query Optimization: Analyze and optimize SQL queries using built-in AI optimization tools.
  • Object Generation: Generate CREATE TABLE and PROCEDURE scripts following best practices.
  • View Support: Inspect view definitions and query views like standard tables.

Current Status: READ-ONLY. This server is currently configured for read-only operations to ensure data safety. Destructive operations (INSERT, UPDATE, DELETE) are disabled by default.


🛠 Connection Methods & Configuration

This guide provides complete JSON configurations for your claude_desktop_config.json or Cursor settings. Select the method and authentication type that matches your environment.

1. Using Docker 🐳

Docker Image: faizu786/sql_server_mcp_server:latest

A. SQL Server Authentication (Docker)
{
  "mcpServers": {
    "sql-server-docker-sql": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--name", "sql-server-mcp",
        "-e", "ConnectionProfiles__0__Name=ProdServer",
        "-e", "ConnectionProfiles__0__Server=db.example.com",
        "-e", "ConnectionProfiles__0__Database=CompanyDB",
        "-e", "ConnectionProfiles__0__UserId=faizu_admin",
        "-e", "ConnectionProfiles__0__Password=your_password",
        "-e", "ConnectionProfiles__0__TrustServerCertificate=true",
        "faizu786/sql_server_mcp_server:latest"
      ]
    }
  }
}
B. Connection String Mode (Docker)
{
  "mcpServers": {
    "sql-server-docker-conn": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--name", "sql-server-mcp",
        "-e", "ConnectionProfiles__0__Name=DirectConn",
        "-e", "ConnectionProfiles__0__ConnectionString=Server=my.db.com;Database=mydb;User Id=sa;Password=pass;TrustServerCertificate=True;",
        "faizu786/sql_server_mcp_server:latest"
      ]
    }
  }
}

2. Using NuGet Tool 📦

Install: dotnet tool install -g SqlServer.Mcp.Server

A. SQL Server Authentication (NuGet)
{
  "mcpServers": {
    "sql-server-nuget-sql": {
      "command": "sqlserver-mcp",
      "env": {
        "ConnectionProfiles__0__Name": "ExternalDB",
        "ConnectionProfiles__0__Server": "db.cloud.com",
        "ConnectionProfiles__0__Database": "MainDB",
        "ConnectionProfiles__0__UserId": "faizu_user",
        "ConnectionProfiles__0__Password": "your_password",
        "ConnectionProfiles__0__TrustServerCertificate": "true"
      }
    }
  }
}
B. Connection String Mode (NuGet)
{
  "mcpServers": {
    "sql-server-nuget-conn": {
      "command": "sqlserver-mcp",
      "env": {
        "ConnectionProfiles__0__Name": "AzureSQL",
        "ConnectionProfiles__0__ConnectionString": "Server=tcp:myserver.database.windows.net,1433;Initial Catalog=mydb;User ID=user;Password=pass;Encrypt=True;TrustServerCertificate=False;"
      }
    }
  }
}

3. Using Local Source Code 💻

Path: src/SqlServerMcpServer

A. SQL Server Authentication (Local Source)
{
  "mcpServers": {
    "sql-server-local-sql": {
      "command": "dotnet",
      "args": [
        "run", "--project", "C:\\path\\to\\SqlServer_MCP\\src\\SqlServerMcpServer",
        "--", 
        "ConnectionProfiles__0__Name=ProdServer",
        "ConnectionProfiles__0__Server=db.example.com",
        "ConnectionProfiles__0__Database=CompanyDB",
        "ConnectionProfiles__0__UserId=faizu_admin",
        "ConnectionProfiles__0__Password=your_password",
        "ConnectionProfiles__0__TrustServerCertificate=true"
      ]
    }
  }
}
B. Connection String Mode (Local Source)
{
  "mcpServers": {
    "sql-server-local-conn": {
      "command": "dotnet",
      "args": [
        "run", "--project", "C:\\path\\to\\SqlServer_MCP\\src\\SqlServerMcpServer",
        "--", 
        "ConnectionProfiles__0__Name=DirectConn",
        "ConnectionProfiles__0__ConnectionString=Server=my.db.com;Database=mydb;User Id=sa;Password=pass;TrustServerCertificate=True;"
      ]
    }
  }
}

👨‍💻 Created By

Faizan Shaik

📄 License

MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.3 97 5/4/2026
1.0.2 93 5/3/2026
1.0.1 94 5/3/2026
1.0.0 90 5/3/2026