MSSQL MCP Server is a Model Context Protocol (MCP) server that gives LLM agents structured, safe access to Microsoft SQL Server and Azure SQL Database. Built on .NET 9 with the official MCP C# SDK (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/A-Point-Systems-ltd/ms-sql-mcp/llms.txt
Use this file to discover all available pages before exploring further.
ModelContextProtocol 0.1.0-preview.10), it runs as a stdio process that any MCP-compatible client — Cursor, VS Code Copilot, Claude Desktop, and others — can launch and query without writing a single line of database code.
Project origins
MSSQL MCP Server is forked from Azure-Samples/SQL-AI-samples and substantially extended with:- Unified object introspection — a single
ListObjectstool replaces the legacy per-type helpers (ListTables,GetStoredProc, etc.), covering tables, views, stored procedures, functions, triggers, and system objects through one consistent interface. - Strict read/write SQL routing —
SqlStatementClassifierenforces a hard split soSELECTqueries can only travel throughReadDataand mutating statements can only travel throughExecuteSQL(or the dedicated write tools). This keeps destructive operations behind explicitly flagged tools. - AI Insights layer — an optional caching layer that stores LLM-authored (or server-generated baseline) summaries of database objects in the target database itself, reducing repeated schema work and token consumption across long investigations.
Requirements
| Component | Version |
|---|---|
| .NET SDK / Runtime | .NET 9.0 |
| SQL Server | 2008 R2 (10.50) or later |
| Azure SQL Database | Supported |
CONNECTION_STRING and opens a test SQL connection before starting the MCP transport. If either check fails, the process exits with code 1 and writes diagnostics to the log file — so a broken connection string is caught immediately, not mid-conversation.
Capabilities
Schema Inspection
Explore tables, views, stored procedures, functions, triggers, and system objects. Retrieve full column metadata, indexes, constraints, foreign keys, and T-SQL definitions.
Data Reads
Run any read-only
SELECT or WITH … SELECT query against user tables, sys.*, INFORMATION_SCHEMA, and DMVs through the ReadData tool.Write & DDL
Insert, update, delete, create, alter, drop, truncate, and execute stored procedures. Destructive tools are flagged in MCP metadata so agents can confirm intent before acting.
AI Insights Cache
Cache LLM-authored or auto-generated summaries of database objects. Freshness tracking, DDL-change detection, and enrichment directives keep insights current without manual upkeep.
Project layout
MssqlMcp/ directory contains the entire server. InsightsLayer/ holds the AI Insights service, background DDL processing queue, and the embedded SQL scripts that are installed into the target database on demand. Tools/ contains a single partial Tools class split across files — one for each logical group of tools. MssqlMcp.Tests/ is an xUnit project covering SQL routing, name parsing, environment opt-out semantics, and integration smoke tests.
Next steps
Quickstart
Build from source, set your connection string, and connect your first MCP client in under five minutes.
Configuration
All environment variables: connection string, Insights layer toggles, log file path, and Azure SQL Entra ID auth.
Clients
Step-by-step setup for Cursor, VS Code Copilot, and Claude Desktop.
Tools overview
Full reference for all 19 MCP tools — read, write, DDL, and AI Insights.