mysqldb-mcp-server MCP 服务器
MySQL 数据库 MCP 服务器项目。
安装
您可以使用uv
安装该软件包:
或者使用pip
:
成分
工具
服务器提供了两个工具:
connect_database
:连接到特定的 MySQL 数据库database
参数:要连接的数据库的名称(字符串)- 连接成功时返回确认消息
execute_query
MySQL 查询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
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 MySQL 数据库集成服务器:
发展
构建和发布
准备分发包:
- 同步依赖项并更新锁文件:
- 构建软件包分发版:
这将在dist/
目录中创建源和轮子分布。
- 发布到 PyPI:
注意:您需要通过环境变量或命令标志设置 PyPI 凭据:
- 令牌:
--token
或UV_PUBLISH_TOKEN
- 或用户名/密码:
--username
/UV_PUBLISH_USERNAME
和--password
/UV_PUBLISH_PASSWORD
调试
由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector 。
您可以使用以下命令通过npm
启动 MCP Inspector:
启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
一个 MCP 服务器,支持 MySQL 数据库与 Claude 集成。您可以执行 SQL 查询并管理数据库连接。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.Last updated -Python
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -441917JavaScriptMIT License
- -securityAlicense-qualityA server that provides MySQL database operations through SSE (Server-Sent Events) based on the MCP (Model-Controller-Provider) framework, enabling real-time data transmission from MySQL databases.Last updated -15PythonMIT License
- AsecurityFlicenseAqualityMCP server that allows Claude AI to interact directly with MySQL databases, enabling query execution and table information retrieval through natural language.Last updated -163JavaScript