Skip to content
MCP server

SQL Server MCP

Local MCP for DBAs to query many SQL Server instances, plans and indexes from one entry

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
3.3.0
Listing updated
today

Similar MCP servers

About SQL Server MCP

SQL Server MCP is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

Where most SQL Server MCP servers take a single connection string, this one reads a connections.json that can hold dozens of instances, grouped by client or environment and reloaded without restarting the agent. Every response carries metadata naming the connection that answered, so the answer is traceable to the right client.

Beyond queries it can return table schemas, index layouts, execution plans (SHOWPLAN XML without running the query) and stored procedure source. A per-connection readOnly flag rejects writing statements, queries are capped at 1,000 rows by default (up to 10,000) and cancelled on the server when the cap is hit, with a truncation notice placed before the rows. Passwords can reference environment variables, and a connection with a missing variable is disabled with a clear message.

It supports SQL authentication, NTLM and Entra ID through the tedious driver; fully integrated authentication is not supported. A --check command tests all connections in parallel. Needs Node.js 22 or newer; MIT licensed.

Install

Run in a terminal

claude mcp add mcp-sqlserver --env MSSQL_MCP_CONNECTIONS_JSON='<MSSQL_MCP_CONNECTIONS_JSON>' -- npx -y @cevelas/mcp-sqlserver

Add to claude_desktop_config.json

{
  "mcpServers": {
    "mcp-sqlserver": {
      "command": "npx",
      "args": [
        "-y",
        "@cevelas/mcp-sqlserver"
      ],
      "env": {
        "MSSQL_MCP_CONNECTIONS_JSON": "<MSSQL_MCP_CONNECTIONS_JSON>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-sqlserver": {
      "command": "npx",
      "args": [
        "-y",
        "@cevelas/mcp-sqlserver"
      ],
      "env": {
        "MSSQL_MCP_CONNECTIONS_JSON": "<MSSQL_MCP_CONNECTIONS_JSON>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "mcp-sqlserver": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@cevelas/mcp-sqlserver"
      ],
      "env": {
        "MSSQL_MCP_CONNECTIONS_JSON": "<MSSQL_MCP_CONNECTIONS_JSON>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-sqlserver": {
      "command": "npx",
      "args": [
        "-y",
        "@cevelas/mcp-sqlserver"
      ],
      "env": {
        "MSSQL_MCP_CONNECTIONS_JSON": "<MSSQL_MCP_CONNECTIONS_JSON>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "mcp-sqlserver": {
      "command": "npx",
      "args": [
        "-y",
        "@cevelas/mcp-sqlserver"
      ],
      "env": {
        "MSSQL_MCP_CONNECTIONS_JSON": "<MSSQL_MCP_CONNECTIONS_JSON>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • MSSQL_MCP_CONNECTIONSPath to connections.json. Defaults to ~/.mcp-sqlserver/connections.json; create one with --init.
  • MSSQL_MCP_CONNECTIONS_JSONThe connections JSON inline, for setups that keep credentials out of the filesystem.

Tools this server provides (7)

Taken from the project documentation; the running server may differ.

list_connections
List every connection, grouped
reload_connections
Re-read the connections file and drop open pools
query
Run a query with a row cap
get_schema
Columns, types, nullability and defaults
get_indexes
Indexes with key and included columns
get_execution_plan
SHOWPLAN XML for a query without running it
get_stored_procedure
Source of a stored procedure

What it does

Many connections
One MCP entry covers every configured instance, grouped by client.
Hot reload
Edit the file and call reload_connections without restarting.
Execution plans
Fetch SHOWPLAN XML without running the query.
Read-only rail
Mark connections readOnly to reject writing statements.
Row caps
Large results are cancelled server-side and flagged as truncated.
Connection check
A --check command tests every entry and exits non-zero on failure.

Good for

  • Run a query across a consultant's client databases
  • Audit indexes on a slow table
  • Inspect an execution plan without running it
  • Read a stored procedure's source
  • Check which connections broke after a password rotation

Pricing

Open source

MIT licence

SQL Server MCP FAQ

How do I add instances?

Edit connections.json (create one with --init) and call reload_connections.

Can it modify data?

Not if a connection is marked readOnly, which rejects writing statements.

Which authentication works?

SQL logins, NTLM and Entra ID; fully integrated authentication is not bundled.

What Node version?

Node.js 22 or newer.

Is SQL Server MCP free?

Yes. SQL Server MCP is open source, so you can use and self-host it for free.

How do I add SQL Server MCP to Claude Code?

Run this command in your terminal: claude mcp add mcp-sqlserver --env MSSQL_MCP_CONNECTIONS_JSON='<MSSQL_MCP_CONNECTIONS_JSON>' -- npx -y @cevelas/mcp-sqlserver

What are the best alternatives to SQL Server MCP?

The closest alternatives to SQL Server MCP are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers