MySQL Database Service
STDIOLightweight service for connecting and operating local MySQL databases through API interface.
Lightweight service for connecting and operating local MySQL databases through API interface.
MCP MySQL服务是一个轻量级的个人使用服务程序,用于连接和操作本地MySQL数据库。此服务可作为Cursor的MCP服务使用,通过API接口使Cursor能够轻松地执行各种数据库操作。
npm install
.env
文件
# 服务器配置
PORT=3000
NODE_ENV=development
# MySQL数据库配置
DB_HOST=localhost
DB_PORT=3306
DB_USER=你的用户名
DB_PASSWORD=你的密码
DB_NAME=你的数据库名
# API配置
API_KEY=你的API密钥
npm start
开发模式(自动重启):
npm run dev
GET /api/databases
GET /api/databases/:database/tables
GET /api/databases/:database/tables/:table/structure
POST /api/query
Content-Type: application/json
{
"sql": "SELECT * FROM users WHERE age > ?",
"params": [18],
"limit": 10,
"offset": 0
}
GET /api/sse?apiKey=your-api-key
{ "name": "MySQL数据库服务", "url": "http://localhost:3000/api/sse", "type": "sse" }
{ "name": "MySQL数据库服务", "command": "node /path/to/mcp_server_mysql/src/app.js", "type": "command" }
MIT