MCP MySQL 数据库服务器

MCP MySQL 数据库服务器

用于 MySQL 数据库的模型上下文协议服务器,支持只读查询与模式检查。

快速入门

使用 Docker

  1. 构建镜像:运行 make docker
  2. 启动容器:

docker run -i --rm mcp/mysql mysql://host:port/dbname

#### 安装 Smithery
通过 NPM 安装:
```bash
npx -y @smithery/cli install @yuru-sha/mcp-server-mysql --client claude

配置 Claude Desktop

编辑 claude_desktop_config.json 文件,添加以下内容:

{
  "mcpServers": {
    "mysql": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "mcp/mysql",
        "mysql://host:port/dbname"
      ]
    }
  }
}

注意:macOS 用户需将 host 替换为 host.docker.internal

开发环境

  1. 初始化:make setup
  2. 构建:make build
  3. 格式化代码:make format
  4. 检查代码:make lint