MSSQL

v1.0.0Databasesstable

Enables AI assistants to interact with Microsoft SQL Server databases through a standardized interface. Supports executing SQL queries, browsing database schemas, and viewing table data with flexible authentication options for both local and Azure SQ

aimcpmodel-context-protocolmssqlmssqlmcp
Share:
54
Stars
0
Downloads
0
Weekly
0/5

What is MSSQL?

MSSQL is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables ai assistants to interact with microsoft sql server databases through a standardized interface. supports executing sql queries, browsing database schemas, and viewing table data with flexible ...

Enables AI assistants to interact with Microsoft SQL Server databases through a standardized interface. Supports executing SQL queries, browsing database schemas, and viewing table data with flexible authentication options for both local and Azure SQ

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Enables AI assistants to interact with Microsoft SQL Server

Use Cases

SQL Server interaction and querying
Database schema browsing and management
JexinSam

Maintainer

LicenseMIT License
Languagepython
Versionv1.0.0
UpdatedMay 15, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mssql-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MSSQL

MSSQL MCP Server is a Model Context Protocol server that gives AI assistants secure, structured access to Microsoft SQL Server databases. It exposes tools for listing tables, reading table contents, and executing SQL queries with controlled permissions and comprehensive logging. Developers and analysts use it to let Claude or other AI clients query production or staging SQL Server instances without requiring direct database tooling.

Prerequisites

  • Python 3.8+ with pip installed
  • A running Microsoft SQL Server instance (local or Azure SQL)
  • An MSSQL user account with the minimum required read/write privileges
  • uv package manager (recommended) or pip
  • An MCP-compatible client such as Claude Desktop
1

Install the package

Install the mssql-mcp-server package from PyPI using pip or uv.

pip install mssql-mcp-server
2

Create a dedicated database user

For security, create a least-privilege SQL Server login that only has SELECT (and any needed write) permissions on the target database. Never use an admin account.

3

Set environment variables

Export the required connection variables. MSSQL_DRIVER should match your installed ODBC driver name (e.g. 'ODBC Driver 18 for SQL Server'). Set TrustServerCertificate=yes for local self-signed certs.

export MSSQL_DRIVER="ODBC Driver 18 for SQL Server"
export MSSQL_HOST=localhost
export MSSQL_USER=your_username
export MSSQL_PASSWORD=your_password
export MSSQL_DATABASE=your_database
export TrustServerCertificate=yes
4

Run the server

Start the server directly with Python to verify it connects successfully before wiring it to a client.

python -m mssql_mcp_server
5

Configure your MCP client

Add the server block to your Claude Desktop config file (claude_desktop_config.json). The uv --directory form lets you run from a local clone; adjust the path to where you installed the package.

{
  "mcpServers": {
    "mssql": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
      ],
      "env": {
        "MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
        "MSSQL_HOST": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password",
        "MSSQL_DATABASE": "your_database"
      }
    }
  }
}

MSSQL Examples

Client configuration

Claude Desktop config using uv to run the mssql_mcp_server package with connection details supplied as environment variables.

{
  "mcpServers": {
    "mssql": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
      ],
      "env": {
        "MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
        "MSSQL_HOST": "my-sql-server.database.windows.net",
        "MSSQL_USER": "reportuser",
        "MSSQL_PASSWORD": "s3cret!",
        "MSSQL_DATABASE": "SalesDB"
      }
    }
  }
}

Prompts to try

Sample prompts that exercise the available tools once Claude Desktop is connected.

- "List all tables in the connected SQL Server database."
- "Show me the first 20 rows of the Orders table."
- "Run this query: SELECT TOP 10 CustomerID, SUM(TotalAmount) as Revenue FROM Orders GROUP BY CustomerID ORDER BY Revenue DESC"
- "Describe the schema of the Products table including column types."
- "How many rows are in the Invoices table?"

Troubleshooting MSSQL

Connection fails with 'No module named pyodbc' or ODBC driver not found

Install the Microsoft ODBC Driver for SQL Server for your OS (e.g. 'ODBC Driver 18 for SQL Server'), then set MSSQL_DRIVER to the exact driver string shown in odbcinst -q -d.

Authentication error: 'Login failed for user'

Verify MSSQL_USER and MSSQL_PASSWORD are correct, that SQL Server Authentication is enabled on the server, and that the user has been granted access to the target MSSQL_DATABASE.

SSL/TLS certificate error on local dev instances

Set the environment variable TrustServerCertificate=yes. Do not use this setting in production — install a valid certificate instead.

Frequently Asked Questions about MSSQL

What is MSSQL?

MSSQL is a Model Context Protocol (MCP) server that enables ai assistants to interact with microsoft sql server databases through a standardized interface. supports executing sql queries, browsing database schemas, and viewing table data with flexible authentication options for both local and azure sq It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MSSQL?

Follow the installation instructions on the MSSQL GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MSSQL?

MSSQL works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MSSQL free to use?

Yes, MSSQL is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Databases MCP Servers

Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mssql-mcp-server": { "command": "npx", "args": ["-y", "mssql-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use MSSQL?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides