Microsoft SQL Server MCP
@adriancy/mcp-mssql
用于 Microsoft SQL Server 的 MCP 服务器 (stdio)。它公开了相关工具,以便 Cursor(或任何 MCP 客户端)可以列出表、描述列并运行以读取为主的 T-SQL。
在 Cursor 中使用
打开 Cursor Settings → MCP(或编辑您的 MCP JSON)。
添加一个服务器块。将
env设置为您的数据库配置(请参阅.env.example)。
从 npm 安装(包发布后):
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["-y", "@adriancy/mcp-mssql"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_USER": "your_user",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}从本地克隆安装(先运行 pnpm install && pnpm build):
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/absolute/path/to/mssql-mcp/dist/index.js"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_USER": "your_user",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}本地文件请使用 node。避免将 pnpm 用作 MCP command — stdout 上的额外输出可能会破坏协议。
确认安装名称与 npm 一致:npm view @adriancy/mcp-mssql version。
Related MCP server: MSSQL Database MCP Server
环境变量
所有变量均从 MCP 进程环境(例如 Cursor env)中读取。布尔值将 1、true、yes、on(不区分大小写)视为 true,将 0、false、no、off 视为 false。无效的布尔值和整数值会导致启动验证失败。
变量 | 必需 | 默认值 | 含义 |
| 是 | — | SQL Server 的主机名或 IP |
| 是† | — | 登录用户(SQL 身份验证、NTLM、Azure AD 密码);不用于 |
| 是*† | — | 登录密码(*某些设置下可为空) |
| 是 | — | 初始数据库 |
| 否 |
| TCP 端口;使用 |
| 否 |
| TLS |
| 否 |
| 信任自签名证书 / 跳过证书验证(仅限开发环境) |
| 否 | — | 当 TLS 验证的主机名与 |
| 否 | — | CA PEM 文件路径;通过 |
| 否 | — | 可选的客户端证书 PEM(双向 TLS) |
| 否 | — | 可选的客户端私钥 PEM |
| 否 | — | 加密客户端密钥的密码短语 |
| 否 | (驱动默认) | 连接池 |
| 否 | — | 域登录(SQL 身份验证的 |
| 否 | — | 命名实例 ( |
| 否 |
| 可用性组风格的故障转移提示 |
| 否 |
| AG 从节点的只读路由 |
| 否 | — | Tedious |
| 否 | — | Tedious |
| 否 |
| 连接池最大连接数 |
| 否 |
| 连接池最小连接数 |
| 否 |
|
|
| 否 | — |
|
| 否 |
| 设置时的 |
| 否 | — |
|
| 否 | — |
|
| 否‡ | — | 需要时的 Azure AD 应用 (客户端) ID |
| 否‡ | — | 租户 ID(密码验证可选,默认为 |
| 否‡ | — | 服务主体密钥 |
| 否‡ | — | 用于访问令牌验证的预获取令牌 |
| 否 |
| 如果为 false/未设置,则在 |
| 否 | (驱动默认) | 驱动程序的请求超时(毫秒)。 |
† SQL 身份验证以及使用交互式用户登录的身份验证类型必需。
‡ 根据 MSSQL_AUTH_TYPE 必需;请参阅 .env.example。Node 17+ 上的 NTLM 可能需要 --openssl-legacy-provider(请参阅 tedious 常见问题解答)。
另请参阅 .env.example。
工具
工具 | 用途 |
| 运行 T-SQL;返回行和 |
|
|
| 列元数据 |
当 MSSQL_ALLOW_WRITES 未设置/为 false 时,明显的写/DDL 模式会被阻止(仅启发式;请使用数据库权限以实现真正的安全)。
开发
pnpm install
pnpm check
pnpm test
pnpm build && pnpm start
pnpm dev使用 pnpm format 应用 Biome 格式化修复,使用 pnpm lint 运行 lint 规则而不进行格式化。
日常使用请使用只读或最小权限的 SQL 登录账号。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases through query execution, schema discovery, CRUD operations, stored procedures, and data export with built-in safety controls.18Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with Microsoft SQL Server databases to query data, inspect schemas, and retrieve metadata with read-only operations by default and optional write capabilities.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Microsoft SQL Server databases using both SQL Server and Windows Authentication. It supports flexible connection configurations, including read-only modes and encrypted communication for secure data management.3,338MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases via introspection and query tools. Supports single or multiple databases with read-only mode by default and an optional write capability.4084MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AdrianCY/mssql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server