MCP server for DBAs running dozens of SQL Server instances: grouped connections, plans, indexes
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
One-click editor setup isnβt available for this listing yet β we donβt have a confirmed install command, and weβd rather show nothing than point your editor at the wrong package or host. Follow the projectβs own setup instructions, linked above.
One MCP entry, every SQL Server you administer. Connections live in a single
connections.json, grouped by client or environment, hot-reloaded without
restarting your AI agent β plus execution plans, index audits and
stored-procedure analysis.
Built for DBAs and consultants, not for a demo against a single localhost database.
Add this to your AI agent's MCP configuration:
Then create your connections file and restart the agent:
That writes ~/.mcp-sqlserver/connections.json from a commented template. Edit
it, and ask your agent to "list all SQL Server connections".
| Agent | Config file |
|---|---|
| Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json |
| Claude Desktop (macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Claude Code | claude mcp add sqlserver -- npx -y @cevelas/mcp-sqlserver |
| VS Code / Copilot | .vscode/mcp.json |
| Cursor | ~/.cursor/mcp.json |
Any MCP-compatible agent works β ChatGPT, Gemini, Copilot, Cline, Zed and
others all take the same command / args pair.
Most SQL Server MCP servers take a single connection string. That is fine for one database. It falls apart when you administer thirty across eight clients, because every instance needs its own entry in the agent config, its own credentials, and its own restart when something changes.
| Single-DSN servers | This one | |
|---|---|---|
| Instances per MCP entry | 1 | all of them |
| Organised by client or environment | β | connectionGroup |
| Add or change a connection | edit agent config, restart | edit a file, reload_connections |
| Which server answered? | you assume | in every response's metadata |
Beyond SELECT | β | execution plans, index layout, SP source |
| Read-only safety rail | β | "readOnly": true per connection |
| Field | Required | Notes |
|---|---|---|
name | yes | Unique; this is what you say to the agent |
server | yes | Hostname, IP, or host\instance |
connectionGroup | no | Client, project or environment. Groups the listing |
description | no | Shown in list_connections and in every response |
database | no | Defaults to the login's default database |
user, password | no | Omit for domain or Entra ID auth |
port | no | Defaults to 1433 |
encrypt, trustServerCertificate | no | encrypt defaults to true |
readOnly | no | Rejects writing statements β see below |
Anything else you put here is passed straight to mssql,
so requestTimeout, connectionTimeout, pool, authentication and a nested
options object all work.
Any string may reference an environment variable:
A connection that references a variable you have not set is disabled, and
list_connections names both the connection and the missing variable. Leaving
the literal in place would only move the failure to connect time, where it
arrives as Login failed for user and tells you nothing.
You can also skip the file entirely and pass the whole thing through the agent config, which keeps credentials in one place with the rest of your MCP secrets:
In order, first hit wins:
--connections <path>$MSSQL_MCP_CONNECTIONS β a path$MSSQL_MCP_CONNECTIONS_JSON β the JSON itself, inline./connections.json in the working directory~/.mcp-sqlserver/connections.jsonconnections.json next to the installed packageA path given explicitly via 1 or 2 that does not exist is an error β the server will not quietly fall back to a different file and talk to the wrong database.
Connects to every entry in parallel, runs SELECT 1, and lists which ones
fail and why. Exits non-zero if any did, so it works in a scheduled task.
Useful after a password rotation, or before blaming the agent.
The bundled tedious driver supports NTLM and the Entra ID (Azure AD) family.
Add domain for NTLM:
Fully integrated auth β a trusted connection with no password at all β needs
the native msnodesqlv8 driver, which is not bundled because it would break
the one-line install on machines without a build toolchain. NTLM with an
explicit service account is the supported path.
| Tool | Arguments | What it does |
|---|---|---|
list_connections | β | Every connection, grouped |
reload_connections | β | Re-read the file, drop open pools |
query | connection, sql, maxRows?, format? | Run a query |
get_schema | connection, table? | Columns, types, nullability, defaults |
get_indexes | connection, table | Indexes, types, key and included columns |
get_execution_plan | connection, sql | SHOWPLAN_XML β the plan, without running the query |
get_stored_procedure | connection, name | Source of a stored procedure |
Every response carries the connection it came from:
With thirty connections in play, that line is what tells you the answer came from the client you meant.
An agent that runs SELECT * FROM Orders does not need four million rows, and
neither does its context window.
query returns at most 1000 rows across all result sets.
maxRows changes that, up to 10000. When the cap is hit the query is
cancelled on the server, not trimmed afterwards."truncated": true and a note stating that more rows exist, that the total
is unknown, and how to get it. It sits before the rows on purpose: a
10000-row response runs to hundreds of KB, and a client that cuts long output
keeps the beginning. An agent must never conclude "the table has 10000 rows"
from a capped result. Asking for more than 10000 is not an error β the cap is
lowered to 10000, and if rows were left out the note says what was asked for.format: "csv". JSON repeats every column name on every row. With
csv the response is one JSON header line with the metadata, a blank line,
then the rows. NULL is an empty cell and an empty string is "", so the
two stay distinguishable.PRINT output and SET STATISTICS IO, TIME ON results
come back in messages, so the agent can read logical reads and CPU time
instead of guessing.SELECTs returns them all in
recordsets. data is still the first one.0x8f3a...), truncated after 64 bytes,
instead of a JSON array with one number per byte.rowCount is always present; truncated, messages and recordsets only
appear when they have something to say. Responses are compact JSON.
Things that are tedious by hand and become one sentence to the agent:
get_stored_procedure for the
source, get_execution_plan for the plan, get_indexes for what is missing.get_schema on
both, agent diffs them.get_indexes
plus the queries you care about.reload_connections, no restart.No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/sql-server-mcp)<a href="https://allmcps.com/mcp/sql-server-mcp"><img src="https://allmcps.com/api/badge/sql-server-mcp?style=directory" alt="SQL Server MCP on AllMCPs" /></a>