Skip to content
alyiox avatar

Microsoft SQL Server

alyiox/mcp-mssql

Read-only T-SQL, schema inspection, and plan analysis for SQL Server, with opt-in writes and multiple connection profiles.

CCM score
84 of 100
GitHub stars
12
tools
5
auth
Secret needed
transport
STDIO
env vars
10
last updated
Oct 26, 2026
View on GitHub

Own this MCP server? Claim it

What it does

  • Reads metadata with list_profiles and get_object, covering columns, indexes, constraints, relationships, and routine definitions
  • Queries data with run_query (SELECT only) and analyze_query, which returns plan cost, operators, warnings, and missing indexes
  • Writes DDL and DML with run_command only when a profile sets AllowWrite; off by default, and not a substitute for database permissions
  • Designed for schema exploration, query tuning, and data analysis across several SQL Server connections from one toolset

Tools

5 tools

Public tool metadata for what this MCP can expose to an agent.

list_profilesList configured connection profiles. Call first when picking a non-default profile. Returns `name`, `description` and `allow_write` per profile.

List configured connection profiles. Call first when picking a non-default profile. Returns `name`, `description` and `allow_write` per profile.

No parameter schema in public metadata yet.

get_objectGet metadata for one relation (columns, indexes, constraints, relationships) or routine (definition).

Get metadata for one relation (columns, indexes, constraints, relationships) or routine (definition).

No parameter schema in public metadata yet.

run_queryExecute read-only T-SQL SELECT; only SELECT allowed (no DML/DDL).

Execute read-only T-SQL SELECT; only SELECT allowed (no DML/DDL).

No parameter schema in public metadata yet.

analyze_queryAnalyze execution plan for a read-only SELECT. Returns compact JSON summary (cost, operators, cardinality, warnings, `missing_indexes`, waits, stats).

Analyze execution plan for a read-only SELECT. Returns compact JSON summary (cost, operators, cardinality, warnings, `missing_indexes`, waits, stats).

No parameter schema in public metadata yet.

run_commandExecute write T-SQL (DDL/DML). Advertised only when some profile sets `AllowWrite=true` (off by default).

Execute write T-SQL (DDL/DML). Advertised only when some profile sets `AllowWrite=true` (off by default).

No parameter schema in public metadata yet.

Configuration

MCPMSSQL_CONNECTION_STRINGsecret

Default profile SQL Server connection string (often contains secrets). Optional if profiles are only in user appsettings.

MCPMSSQL_DESCRIPTION

Optional human-readable description for the default profile.

MCPMSSQL_QUERY_MAX_ROWS

Max rows per interactive query (default 500; ceiling 1000).

MCPMSSQL_QUERY_COMMAND_TIMEOUT_SECONDS

Interactive query command timeout in seconds (default 30).

MCPMSSQL_QUERY_SNAPSHOT_MAX_ROWS

Max rows for snapshot queries (default 10000; ceiling 50000).

MCPMSSQL_QUERY_SNAPSHOT_COMMAND_TIMEOUT_SECONDS

Snapshot query timeout in seconds (default 120).

MCPMSSQL_ANALYZE_COMMAND_TIMEOUT_SECONDS

Execution plan analysis timeout in seconds (default 300; ceiling 600).

MCPMSSQL_ALLOW_WRITE

Enable write commands (DDL/DML) via run_command on the default profile (default false). With no write-enabled profile the tool is not advertised at all. Soft guard only — prefer a db_datareader login for a hard read-only guarantee.

MCPMSSQL_WRITE_COMMAND_TIMEOUT_SECONDS

Write command timeout in seconds (default 60; ceiling 600).

DOTNET_ENVIRONMENT

Set to Development to load dotnet user-secrets (local dev).

Readme

MCP SQL Server

Build Status NuGet Version License: MIT

A read-only-by-default Model Context Protocol (MCP) server for Microsoft SQL Server that provides schema discovery, select-only queries, execution-plan analysis, opt-in writes, and profile-based access to multiple servers from a single toolset deployment.

Requirements: .NET 10.0 or later runtime, SQL Server, and a connection string.

Quick start

Set MCPMSSQL_CONNECTION_STRING and run the server in one of these ways:


View the full README on GitHub

Details

Repository
github.com/alyiox/mcp-mssql
Website
github.com/alyiox/mcp-mssql
Categories
Databases, Data & Analytics
Package
Alyio.McpMssql
Transport
STDIO
Auth
Required
Registry
MCP registry, active

Questions

What can an agent do with the Microsoft SQL Server MCP server?

It lets an agent discover SQL Server schema, run read-only T-SQL SELECT queries, and analyze execution plans for SELECT statements. Writes are opt-in and off by default, so the server is read-only unless you enable them.

Which tools does the Microsoft SQL Server MCP server provide?

It lists five tools: list_profiles, get_object, run_query, analyze_query and run_command. The run_command tool is only advertised when a connection profile sets AllowWrite to true.

Where does the alyiox mcp-mssql server rank in the Databases category?

On Claude Marketplaces it ranks in the top 50 of the Databases category, alongside Dbx, MCP Toolbox for Databases, DBHub, Postgres MCP Pro and Supabase. It stands out for its profile-based access to multiple SQL Server connections from one toolset.

What do I need to run the Microsoft SQL Server MCP server?

You need the .NET 10.0 or later runtime, a SQL Server instance and a connection string. Set MCPMSSQL_CONNECTION_STRING, or define profiles in a user-scoped appsettings.json file, and the server runs over stdio.

How do I connect the server to multiple SQL Server databases?

Define several named profiles in the user-scoped appsettings.json file, each with its own ConnectionString and caps. Agents then pick a profile per tool call, and list_profiles reports which ones are configured.

More from alyiox

All 3

Similar to Microsoft SQL Server

More Databases