MSSQL MCP 服务器
用于连接 Microsoft SQL Server 数据库的模型上下文协议 (MCP) 服务器。此服务器提供用于执行 SQL 查询和管理数据库连接的工具。
**版本公告:**本项目已升级至使用 Model Context Protocol SDK 1.9.0。详情请参阅UPGRADE.md 。
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 MSSQL MCP 服务器:
手动安装
用法
将服务器添加到您的 MCP 设置配置文件:
工具
询问
在 MSSQL 数据库上执行 SQL 查询。
参数
connectionString
(字符串,可选):完整的连接字符串(可替代单独的参数)host
(字符串,可选):数据库服务器主机名port
(数字,可选):数据库服务器端口(默认值:1433)database
(字符串,可选):数据库名称(默认值:master)username
(字符串,可选):数据库用户名password
(字符串,可选):数据库密码query
(字符串,必需):要执行的 SQL 查询encrypt
(布尔值,可选):启用加密(默认值:false)trustServerCertificate
(布尔值,可选):信任服务器证书(默认值:true)
必须提供connectionString
或( host
+ username
+ password
)。
例子
运行服务器
本地开发
使用 Docker
测试
安全
该服务器包括针对危险 SQL 操作的安全措施:
- 阻止潜在的有害命令,如 DROP、TRUNCATE、ALTER、CREATE、EXEC 等。
- 验证所有输入参数和数据库名称
- 设置查询长度和超时的合理限制
- 使用连接池来获得更好的性能和安全性
执照
麻省理工学院
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
通过模型上下文协议实现 SQL 查询的执行以及 Microsoft SQL Server 数据库连接的管理。
Related Resources
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that enables secure and structured interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries with controlled access.Last updated -20PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables SQL query execution, database management, and business intelligence capabilities through MySQL connections.Last updated -JavaScript
- AsecurityAlicenseAqualityA Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.Last updated -1108PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.Last updated -3TypeScriptMIT License