Skip to main content

Microsoft SQL Server MCP Server (v2)

PyPI License: MIT

Microsoft SQL Server MCP server

A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.

This is a fork of RichardHan/mssql_mcp_server (original copyright Dana K. Williams, MIT licensed), ported to the mcp 2.x on_*-handler server API and republished under a new package name so it can be installed independently of the original. See Credits below. No changes have been proposed back to the upstream repo.

Features

  • 🔍 List database tables
  • 📊 Execute SQL queries (SELECT, INSERT, UPDATE, DELETE)
  • 🔐 Multiple authentication methods (SQL, Windows, Azure AD)
  • 🏢 LocalDB and Azure SQL support
  • 🔌 Custom port configuration

Quick Start

Install with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mssql": {
      "command": "uvx",
      "args": ["--from", "mssql-mcp-server-v2", "mssql_mcp_server"],
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_DATABASE": "your_database",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password"
      }
    }
  }
}

--from is required because the PyPI package name (mssql-mcp-server-v2) is different from the command it provides (mssql_mcp_server) — without it, uvx tries to fetch a package literally named mssql_mcp_server, which doesn't exist.

On Windows, use mssql_mcp_server.exe (with the .exe suffix) as the last arg instead of mssql_mcp_server:

"args": ["--from", "mssql-mcp-server-v2", "mssql_mcp_server.exe"],

Configuration

Basic SQL Authentication

MSSQL_SERVER=localhost          # Required
MSSQL_DATABASE=your_database    # Required
MSSQL_USER=your_username        # Required for SQL auth
MSSQL_PASSWORD=your_password    # Required for SQL auth

Windows Authentication

MSSQL_SERVER=localhost
MSSQL_DATABASE=your_database
MSSQL_WINDOWS_AUTH=true         # Use Windows credentials

Azure SQL Database

MSSQL_SERVER=your-server.database.windows.net
MSSQL_DATABASE=your_database
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
# Encryption is automatic for Azure

Optional Settings

MSSQL_PORT=1433                 # Custom port (default: 1433)
MSSQL_ENCRYPT=true              # Force encryption

Alternative Installation Methods

Using pip

pip install mssql-mcp-server-v2

Then in claude_desktop_config.json:

{
  "mcpServers": {
    "mssql": {
      "command": "python",
      "args": ["-m", "mssql_mcp_server"],
      "env": { ... }
    }
  }
}

Development

git clone https://github.com/SL33PiNg/mssql_mcp_server.git
cd mssql_mcp_server
pip install -e .

Requirements

Requires mcp>=2.0.0, which uses the constructor on_*-handler Server API (no @app.list_resources()-style decorators). If you're pinned to mcp<2 for another server, install this package in an isolated environment (e.g. via uvx --from mssql-mcp-server-v2 mssql_mcp_server, as above) rather than the same venv.

Security

  • Create a dedicated SQL user with minimal permissions
  • Never use admin/sa accounts
  • Use Windows Authentication when possible
  • Enable encryption for sensitive data

Credits

This project is a fork of RichardHan/mssql_mcp_server, originally licensed MIT under copyright Dana K. Williams (see LICENSE). All credit for the original design and implementation goes to them. This fork exists solely to port the server to the mcp 2.x server API and publish it under a distinct package name (mssql-mcp-server-v2) independent of the original, since the original package still targets mcp 1.x.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mssql_mcp_server_v2-0.2.0.tar.gz (70.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mssql_mcp_server_v2-0.2.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file mssql_mcp_server_v2-0.2.0.tar.gz.

File metadata

  • Download URL: mssql_mcp_server_v2-0.2.0.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mssql_mcp_server_v2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a1f019ce7f509ede4457df7e2ec226404f76c177834472bc494f5e3c9744ed69
MD5 b2f78930477e2285068467ddcba8f82e
BLAKE2b-256 22e0b4247250f29105b2e2d3d01e214206962ceeabb42ccfbd5093f5ae73112d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mssql_mcp_server_v2-0.2.0.tar.gz:

Publisher: publish.yml on SL33PiNg/mssql_mcp_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mssql_mcp_server_v2-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mssql_mcp_server_v2-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5d7bbe66419b8a805f30250c520226644fe193c22f05fc5f6ae0cdd4a0c4a28
MD5 a3118dfb0c1e420689abe180f08c9220
BLAKE2b-256 542a8dc4c3975c89bf60879f2649df54f39de9fbafc065fe2017bd22c6a870b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mssql_mcp_server_v2-0.2.0-py3-none-any.whl:

Publisher: publish.yml on SL33PiNg/mssql_mcp_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page