Skip to main content
MCP server CX Codex

Microsoft SQL Server — MCP server for Claude Code: schema, queries

Lets your agent read a SQL Server schema, run SELECT-only queries and inspect execution plans. Writes stay off until you turn them on per profile.

Open on GitHub

What Microsoft SQL Server does

The server starts read-only. An agent can pull metadata, run a parameterized query and look at how the plan executes. Writing is a separate switch, set through AllowWrite on a given profile.

A profile holds one connection: the connection string, row and timeout caps, and whether writes are permitted. default always exists; other profiles come from appsettings.json or variables shaped like McpMssql__Profiles__<NAME>__<FIELD>. One deployment can reach several servers.

You need .NET 8.0 or later and a connection string. Without one the server will not boot — a profile missing ConnectionString, even an unconfigured default, fails at startup. Caps are enforced: Query:MaxRows cannot go past 1000 and Query:CommandTimeoutSeconds past 300, so an oversized value gets clamped and logged to stderr. Treat AllowWrite as a soft guard rather than a database permission; a db_datareader login is what actually blocks writes.

What it helps with

  • inspect tables and relationships without opening SSMS
  • run a parameterized SELECT safely
  • find out why a slow query drags
  • reach several MSSQL servers from one agent setup
  • allow writes for a migrations profile only

Example prompts for the agent

  • List the tables in the dbo schema with their columns
  • Run this against the warehouse profile: monthly revenue for last year
  • Explain the execution plan and tell me where it slows down

How to install Microsoft SQL Server

Install

The MCP registry has no launch command for it: see the repository README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Microsoft SQL Server

How do I install the Microsoft SQL Server MCP server?

Install it as a global tool with dotnet tool install --global Alyio.McpMssql --prerelease. Then set MCPMSSQL_CONNECTION_STRING and start mcp-mssql.

What does this MCP server do?

It exposes schema discovery, parameterized SELECT queries and execution-plan analysis to your agent. Writes stay disabled until a profile enables them.

Can it connect to more than one SQL Server?

Yes. Define profiles in appsettings.json or via McpMssql__Profiles__<NAME>__<FIELD> variables, and pass the optional profile argument on a tool call.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor