SqlServerMcp

io.github.Nithish1206Published by GitHub account Nithish1206v1.0.6Updated Oct 30, 2026

MCP server for SQL Server: schema inspection, safe read-only queries, query plan analysis

VerifiedSTDIODesktop onlyDatabasesData & Analytics

Overview

AI-generated overview

Local MCP server for SQL Server that lets an assistant inspect schemas, run read-only SELECT queries and explain query plans.

What you can do
  • List configured databases and their user tables
  • Describe table columns and return full schema details including primary and foreign keys
  • Search tables and columns by keyword
  • Run read-only SELECT queries with automatic row limiting
  • Explain a SELECT query using its estimated execution plan
When to use it
Useful when you want an assistant to explore a SQL Server database and answer data questions by writing its own SQL, without giving it write access. Suits analysts and developers who already have connection strings and want schema-aware querying from a desktop MCP client.
Requirements
Runs as a local .NET tool installed via the dotnet tool command, over stdio, on desktop clients only. Needs SQL Server connection strings supplied through environment variables named ConnectionStrings (one per database), plus optional QueryDefaultTop and Query__MaxTop row limits. Network access to the SQL Server instance is required.
Before you install
Connection strings, which may contain credentials, are passed as environment variables in the client config; the README says they stay server-side and are not exposed to the AI client. The server executes SQL generated by the model, so query accuracy depends on the model, and results are capped by the configured row limits. Only SELECT is allowed and writes are blocked, but queries still read real production data.

Installation

In SourceWeft

  1. Open SqlServerMcp in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

SqlServerMcp

[Sqlservermcp MCP server]

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

bash
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):

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

VariableDescription
ConnectionStrings__<name>SQL Server connection string. Add multiple with different names.
Query__DefaultTopDefault row limit for queries (default: 1000)
Query__MaxTopMaximum 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:

json
{  "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

ToolDescription
ListDatabasesList available database names configured in this server
ListTablesList all user tables in a database
DescribeTableDescribe columns of a specific table (schema.table format)
GetDatabaseSchemaReturn full database schema: tables, columns, PKs, FKs
SearchSchemaSearch tables and columns by keyword
RunQueryExecute a safe read-only SELECT query with auto row-limiting
ExplainQueryExplain a SELECT query using estimated execution plan

Example

Prompt:

"Using the MyDb database, 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:

sql
SELECT TOP 5 c.CustomerId, c.Name, SUM(o.TotalAmount) AS TotalSpentFROM dbo.Customers cJOIN dbo.Orders o ON o.CustomerId = c.CustomerIdWHERE YEAR(o.OrderDate) = 2025GROUP BY c.CustomerId, c.NameORDER BY TotalSpent DESC;

Expected output:

CustomerIdNameTotalSpent
1042Acme Corp184500.00
778Globex Ltd162300.50
2310Initech149875.25
915Soylent Inc138420.00
604Umbrella Co121990.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 SELECT queries 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

Source: README.md at commit f11f121

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v1.0.6LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts