SqlServerMcp MCP Server
MCP server for SQL Server: schema inspection, safe read-only queries, query plan analysis
SqlServerMcp scores 66 (Good), licensed MIT and written in C#. It installs as a local process. It declares 7 tools. Filed under Databases. GitHub shows 0 stars. Install configs are generated for 12 clients. Being listed in the registry is not the same as being vendor-official.
Good trust
66 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Where the 66 comes from
22 + 20 + 0 + 10 + 4 + 10 = 66. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 20 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 0 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 10 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "nithish1206-sqlservermcp-nuget": { "command": "dnx", "args": [ "SqlServerMcp" ], "env": { "ConnectionStrings__MyDb": "", "Query__DefaultTop": "", "Query__MaxTop": "" } } }}
Environment variables
| Name | Required | Notes |
|---|---|---|
ConnectionStrings__MyDb | Optional | — |
Query__DefaultTop | Optional | — |
Query__MaxTop | Optional | — |
Tools7Tool docs quality grade C
All capabilitiesDescribeTabletoolDescribe columns of a specific table (schema.table format)
ExplainQuerytoolExplain a SELECT query using estimated execution plan
Return full database schema: tables, columns, PKs, FKs
ListDatabasestoolList available database names configured in this server
ListTablestoolList all user tables in a database
RunQuerytoolExecute a safe read-only SELECT query with auto row-limiting
SearchSchematoolSearch tables and columns by keyword
About
SqlServerMcp
A Model Context Protocol (MCP) server for SQL Server. Exposes schema inspection, safe read-only queries, and query plan analysis as MCP tools.
How it works: This server does not accept natural-language questions. Instead, the connected AI tool (the MCP client) decides and generates the SQL query based on the user's intent and the schema it inspects via the tools below. The server only executes the SQL the AI produces, under the safety rules described in Safety.
Install
dotnet tool install -g SqlServerMcp
Configure
Configuration is done entirely through environment variables in your MCP client config. No need to edit any files — just add your connection strings and query settings directly in the env block.
Add the following to your MCP client configuration (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"sqlserver": {
"command": "sqlservermcp",
"env": {
"ConnectionStrings__MyDb": "Server=localhost;Database=MyDatabase;Trusted_Connection=True;TrustServerCertificate=True;",
"Query__DefaultTop": "1000",
"Query__MaxTop": "500000"
}
}
}
}
Environment Variable Format
| Variable | Description |
|---|---|
ConnectionStrings__<name> | SQL Server connection string. Add multiple with different names. |
Query__DefaultTop | Default row limit for queries (default: 1000) |
Query__MaxTop | Maximum allowed row limit (default: 500000) |
Note: Use double underscores (
__) as the separator — this is the .NET configuration convention for environment variables.
Multiple Databases
You can configure multiple databases by adding multiple connection string variables:
{
"env": {
"ConnectionStrings__Production": "Server=prod-server;Database=ProdDb;...",
"ConnectionStrings__Staging": "Server=staging-server;Database=StagingDb;..."
}
}
Then use the ListDatabases tool to see available names, and pass the database name to any query tool.
Available Tools
| Tool | Description |
|---|---|
ListDatabases | List available database names configured in this server |
ListTables | List all user tables in a database |
DescribeTable | Describe columns of a specific table (schema.table format) |
GetDatabaseSchema | Return full database schema: tables, columns, PKs, FKs |
SearchSchema | Search tables and columns by keyword |
RunQuery | Execute a safe read-only SELECT query with auto row-limiting |
ExplainQuery | Explain a SELECT query using estimated execution plan |
Example
Prompt:
"Using the
MyDbdatabase, show me the top 5 customers by total order amount in 2025."
The AI generates and executes the query by calling SearchSchema / DescribeTable to discover the tables, then passing this SQL to RunQuery:
SELECT TOP 5 c.CustomerId, c.Name, SUM(o.TotalAmount) AS TotalSpent
FROM dbo.Customers c
JOIN dbo.Orders o ON o.CustomerId = c.CustomerId
WHERE YEAR(o.OrderDate) = 2025
GROUP BY c.CustomerId, c.Name
ORDER BY TotalSpent DESC;
Expected output:
| CustomerId | Name | TotalSpent |
|---|---|---|
| 1042 | Acme Corp | 184500.00 |
| 778 | Globex Ltd | 162300.50 |
| 2310 | Initech | 149875.25 |
| 915 | Soylent Inc | 138420.00 |
| 604 | Umbrella Co | 121990.75 |
Disclaimer: The accuracy of the generated SQL and the final output depends on the AI model you select in your MCP client. More capable models produce more reliable queries; weaker models may misinterpret the schema or the intent of the prompt.
Safety
- Only
SELECTqueries are allowed — all write operations are blocked - Queries are automatically row-limited to prevent runaway results
- Connection strings are configured server-side, never exposed to the AI client
License
MIT
Frequently asked questions
What is SqlServerMcp MCP Server?
MCP server for SQL Server: schema inspection, safe read-only queries, query plan analysis
How do I install SqlServerMcp MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. SqlServerMcp MCP Server runs locally from the NuGet package SqlServerMcp with the command dnx SqlServerMcp.
Is SqlServerMcp MCP Server free and open source?
Yes. SqlServerMcp MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does SqlServerMcp MCP Server support remote (HTTP) connections?
No remote endpoint is listed for SqlServerMcp MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does SqlServerMcp MCP Server provide?
SqlServerMcp MCP Server provides 7 tools, including DescribeTable, ExplainQuery, GetDatabaseSchema, and ListDatabases. See the full tool list for descriptions and parameters.
How is SqlServerMcp MCP Server's trust score calculated?
SqlServerMcp MCP Server scores 66 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.