Microsoft SQL Server
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
Own this MCP server? Claim it
What it does
- Reads metadata with
list_profilesandget_object, covering columns, indexes, constraints, relationships, and routine definitions - Queries data with
run_query(SELECT only) andanalyze_query, which returns plan cost, operators, warnings, and missing indexes - Writes DDL and DML with
run_commandonly when a profile setsAllowWrite; 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 toolsPublic 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_STRINGsecretDefault profile SQL Server connection string (often contains secrets). Optional if profiles are only in user appsettings.
MCPMSSQL_DESCRIPTIONOptional human-readable description for the default profile.
MCPMSSQL_QUERY_MAX_ROWSMax rows per interactive query (default 500; ceiling 1000).
MCPMSSQL_QUERY_COMMAND_TIMEOUT_SECONDSInteractive query command timeout in seconds (default 30).
MCPMSSQL_QUERY_SNAPSHOT_MAX_ROWSMax rows for snapshot queries (default 10000; ceiling 50000).
MCPMSSQL_QUERY_SNAPSHOT_COMMAND_TIMEOUT_SECONDSSnapshot query timeout in seconds (default 120).
MCPMSSQL_ANALYZE_COMMAND_TIMEOUT_SECONDSExecution plan analysis timeout in seconds (default 300; ceiling 600).
MCPMSSQL_ALLOW_WRITEEnable 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_SECONDSWrite command timeout in seconds (default 60; ceiling 600).
DOTNET_ENVIRONMENTSet to Development to load dotnet user-secrets (local dev).
Readme
MCP SQL Server
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:
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 3Similar to Microsoft SQL Server
More DatabasesPostgres MCP ProMCP servercrystaldba3.5K starsConnects to PostgreSQL databases for schema browsing, SQL execution, query tuning, and health checks.
Microsoft SQL ServerMCP serverrichardhan406 starsRead-only SQL queries and optional writes against Microsoft SQL Server, LocalDB, and Azure SQL databases.
DBHubMCP serverbytebase4K starsGateway to seven SQL databases: run queries, explore schemas, and check query plans.
mssqlSkillsanjay3290/ai-skills565 installsRead-only SQL Server querying across multiple configured databases, with description-based database selection and write blocking.
MySQLMCP serverdesigncomputer1.4K starsConnects to MySQL databases for SQL queries, schema inspection, and table sampling.