
Microsoft SQL Server
Connects Claude to Microsoft SQL Server databases in strict read-only mode. You get five tools: list_profiles for managing multiple connections, get_server_properties for limits and metadata, list_objects and get_object for exploring catalogs/schemas/tables/views/procedures, and run_query for executing parameterized SELECTs. The analyze_query tool returns execution plan summaries with cost estimates, operator details, and performance warnings without running the full query. Configuration works through environment variables for single connections or appsettings.json for multiple profiles. Supports Azure SQL with Microsoft Entra authentication modes. Results can be returned inline (500 row limit) or as snapshot resources (10,000 rows). Built as a .NET global tool with hard enforcement against DML and DDL operations.
- GitHub stars
- 9
- tools
- 5
- auth
- Secret needed
- transport
- STDIO
- env vars
- 10
- last updated
- Oct 26, 2026
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.
Sponsors
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
- Category
- Databases
- Package
Alyio.McpMssql- Transport
- STDIO
- Auth
- Required
- Registry
- MCP registry, active