Skip to main content
Glama
Chillwind132

mssql-mcp-server

by Chillwind132

mssql-mcp-server

License: MIT Python 3.11 Docker

A Microsoft SQL Server MCP server. Query, inspect, and troubleshoot any SQL Server instance from Cursor, Claude Code, Codex, or any MCP (Model Context Protocol) client. Connects via ODBC using per-caller credentials elicited at runtime. Passwords live only in server memory with an idle TTL and are never logged.

  • Query tools: connect / disconnect / list_sessions session lifecycle, execute_sql with table/JSON/CSV output, and explain_query for estimated or actual Showplan XML execution plans

  • Per-caller identity: the X-DB-User and X-DB-Password headers are both optional; anything missing is elicited once and cached in-memory

  • Permission-scoped access: read vs. write is governed by the SQL login's own permissions; provision_mcp_read.sql provisions a ready-made read-only mcp_read login across all user databases

  • Zero secrets on disk: no credentials in config files, env vars, or logs

Example prompts

  • "Show the execution plan for this query and suggest a better index."

  • "Who is blocking whom on db1 right now?"

  • "List the 10 largest tables in the sales database."

  • "Find all stored procedures that reference the Orders table."

  • "Export the results of this query as CSV."

Related MCP server: mcp-sqlserver

Tools

Tool

Description

connect

Open a session to a SQL Server database and return a session_id

disconnect

Close an active SQL Server session

list_sessions

List active sessions with server, database, and usage details

execute_sql

Run a SQL statement and return rows as table, JSON, or CSV

explain_query

Estimated or actual execution plan as Showplan XML

Quick Start

docker compose -f docker-compose.yml -p mssql-mcp up -d --build --force-recreate

Client setup

Both X-DB-User and X-DB-Password headers are optional: anything missing is prompted for once via MCP elicitation and cached in memory.

Cursor (mcp.json)

{
  "mcpServers": {
    "mssql-mcp": {
      "type": "http",
      "url": "http://localhost:8007/mcp",
      "headers": {
        "X-DB-User": "<your-db-username>",
        "X-DB-Password": "<your-db-password>"
      }
    }
  }
}

Claude Code

claude mcp add --transport http mssql-mcp http://localhost:8007/mcp \
  --header "X-DB-User: <your-db-username>" \
  --header "X-DB-Password: <your-db-password>"

Codex (~/.codex/config.toml)

[mcp_servers.mssql-mcp]
url = "http://localhost:8007/mcp"
http_headers = { "X-DB-User" = "<your-db-username>", "X-DB-Password" = "<your-db-password>" }

Any other MCP client works the same way: point it at the streamable HTTP endpoint and pass the headers.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables connection to Microsoft SQL Server databases, providing tools for schema inspection and querying through standardized interfaces.
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server for Microsoft SQL Server that enables executing read-only queries, listing tables, and describing database schemas. It offers specialized support for custom ports and multiple authentication methods including SQL credentials, NTLM, and Windows Integrated Auth.
    3
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables interaction with Microsoft SQL Server instances using Windows or SQL Server authentication via native ODBC drivers. It allows users to execute SQL queries, list tables, and inspect schemas across multiple configured database environments through natural language.
    746
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Chillwind132/mssql-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server