
This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A production-grade MySQL MCP Server that lets AI assistants safely and efficiently operate MySQL databases over the standardized protocol, with tools, resources, and prompts.
MySQL MCP Server for AI assistants is cataloged as an MCP server attributed to ccct173. A production-grade MySQL MCP Server that lets AI assistants safely and efficiently operate MySQL databases over the standardized protocol, with tools, resources, and prompts. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MySQL MCP Server for AI assistants are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
It supports stdio, SSE, and streamable-http transport modes.
Yes, a READ_ONLY mode is available, and execute_select is read-only even if misconfigured.
README.md · 1bd16818c7a5 · 采集于 2026-11-13 11:03:15 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
一个生产级的 MySQL MCP Server,让 AI 助手(Claude Desktop / WorkBuddy / Cursor / Cline 等)通过标准化协议安全高效地操作 MySQL 数据库。
相比社区其他 MySQL MCP 实现,本项目提供了更完整的能力集:
| 特性 | mysql-mcp-pro | 其他 MCP |
|---|---|---|
| 连接池(减少握手开销) | ✅ | ❌ |
| 事务支持(begin/commit/rollback) | ✅ | ❌ |
| EXPLAIN 自动解读 | ✅ | ❌ |
| 结果导出 CSV/JSON(Excel 友好 BOM) | ✅ | ❌ |
| ER 关系图数据(nodes/edges) | ✅ | 少数 |
| 视图 / 存储过程 / 函数 / 触发器 浏览 | ✅ | 少数 |
| 查询历史 & 审计日志 | ✅ | ❌ |
| MCP Prompts 模板(生成/优化/对比/概览) | ✅ | ❌ |
| 安全分级(只读/DDL/危险语句/超时/行限/参数化) | ✅ | 基础 |
| 多传输模式(stdio / SSE / streamable-http) | ✅ | 部分 |
# 从源码(推荐先 clone 再使用)
git clone https://github.com/CCCT173/mysql-mcp-pro.git
cd mysql-mcp-pro
pip install -e .
# 或从 PyPI(待发布)
pip install mysql-mcp-pro
复制 .env.example 为 .env 并编辑:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database
READ_ONLY=false # 只读模式
ALLOW_DDL=false # 是否允许 CREATE/ALTER/DROP
MAX_RESULT_ROWS=1000 # 单次查询最大返回行数
QUERY_TIMEOUT=30 # 查询超时(秒)
POOL_SIZE=5
AUDIT_LOG=true # 审计日志
EXPORT_DIR=./exports # 导出目录
编辑 ~/.workbuddy/mcp.json:
{
"mcpServers": {
"mysql": {
"command": "python",
"args": ["-m", "server"],
"cwd": "D:/path/to/mysql-mcp-pro",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
或者如果你已经 pip install -e .:
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-pro",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%/Claude/claude_desktop_config.json(Windows):
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-pro",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database",
"READ_ONLY": "true"
}
}
}
}
在项目根目录创建 .cursor/mcp.json(Cursor)或在 Cline 设置中添加,格式同上。
Tools are automatically extracted by MCP registries (Smithery, mcp.so, glama, etc.).
database argument.table (required), database (optional).routine_type (PROCEDURE/FUNCTION), database.sql, database, params, session_id.sql, database, params, limit.table, columns, where, order_by, limit, offset.table, database, where.EXPLAIN on a query and return plain-language performance insights. Arguments: sql, database, params, format.sql, filename, format (csv/json), database, params.limit.session_id for chained calls. Argument: database.session_id.session_id.SHOW FULL PROCESSLIST).process_id.ping — 测试连接、返回服务器版本与连接池状态get_server_status — MySQL 关键指标(连接数、QPS、慢查询、流量等)list_databases — 列出所有数据库(区分系统库 / 用户库)list_tables — 列出表,含引擎、行数、大小、注释describe_table — 表结构:字段、主键、索引、外键、建表 SQLlist_views — 列出视图list_routines — 列出存储过程 / 函数list_triggers — 列出触发器er_graph — 跨表外键关系(nodes + edges),便于画 ER 图execute_query — 执行任意 SQL(读/写/DDL,受安全策略约束),支持参数化execute_select — 只读 SELECT 专用(即使配置错误也只允许读)get_table_data — 快速取数:columns / where / order_by / limit / offsetcount_rows — 统计行数(支持可选 WHERE)explain_query — EXPLAIN 执行计划 + 中文性能洞察export_query — 结果导出 CSV(UTF-8 BOM,Excel 友好)或 JSON 文件list_query_history — 本会话 SQL 历史(耗时 / 行数 / 错误)begin_transaction — 开启事务,返回 session_idcommit_transaction — 提交事务rollback_transaction — 回滚事务show_processlist — 当前 MySQL 进程列表kill_query — Kill 指定进程(需要 SUPER 权限)mysql://databases — 数据库列表mysql://tables/{database} — 表列表mysql://schema/{database}/{table} — 表结构mysql://er/{database} — ER 关系图数据generate_query — 根据自然语言和表信息生成 SQLoptimize_sql — 分析并优化现有 SQL 性能compare_schema — 对比两张表的结构差异database_summary — 数据库整体概览报告危险语句(GRANT/REVOKE/SHUTDOWN/KILL/FLUSH/RESET)→ 永远禁止
DDL(CREATE/ALTER/DROP/RENAME/TRUNCATE) → 由 ALLOW_DDL 控制
写操作(INSERT/UPDATE/DELETE) → 由 READ_ONLY 控制
读操作(SELECT/SHOW/DESCRIBE/EXPLAIN) → 永远允许
%s 占位符,杜绝 SQL 注入MAX_EXECUTION_TIME 强制查询超时exports/audit.logmysql-mcp-pro/
├── server.py # MCP 服务器(连接池 / 事务 / 导出 / 审计)
├── pyproject.toml # 包元数据,入口 mysql-mcp-pro
├── .env.example # 环境变量模板
├── LICENSE # MIT
├── README.md / README.en.md
└── scripts/
├── setup_test_db.py # 创建 mcp_test 样例数据库
├── test_v2.py # 53 项回归测试
└── diag.py # MySQL 握手包诊断工具
# 1. 创建样例数据库(mcp_test,users + orders 表,带外键)
python scripts/setup_test_db.py
# 2. 跑全量回归测试
python scripts/test_v2.py
# → 53 passed, 0 failed
欢迎提 issue 和 PR!请确保:
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MySQL MCP Server for AI assistants from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/mysql-mcp-pro-961c3e)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A Model Context Protocol server that lets AI assistants run SQL queries against AWS Athena databases and retrieve results.

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.