Skip to main content

A Model Context Protocol (MCP) server that enables secure interaction with Microsoft SQL Server databases.

Project description

Microsoft SQL Server MCP Server

PyPI License: MIT

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

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": ["yulin-mssql-mcp"],
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_DATABASE": "your_database",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password"
      }
    }
  }
}

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
MCP_DEBUG=1                     # Enable debug logging to stderr

Alternative Installation Methods

Using pip

pip install yulin-mssql-mcp

Then in claude_desktop_config.json:

{
  "mcpServers": {
    "mssql": {
      "command": "yulin-mssql-mcp",
      "args": [],
      "env": { ... }
    }
  }
}

Development

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

Debugging

Enable debug mode to see detailed logs in stderr:

# Set environment variable
MCP_DEBUG=1

# Or in Claude Desktop config
"env": {
  "MCP_DEBUG": "1",
  ...
}

Debug logs include:

  • Database connection details (without passwords)
  • SQL query execution traces
  • MCP protocol message flow

Security

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

License

MIT

Project details


Download files

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

Source Distribution

yulin_mssql_mcp-0.1.2.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

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

yulin_mssql_mcp-0.1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file yulin_mssql_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: yulin_mssql_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for yulin_mssql_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 10b01ea3341f57edad461e1ab62f8b62c2d5653c95c393f5ca55fd2d77c196eb
MD5 b61ac60b6141958bc76d109223fc162c
BLAKE2b-256 ec14b2bc24bbfc9ac8ff997bab96695cb71cbf358eaac400017171e1669e6b4f

See more details on using hashes here.

File details

Details for the file yulin_mssql_mcp-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yulin_mssql_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 763361dc28b08c6f21981da4e07f4f128bb2a30765d5030ce718fde360792f16
MD5 09c358e24ee0d42091d2f88cf07fef33
BLAKE2b-256 48fae541eede6474d3a4e68f32995d556cb04cf5be66da2596bd23c14c8f587b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page