mysql_mcp_server_pro
by wenb1n-dev·★ 244·综合分 46
功能全面的 MySQL MCP 服务器,提供高级查询、分析和优化功能。
概述
mysql_mcp_server_pro 是一个功能强大的 MCP 服务器,不仅支持基础的 CRUD 操作,还提供了全面的数据库管理功能。它包含专门的 SQL 执行工具、中文字段名转换、健康状态分析、表锁检测和性能优化工具。服务器支持多种 MCP 传输模式(STDIO、SSE、Streamable Http),并实现了 OAuth2.0 认证,具有基于角色的权限控制(只读、写入、管理员)。此外,它还提供内置的提示模板,以增强与 MySQL 的交互体验。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要数据库健康监控、性能优化和中文字段名支持时,选择此MySQL MCP服务器。
什么时候不要选它
如果您需要支持非MySQL数据库,或者需要功能更简单的解决方案,请不要选择此服务器。
此 server 暴露的工具
从 README 抽取出 10 个工具execute_sqlSQL execution tool that can execute various SQL commands based on permission configuration
get_chinese_initialsConvert Chinese field names to pinyin initials
get_db_health_runningAnalyze MySQL health status including connection, transaction, and lock status
get_table_descSearch for table structures in the database based on table names
get_table_indexSearch for table indexes in the database based on table names
get_table_lockCheck for row-level or table-level locks in the MySQL server
get_table_nameSearch for table names in the database based on table comments and descriptions
get_db_health_index_usageGet index usage statistics including redundant and poorly performing indexes
optimize_sqlProvide SQL optimization suggestions based on execution plans and table structure
use_prompt_queryTableDataUse built-in prompts to construct tool chains for querying table data
可对比工具
安装
安装
- 安装包:
pip install mysql_mcp_server_pro- 在 .env 文件中配置环境变量:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database
MYSQL_ROLE=readonly # 或 writer, admin- 启动服务:
# SSE 模式
mysql_mcp_server_pro --mode sse --envfile /path/to/.env
# Streamable Http 模式(默认)
mysql_mcp_server_pro --envfile /path/to/.env
# 带 OAuth 认证
mysql_mcp_server_pro --oauth trueClaude Desktop 配置
添加到 Claude Desktop config.json:
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql_mcp_server_pro",
"mysql_mcp_server_pro",
"--mode",
"stdio"
],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database",
"MYSQL_ROLE": "admin"
}
}
}
}FAQ
- 此 MCP 服务器支持哪些身份验证方法?
- 服务器支持使用环境变量的基本身份验证和基于令牌的 OAuth2.0 身份验证。
- 如何使用自定义工具扩展服务器?
- 您可以在 handles 包中添加新的工具类,继承自 BaseHandler,并实现 get_tool_description 和 run_tool 方法,然后在 __init__.py 中导入它。
mysql_mcp_server_pro 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。