SQL Server MCP
mcp-node-mssql
用法
光标
请参阅官方 Cursor 文档以了解更多信息。
打开(或创建)
mcp.json文件(它应该位于~/.cursor/mcp.json或<project-root>/.cursor/mcp.json中,但有关更多详细信息,请参阅 Cursor 文档)。添加以下详细信息并保存文件:
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}风帆冲浪
请参阅官方 Windsurf 文档以了解更多信息。
打开
Windsurf MCP Configuration Panel单击
Add custom server。添加以下详细信息并保存文件:
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}克劳德·科德
请参阅官方 Claude Code 文档以了解更多信息。
您可以从 Claude Code CLI 添加新的 MCP 服务器。但直接修改 json 文件更简单!
打开 Claude Code 配置文件(它应该在
~/.claude.json中)。找到
projects>mcpServers部分并添加以下详细信息并保存文件:
{
"projects": {
"mcpServers": {
"mssql": {
"command": "npx",
"args": [
"-y",
"mcp-node-mssql"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}
}Related MCP server: Microsoft SQL Server MCP Server
问题和故障排除
在执行任何其他操作之前,请确保您正在运行最新版本!
如果您在使用此 MCP 服务器时遇到问题,请在GitHub上打开一个问题!
发展
安装
npm install建造
npm run build本地运行开发服务器
要测试 MCP 服务器的本地开发版本(而不是使用已发布的包),请按照以下步骤操作:
构建项目:
npm run build创建或修改您的
mcp.json文件以引用您的本地构建:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": [
"/path/to/your/local/mcp-node-mssql/dist/index.js"
],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "1433",
"DB_USERNAME": "<username>",
"DB_PASSWORD": "<password>",
"DB_DATABASE": "<database>"
}
}
}
}将此
mcp.json文件放置在以下位置之一:对于 Cursor:在您的主目录(
~/.cursor/mcp.json)或项目目录(.cursor/mcp.json)中对于 Windsurf:使用 MCP 配置面板添加自定义服务器
重新启动您的 AI 助手(Cursor 或 Windsurf)以加载新配置。
这使您可以立即测试 MCP 服务器的更改,而无需发布新版本。
Available Tools
8 toolscommit-transactionC
Commit a transaction
Inputs: transactionId (required).
get-stored-procedureC
Get a specific stored procedure by name
Inputs: procedureName (required).
get-stored-proceduresB
Get a list of all stored procedures in the database
get-tableC
Get a specific table by name
Inputs: tableName (required).
get-tablesB
Get a list of all tables in the database
queryC
Query the database with a SQL statement
Inputs: query (required).
rollback-transactionC
Rollback a transaction
Inputs: transactionId (required).
start-transactionC
Start a new transaction
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Every tool has a clearly distinct purpose with no ambiguity. Tools are clearly separated by resource type (tables vs stored procedures) and action type (get specific vs get list vs transaction operations vs query). The query tool stands alone as a general-purpose operation.
All tools follow a consistent verb-noun pattern with hyphens. Transaction tools use verb-transaction pattern (start-transaction, commit-transaction, rollback-transaction), get operations use get-noun pattern (get-table, get-tables), and query stands alone as a clear single verb. The naming is perfectly predictable throughout.
8 tools is well-scoped for a database server. Each tool earns its place with clear responsibilities: 4 for data/metadata retrieval, 3 for transaction management, and 1 for general querying. This provides comprehensive coverage without bloat.
The toolset covers core database operations well with querying, transaction management, and metadata retrieval. Minor gaps exist in write operations beyond transactions (no explicit insert/update/delete tools) and schema modification (no create/alter/drop tools), but the query tool provides a workaround for most of these operations.
Maintenance
Related MCP Connectors
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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.63MIT
- AlicenseBqualityCmaintenanceA 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.1406MIT
- FlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that allows Large Language Models like Claude to execute SQL queries, explore database schemas, and maintain persistent connections to SQL Server databases.-
- FlicenseAqualityCmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with Microsoft SQL Server databases through natural language, supporting queries, data manipulation, and table management.8-