@enemyrr/mcp-mysql-服务器
提供 MySQL 数据库操作的模型上下文协议服务器。该服务器使 AI 模型能够通过标准化接口与 MySQL 数据库交互。
Cursor IDE 的安装和设置
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 MySQL 数据库服务器:
手动安装
克隆并构建项目:
在 Cursor IDE 设置中添加服务器:
打开命令面板(Cmd/Ctrl + Shift + P)
搜索“MCP:添加服务器”
填写字段:
名称:
mysql
类型:
command
命令:
node /absolute/path/to/mcp-mysql-server/build/index.js
注意:将
/absolute/path/to/
替换为您克隆和构建项目的实际路径。
数据库配置
您可以通过三种方式配置数据库连接:
.env 中的数据库 URL (推荐):
.env 中的各个参数:
通过工具直接连接:
可用工具
1. 连接数据库
使用 URL、工作区路径或直接凭据连接到 MySQL 数据库。
2. 查询
使用可选的准备好的语句参数执行 SELECT 查询。
3. 执行
使用可选的准备好的语句参数执行 INSERT、UPDATE 或 DELETE 查询。
4. 列表表
列出所连接数据库中的所有表。
5. describe_table
获取特定表的结构。
6. 创建表
创建具有指定字段和索引的新表。
7. 添加列
向现有表中添加新列。
特征
多种连接方式(URL、工作区、直接)
通过自动清理来安全处理连接
查询参数的预处理语句支持
架构管理工具
全面的错误处理和验证
TypeScript 支持
自动工作区检测
安全
使用准备好的语句来防止 SQL 注入
支持通过环境变量进行安全密码处理
执行前验证查询
完成后自动关闭连接
错误处理
服务器提供以下详细的错误消息:
连接失败
无效的查询或参数
缺少配置
数据库错误
架构验证错误
贡献
欢迎贡献!请随时向https://github.com/enemyrr/mcp-mysql-server提交 Pull 请求。
执照
麻省理工学院
Related MCP Servers
- AsecurityAlicenseAqualityThis server enables AI models to interact with MySQL databases through a standardized interface.Last updated -310110MIT License
- AsecurityAlicenseAqualityConnect and interact with MySQL databases seamlessly. Execute SQL queries, manage database connections, and retrieve data directly through AI assistants. Enhance your AI capabilities with structured access to your MySQL data.Last updated -9017MIT License
- -securityFlicense-qualityEnables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.Last updated -
- -securityAlicense-qualityA powerful server that enables AI agents to interact with MySQL databases, execute SQL queries, and manage database content through a simple interface.Last updated -286MIT License