Skip to main content
Glama
cwilby

SQL Server MCP

by cwilby

mcp-node-mssql

用法

光标

请参阅官方 Cursor 文档以了解更多信息。

  1. 打开(或创建) mcp.json文件(它应该位于~/.cursor/mcp.json<project-root>/.cursor/mcp.json中,但有关更多详细信息,请参阅 Cursor 文档)。

  2. 添加以下详细信息并保存文件:

{
  "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 文档以了解更多信息。

  1. 打开Windsurf MCP Configuration Panel

  2. 单击Add custom server

  3. 添加以下详细信息并保存文件:

{
  "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 文件更简单!

  1. 打开 Claude Code 配置文件(它应该在~/.claude.json中)。

  2. 找到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 服务器的本地开发版本(而不是使用已发布的包),请按照以下步骤操作:

  1. 构建项目:

npm run build
  1. 创建或修改您的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>"
      }
    }
  }
}
  1. 将此mcp.json文件放置在以下位置之一:

    • 对于 Cursor:在您的主目录( ~/.cursor/mcp.json )或项目目录( .cursor/mcp.json )中

    • 对于 Windsurf:使用 MCP 配置面板添加自定义服务器

  2. 重新启动您的 AI 助手(Cursor 或 Windsurf)以加载新配置。

这使您可以立即测试 MCP 服务器的更改,而无需发布新版本。

Latest Blog Posts

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/cwilby/mcp-node-mssql'

If you have feedback or need assistance with the MCP directory API, please join our Discord server