alyiox avatar

Microsoft SQL Server

alyiox/mcp-mssql

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 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.

Sponsors

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
Category
Databases
Package
Alyio.McpMssql
Transport
STDIO
Auth
Required
Registry
MCP registry, active

More from alyiox

Related Databases MCP servers

View all
1neverinfamous avatardb-mcp (SQLite MCP Server)neverinfamous/db-mcpSQLite MCP server with OAuth 2.1, HTTP/SSE, 122 tools, and smart tool filtering0stars
2invarcore avatarKnowledge Fabricinvarcore/knowledge-fabricMulti-tenant hybrid RAG & evidence verification MCP server enforcing PostgreSQL RLS.8stars
3rahulk644 avatarAppFlowy MCP Serverrahulk644/appflowy-mcp-serverAppFlowy MCP server: edit Markdown, manage typed database rows, search and import/export.8stars
4kiki830621 avatarChe Apple Mail Mcpkiki830621/che-apple-mail-mcpApple Mail MCP — 44 tools, SQLite millisecond search, .emlx parser, batch ops5stars
5smaniches avatarAlphaFold Sovereign MCPsmaniches/alphafold-sovereign-mcpMCP server for AlphaFold and 8 other biomedical data sources with a local SQLite knowledge graph5stars
6bielacki avatarBielacki Igdb Mcp Serverbielacki/igdb-mcp-serverExplore and discover video games from the Internet Game Database. Search titles, view detailed inf…4stars