Enables interaction with MySQL databases, supporting table management, CRUD operations, custom SQL queries, and schema viewing through a set of tools and resources.
Serves as the runtime environment for the MCP server, supporting MySQL database connections and operations.
MySQL数据库MCP服务
这是一个基于MCP(Model Context Protocol)的服务,允许通过Cursor与MySQL数据库进行交互,实现表的创建、查询、修改和删除等操作。
功能特点
- 创建和管理数据库表
- 执行CRUD操作(创建、读取、更新、删除)
- 执行自定义SQL查询
- 通过MCP协议与Cursor集成
安装和设置
前提条件
- Node.js 18.0.0 或更高版本
- MySQL 数据库服务器
安装步骤
- 克隆或下载本仓库
- 安装依赖:
- 配置环境变量:
- 复制
.env.example
文件为.env
- 编辑
.env
文件,填入您的MySQL数据库连接信息
- 复制
启动服务
服务器将在 http://localhost:3001 启动(或您在 .env
中指定的端口)。
在Cursor中使用
- 在Cursor中,使用以下方法添加MCP服务:
- 方法1: 在命令面板中搜索 "MCP" 并选择添加服务
- 方法2: 在设置中找到 MCP 相关配置
- 方法3: 直接使用命令
/connect-mcp http://localhost:3001/sse
- 连接成功后,您可以通过资源和工具与MySQL数据库进行交互
可用功能
资源
- 列出所有表:
- 查看表结构:
- 查看表数据:
工具
- 创建表:
- 删除表:
- 插入数据:
- 更新数据:
- 删除数据:
- 查询数据:
- 执行自定义SQL:
提示模板
- 创建表指南:
- 插入数据指南:
- 数据库操作概览:
示例场景
创建用户表并添加数据
- 创建用户表:
- 插入用户数据:
- 查询用户数据:
项目架构
安全注意事项
- 此服务未实现身份验证和授权机制,请勿在生产环境中使用
- 建议设置MySQL用户的权限,只允许必要的操作
- 不要在代码或环境变量中存储敏感的数据库凭据
许可证
MIT
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Allows Cursor to interact with MySQL databases through the MCP protocol, enabling creation, querying, modification and deletion of database tables and records.
Related MCP Servers
- -securityFlicense-qualityFacilitates interaction with a local MySQL database via a RESTful API, supporting database queries and real-time updates with integration for Cursor MCP services.Last updated -2JavaScript
- AsecurityAlicenseAqualityA template for creating custom tools for Cursor IDE using Model Context Protocol (MCP), allowing developers to extend Cursor's functionality with their own server-based tools.Last updated -112PythonMIT License
- -securityFlicense-qualityA server implementing the Model Context Protocol (MCP) for Cursor that allows using a PostgreSQL database as storage for model contexts, enabling secure database exploration and querying.Last updated -JavaScript
- -securityAlicense-qualitylark-tools-mcp connects Lark and cursor. It provides cursor with the ability to read documents, send messages, process tasks, and perform data analysis.Last updated -26JavaScriptMIT License
Appeared in Searches
- Connecting to PostgreSQL database, retrieving table schema, and executing SQL queries
- Information about PostgreSQL database management system
- An overview or information about MySQL
- Running MySQL Queries Through a MySQL Socket
- Building a Real-Time Automated DNS and AI Load Balancing System with AWS, HAProxy, and Python