Listed from the MCP registry; nobody on Odel publishes it.

MCP server: One MCP server.

SqlServerMcp

@nithish1206MCP server · External

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

Databasesv1.0.6MITC#
Freeno charge per call

Runs on your machine from its package; the steps are below.

What it does

  1. Reads
  2. Writes
  3. High impact

At most: only reads or looks up information.

What it costs

Free

Odel charges nothing per call. The publisher may charge for its own service.

Runs locally over stdio

This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).

NuGetSqlServerMcpv1.0.6

Published to NuGet as `SqlServerMcp` — run it with your .NET MCP host.

README2 min read

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

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

Similar modules

Browse Databases