mssql-mcp-server

mssql-mcp-server

Production-ready, cross-platform Microsoft SQL Server MCP server that lets AI assistants work with SQL Server through the Model Context Protocol.

Category
Visit Server

README

mssql-mcp-server

Production-ready, cross-platform Microsoft SQL Server MCP server — lets AI assistants (Claude Desktop, Cursor, VS Code, Windsurf, Continue, ...) work with SQL Server through the Model Context Protocol.

Security-first: read-only by default, AST-based SQL policy enforcement, dangerous statements blocked, parameterized queries only, secrets never logged.

Features

  • 51 tools across 7 groups (registered according to your security policy):
    • Query: parameterized SELECT with pagination, DML, stored procedures, scalar/table functions, explicit transactions with idle auto-rollback, bulk insert
    • Metadata: databases, schemas, tables, views, procedures, functions, triggers, columns, indexes, foreign keys, constraints, sizes, schema search, object definitions
    • Admin (read-only, opt-in): active/blocking sessions, running queries, deadlocks, backup history, agent jobs, server info, index fragmentation, missing indexes, database health
    • AI helpers (deterministic): schema context for NL→SQL, validate/optimize/ fix SQL, execution plans, cost estimates, FK-path join generation
    • Export: CSV / Excel / JSON / Parquet (path-jailed, formula-injection safe)
    • Import: CSV with preview + type inference, bulk file load
    • Connections: multiple named connections, health checks, database switching
  • 7 resources (mssql://...) and 8 prompts (query writing, tuning, schema walkthroughs, data-quality audits...)
  • Connectivity: SQL auth, Windows auth, Azure AD (password / service principal / managed identity), named instances, custom ports, TLS, connection pooling
  • Cross-platform: Windows (ODBC Driver 18), Ubuntu/Debian/RHEL/Rocky/Alma, macOS (Homebrew), Docker (stdio or streamable-HTTP)

Quick start

# Linux / macOS (installs the ODBC driver + the server)
./scripts/install.sh

# Windows (PowerShell, installs ODBC Driver 18 + the server)
./scripts/install.ps1

# or, with the driver already installed:
pipx install "mssql-mcp-server[dataio]"

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "mssql": {
      "command": "mssql-mcp",
      "env": {
        "MSSQL_SERVER": "localhost",
        "MSSQL_DATABASE": "SampleShop",
        "MSSQL_USERNAME": "app_reader",
        "MSSQL_PASSWORD": "***",
        "READ_ONLY": "true"
      }
    }
  }
}

Claude Code users can install it as a plugin instead:

/plugin marketplace add deepesh112/mcp_tool_sql
/plugin install mssql-mcp@deepesh112-mssql

(uses uvx; connection comes from your MSSQL_* environment variables — see docs/client-configs.md).

Try the bundled dev stack (SQL Server 2022 + sample database + the server over HTTP):

docker compose -f docker/docker-compose.yml up --build

Security model

Mode (SECURITY_MODE) Allows
read_only (default) SELECT, metadata, resources, allowlisted procs
standard + parameterized DML, procedures, transactions, imports
elevated + DDL (CREATE/ALTER/DROP of schema objects)

Dangerous operations (DROP DATABASE, xp_cmdshell, SHUTDOWN, KILL, TRUNCATE, login changes, OPENROWSET, BACKUP/RESTORE, GRANT/DENY/REVOKE, dynamic EXEC(...)) are blocked in every mode unless you set ALLOW_DANGEROUS_OPERATIONS=true and list the category in ALLOWED_DANGEROUS_OPS. Every statement is parsed (sqlglot AST) and scanned by a normalizing regex layer; unparseable statements are rejected (fail closed). Tools your policy forbids are never registered, so clients can't even see them. Details: docs/security.md.

Documentation

Installation Configuration
Windows setup Security guide
Linux setup Troubleshooting
macOS setup
Docker guide Tools reference
Client configs Example prompts

Development

uv venv && uv pip install -e ".[dev]"
pytest                          # unit + security (no DB needed)
pytest -m integration           # needs a live SQL Server (see docker/)
ruff check src tests && black --check src tests && mypy

License

MIT — see LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured