MySQL CRUD MCP Server
Provides CRUD tools to execute SELECT, INSERT, UPDATE, and DELETE queries against a MySQL database, and retrieve connection information.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MySQL CRUD MCP Server Show me the 10 most recent orders from the orders table."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL CRUD MCP 服务器
这是一个用于 MySQL 数据库操作的 MCP (Model Context Protocol) 服务器插件,提供完整的 CRUD 操作工具。
✨ 特性
🔍 自动检测项目配置 - 自动向上查找
.env文件定位项目根目录🔄 多项目支持 - 不同项目自动使用不同的数据库连接
⏱️ 连接超时保护 - 默认 10 秒超时,可通过环境变量配置
📝 多种配置格式 - 支持 INI section 和 KEY=VALUE 两种格式
🛠️ 兼容多工具 - 支持 Claude Code、Cline、Codex 等
Related MCP server: MySQL MCP Server
🚀 快速开始
全局安装(推荐)
npm install -g mysql-crud-serverMCP 配置
在项目根目录创建 .mcp.json:
{
"mcpServers": {
"mysql-crud": {
"command": "mysql-crud-server"
}
}
}⚙️ 配置说明
配置格式一:INI Section 格式
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
HOSTPORT = 3306
USERNAME = root
PASSWORD = your_password
DATABASE = your_database
CHARSET = utf8mb4配置格式二:KEY=VALUE 格式
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=root
DB_PASSWORD=your_password支持的配置名称
配置项 | 支持的名称 |
主机 |
|
端口 |
|
用户 |
|
密码 |
|
数据库 |
|
字符集 |
|
🔧 工具列表
mysql_select - 执行 SELECT 查询
mysql_insert - 执行 INSERT 查询
mysql_update - 执行 UPDATE 查询
mysql_delete - 执行 DELETE 查询
mysql_info - 获取连接信息
⏱️ 超时配置
默认连接超时为 10 秒,可通过环境变量配置:
{
"mcpServers": {
"mysql-crud": {
"command": "mysql-crud-server",
"env": {
"MYSQL_TIMEOUT": "30000"
}
}
}
}📝 使用示例
SELECT 查询
mysql_select: SELECT * FROM users WHERE id = ?
params: [1]INSERT 查询
mysql_insert: INSERT INTO users (name, email) VALUES (?, ?)
params: ["张三", "zhangsan@example.com"]🐛 故障排除
连接超时
检查网络连接和防火墙设置
确认数据库服务器可访问
调整
MYSQL_TIMEOUT环境变量
配置文件找不到
确保
.env文件在项目根目录MCP 会自动向上查找
.env文件
INI 格式解析失败
确保使用正确的 section 名称
[DATABASE]支持 Windows (
\r\n)、Unix (\n) 和旧 Mac (\r) 换行符
📄 许可证
MIT
Available Tools
5 toolsmysql_deleteD
执行 DELETE 查询。
Inputs: query (required), params.
mysql_infoC
获取连接信息。
Inputs: no named parameters.
mysql_insertC
执行 INSERT 查询。
Inputs: query (required), params.
mysql_selectC
执行 SELECT 查询。自动读取项目 .env 配置连接数据库。
Inputs: query (required), params.
mysql_updateC
执行 UPDATE 查询。
Inputs: query (required), params.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool maps to a clearly distinct SQL operation (SELECT, INSERT, UPDATE, DELETE) plus a connection-info tool. There is no realistic overlap or ambiguity between them.
All names use the same mysql_ prefix followed by a concise operation verb. The pattern is predictable and consistent snake_case throughout.
Five tools is a tight, well-scoped surface for a MySQL CRUD server. Each tool corresponds directly to a core database operation with no filler.
The CRUD lifecycle is fully covered and mysql_info provides connection context. However, there is no schema discovery or table-listing tool, so an agent working against an unfamiliar database cannot inspect tables or columns before writing queries.
Maintenance
Related MCP Connectors
Create, manage, and query your Google Cloud SQL resources.
Connect to PlanetScale databases, branches, schema, query insights, and execute SQL
Database intelligence, AST SQL injection auditing, query optimization & schema guards.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables direct interaction with MySQL databases through SQL queries, table exploration, and schema inspection with support for prepared statements and connection pooling.-
- AlicenseAqualityDmaintenanceEnables connecting to and querying MySQL databases directly from Cursor IDE, with support for executing SQL queries, listing databases and tables, inspecting schemas, and managing connections with SSL and connection pooling.87 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MySQL databases through connection management, SQL execution, and schema exploration. It features multi-connection support and a safety-focused 'dangerous mode' for write operations.15 npm4MIT
- AlicenseNot gradedqualityDmaintenanceEnables safe querying and optional writing to MySQL databases via MCP tools, with support for schema inspection, connection management, and read-only mode.19 npm3MIT