M

MCP SQL Express 助手

@hanweg/mcp-sqlexpress
2 Stars 634 次浏览 hanweg 更新于 2026-08-23

促进了与Microsoft SQL Server Express的交互,支持通过自然语言MCP命令进行数据库操作,例如查询、表管理和服务检查。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "sqlexpress": {
      "args": [
        "--directory",
        "PATH\\TO\\PROJECT\\mcp-sqlexpress",
        "run",
        "mcp-server-sqlexpress",
        "--server",
        "server\\instance",
        "--auth",
        "windows",
        "--trusted-connection",
        "yes",
        "--trust-server-certificate",
        "yes",
        "--allowed-databases",
        "database1,database2"
      ],
      "command": "uv"
    }
  }
}

服务介绍

SQL Server Express MCP 服务器

用于与 Microsoft SQL Server Express 交互的 MCP 服务器。支持 Windows 和 SQL Server 身份验证。

先决条件

  • Python 3.10 或更高版本
  • Microsoft ODBC Driver 18 for SQL Server
  • 具有适当权限的 SQL Server 实例

安装

克隆此仓库

cd mcp-sqlexpress

# Create and activate virtual environment
uv venv
.venv\Scripts\activate

# Install dependencies
uv pip install --editable .

与 Claude Desktop 一起使用

将以下内容添加到您的 claude_desktop_config.json 中:

{
    "mcpServers": {
        "sqlexpress": {
            "command": "uv",
            "args": [
                "--directory",
                "PATH\\TO\\PROJECT\\mcp-sqlexpress",
                "run",
                "mcp-server-sqlexpress",
                "--server",
                "server\\instance",
                "--auth",
                "windows",
                "--trusted-connection",
                "yes",
                "--trust-server-certificate",
                "yes",
                "--allowed-databases",
                "database1,database2"
            ]
        }
    }
}

身份验证选项

对于 Windows 身份验证:

  • 设置 --auth windows
  • 设置 --trusted-connection yes

对于 SQL Server 身份验证:

  • 设置 --auth sql
  • 添加 --username--password

功能

工具

  • get_allowed_databases: 获取允许访问的数据库列表
  • read_query: 执行 SELECT 查询
  • write_query: 执行 INSERT/UPDATE/DELETE 查询
  • create_table: 创建新表
  • list_tables: 列出数据库中的所有表
  • describe_table: 显示表结构

相关 MCP 服务