Skip to main content

MySQL MCP Server

一个带 GUI 配置面板的 MySQL MCP Server,外部使用方式对齐 mcp_ssh,底层改为 MySQL 连接与表操作。

功能

  • 多连接管理 - 保存多个 MySQL 连接并选择当前活动连接
  • GUI 配置面板 - mysqlgui 一键启动,可视化管理连接
  • YAML 导入 - 支持从 Java application.yml/.yaml 自动提取 MySQL 配置
  • 一键安装 - 安装到 Windsurf / Cursor / Claude Code / Codex
  • MCP 协议 - 通过 stdio 暴露 MySQL 工具
  • 全表操作 - 支持查询、DDL、CRUD、表结构查看

安装

pip install mysqlmcp-r

安装完成后即可直接使用命令行入口,不需要额外打包 PyInstaller exe。

pip 安装后如何直接启动 GUI

mysqlgui

mysqlgui 是 pip 根据 pyproject.toml 里的 project.scripts 自动生成的启动命令。
同理,安装后也可以直接使用:

mysqlmcp
mysqlmcp-install

在 Windows 下,你看到的通常会是 mysqlgui.exe / mysqlmcp.exe 这类命令包装器;它们由 pip 自动创建,不是额外单独打包出来的独立 exe。

如果安装后提示找不到 mysqlgui,通常是 Python 的 Scripts 目录没有加入 PATH。此时可先尝试:

python -m mysql_mcp.cli --gui

命令一览

命令 说明
mysqlmcp 以 MCP Server 模式运行
mysqlgui 启动 GUI 配置面板
mysqlmcp-install 安装到所有 IDE
mysqlmcp-install-windsurf 安装到 Windsurf
mysqlmcp-install-cursor 安装到 Cursor
mysqlmcp-install-claudecode 安装到 Claude Code
mysqlmcp-install-codex 安装到 Codex

快速开始

# 1. 安装
pip install mysqlmcp-r

# 2. 打开 GUI 管理连接
mysqlgui

# 3. 安装到 IDE
mysqlmcp-install-codex

# 4. 或直接启动 MCP Server
mysqlmcp

GUI 支持

  • 手动填写 host / port / username / password / database / charset
  • 在“添加/编辑连接”弹窗中选择 YAML 文件自动导入 MySQL datasource
  • 测试连接
  • 指定当前活动连接

MCP Tools

  • list_servers
  • connect
  • disconnect
  • get_status
  • exec_sql(禁止执行 DROP TABLE、TRUNCATE TABLE、DROP DATABASE)
  • list_databases
  • list_tables
  • describe_table
  • show_create_table
  • list_columns
  • create_table
  • alter_table
  • rename_table
  • insert_rows(rows 必须是对象数组,支持多行批量插入)
  • update_rows(where_clause 支持 ? 或 %s)
  • delete_rows(where_clause 支持 ? 或 %s)

手动 MCP 配置

{
  "mcpServers": {
    "mysql": {
      "command": "mysqlmcp"
    }
  }
}

开发测试

python -m pytest -q

Metadata

Release files for mysqlmcp-r 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysqlmcp-r 0.1.1
File Size Uploaded Provenance Actions
mysqlmcp_r-0.1.1.tar.gz 22.2 kB Without provenance Details for mysqlmcp_r-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mysqlmcp-r 0.1.1
File Interpreter ABI Platform Actions
mysqlmcp_r-0.1.1-py3-none-any.whl Python 3 none any Details for mysqlmcp_r-0.1.1-py3-none-any.whl

Total release size: 40.6 kB

Release files / mysqlmcp_r-0.1.1.tar.gz

Download URL mysqlmcp_r-0.1.1.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5bec4406b6ba7b17c7f990d77ddf5b43bbefddf657305da651d2c6e94b6b848e
BLAKE2b-256 checksum
How to use checksums
dd58db15cb3da994d68eae1cbae7ae0f0bfe7d5ff045dcf294b16c2fcc4dfece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / mysqlmcp_r-0.1.1-py3-none-any.whl

Download URL mysqlmcp_r-0.1.1-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fd34836fa2d980ebf8b0902c3091519f23705cc4dd451004ae2659f89206645
BLAKE2b-256 checksum
How to use checksums
cd5f45f946629520c6bf3ea9ffe81338594281c409ac68f88bf735deefe270c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for mysqlmcp-r 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page