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

Metadata

Release files for mssql-mcp-server-v2 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mssql-mcp-server-v2 0.2.0
File Size Uploaded Provenance Actions
mssql_mcp_server_v2-0.2.0.tar.gz 70.3 kB With provenance Details for mssql_mcp_server_v2-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mssql-mcp-server-v2 0.2.0
File Interpreter ABI Platform Actions
mssql_mcp_server_v2-0.2.0-py3-none-any.whl Python 3 none any Details for mssql_mcp_server_v2-0.2.0-py3-none-any.whl

Total release size: 78.7 kB

Release files / mssql_mcp_server_v2-0.2.0.tar.gz

Download URL mssql_mcp_server_v2-0.2.0.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a1f019ce7f509ede4457df7e2ec226404f76c177834472bc494f5e3c9744ed69
BLAKE2b-256 checksum
How to use checksums
22e0b4247250f29105b2e2d3d01e214206962ceeabb42ccfbd5093f5ae73112d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / mssql_mcp_server_v2-0.2.0-py3-none-any.whl

Download URL mssql_mcp_server_v2-0.2.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5d7bbe66419b8a805f30250c520226644fe193c22f05fc5f6ae0cdd4a0c4a28
BLAKE2b-256 checksum
How to use checksums
542a8dc4c3975c89bf60879f2649df54f39de9fbafc065fe2017bd22c6a870b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Security for mssql-mcp-server-v2 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mssql_mcp_server_v2-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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