mysqldb-mcp-server
mysqldb-mcp-server MCP 服务器
MySQL 数据库 MCP 服务器项目。
安装
您可以使用uv安装该软件包:
uv pip install mysqldb-mcp-server或者使用pip :
pip install mysqldb-mcp-serverRelated MCP server: MySQL Custom MCP Server
成分
工具
服务器提供了两个工具:
connect_database:连接到特定的 MySQL 数据库database参数:要连接的数据库的名称(字符串)连接成功时返回确认消息
execute_queryMySQL 查询query参数:要执行的 SQL 查询/查询(字符串)以 JSON 格式返回查询结果
可以发送多个查询,以分号分隔
配置
服务器使用以下环境变量:
MYSQL_HOST:MySQL 服务器地址(默认:“localhost”)MYSQL_USER:MySQL 用户名(默认值:“root”)MYSQL_PASSWORD:MySQL 密码(默认值:“”)MYSQL_DATABASE:初始数据库(可选)MYSQL_READONLY:只读模式(设置为 1/true 以启用,默认值:false)
快速入门
安装
克劳德桌面
MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mysqldb-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/Users/burakdirin/Projects/mysqldb-mcp-server",
"run",
"mysqldb-mcp-server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "[optional]",
"MYSQL_READONLY": "true"
}
}
}
}{
"mcpServers": {
"mysqldb-mcp-server": {
"command": "uvx",
"args": [
"mysqldb-mcp-server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "[optional]",
"MYSQL_READONLY": "true"
}
}
}
}通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 MySQL 数据库集成服务器:
npx -y @smithery/cli install @burakdirin/mysqldb-mcp-server --client claude发展
构建和发布
准备分发包:
同步依赖项并更新锁文件:
uv sync构建软件包分发版:
uv build这将在dist/目录中创建源和轮子分布。
发布到 PyPI:
uv publish注意:您需要通过环境变量或命令标志设置 PyPI 凭据:
令牌:
--token或UV_PUBLISH_TOKEN或用户名/密码:
--username/UV_PUBLISH_USERNAME和--password/UV_PUBLISH_PASSWORD
调试
由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector 。
您可以使用以下命令通过npm启动 MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /Users/burakdirin/Projects/mysqldb-mcp-server run mysqldb-mcp-server启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。
Available Tools
2 toolsconnect_databaseC
Connect to a specific MySQL database
Inputs: database (required).
execute_queryC
Execute MySQL queries
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: connect_database handles database connections, while execute_query handles query execution. There is no overlap or ambiguity between these functions, making it easy for an agent to select the correct tool based on the task.
Both tools follow a consistent verb_noun pattern (connect_database and execute_query), using snake_case throughout. This predictable naming scheme enhances readability and reduces confusion for agents interacting with the server.
With only 2 tools, the server feels under-scoped for a MySQL database management system. Core operations like creating tables, inserting data, or managing schemas are missing, which limits its utility for typical database workflows. This count is too low for the apparent domain.
The tool surface is severely incomplete for MySQL database operations. While connecting and executing queries are foundational, there are significant gaps in CRUD operations (e.g., no create, read, update, or delete tools), schema management, or data manipulation, which will likely cause agent failures in real-world scenarios.
Maintenance
Related MCP Connectors
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server that allows Claude AI to interact directly with MySQL databases, enabling query execution and table information retrieval through natural language.14ISC
- FlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables interaction with MySQL databases through the Model Context Protocol, allowing execution of SQL queries and database table listing operations from Cline AI.-
- AlicenseNot gradedqualityDmaintenanceMySQL MCP Server enables Claude Desktop and Claude Code to execute SQL queries, explore databases, Webview to add or enable Databases, Connections, and interact with your MySQL data - all through a secure, permission-controlled interface.107 npm1MIT
- AlicenseAqualityCmaintenanceMCP server for Claude that connects to MySQL, MariaDB, and SQLite databases. Query your databases using natural language.3132 PyPIMIT