SQL Server Express 交互服务器

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

  • by hanweg
  • Python
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 hanweg/mcp-sqlexpress

使用说明

SQL Server Express MCP服务器

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

先决条件

  • Python 3.10或更高版本
  • 用于SQL Server的Microsoft ODBC驱动程序18
  • 具有适当权限的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:显示表架构