
SqlServerMcp
io.github.Nithish1206由 GitHub 账号 Nithish1206 发布v1.0.6更新于 Oct 30, 2026
MCP server for SQL Server: schema inspection, safe read-only queries, query plan analysis
概览
面向 SQL Server 的本地 MCP 服务器,让助手查看架构、执行只读 SELECT 查询并分析查询计划。
- 可以做什么
- 列出已配置的数据库及其用户表
- 描述表字段,并返回包含主键与外键的完整架构
- 按关键词搜索表和字段
- 执行带自动行数限制的只读 SELECT 查询
- 用预估执行计划解释 SELECT 查询
- 适用场景
- 适合希望让助手自行编写 SQL 来探索 SQL Server 数据库并回答数据问题的场景,同时不授予写入权限。适用于已有连接字符串、想在桌面 MCP 客户端中进行架构感知查询的分析人员和开发者。
- 运行要求
- 以本地 .NET 工具形式通过 dotnet tool 命令安装,使用 stdio 传输,仅支持桌面客户端。需要通过名为 ConnectionStrings 的环境变量提供 SQL Server 连接字符串(每个数据库一个),并可选用 QueryDefaultTop 与 Query__MaxTop 设置行数上限。需要能访问 SQL Server 实例的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 SqlServerMcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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
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):
Environment Variable Format
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:
Then use the ListDatabases tool to see available names, and pass the database name to any query tool.
Available Tools
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:
Expected output:
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
来源:README.md,提交 f11f121
工具
0版本历史
1- v1.0.6最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分