MCP cover image
See in Github
2025-02-28

1

Github Watches

2

Github Forks

2

Github Stars

MCP MySQL 本地数据库服务

MCP MySQL服务是一个轻量级的个人使用服务程序,用于连接和操作本地MySQL数据库。此服务可作为Cursor的MCP服务使用,通过API接口使Cursor能够轻松地执行各种数据库操作。

特性

  • 连接本地MySQL数据库
  • 提供RESTful API进行数据库操作
  • 支持参数化查询防止SQL注入
  • 支持SSE (Server-Sent Events) 推送能力
  • 支持作为Cursor MCP服务集成

快速开始

前置条件

  • Node.js (v14+)
  • MySQL服务器

安装

  1. 克隆此仓库
  2. 安装依赖
    npm install
    
  3. 创建并配置.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

API接口

获取所有数据库

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
}

SSE连接

GET /api/sse?apiKey=your-api-key

在Cursor中使用

SSE方式

{
  "name": "MySQL数据库服务",
  "url": "http://localhost:3000/api/sse",
  "type": "sse"
}

Command方式

{
  "name": "MySQL数据库服务",
  "command": "node /path/to/mcp_server_mysql/src/app.js",
  "type": "command"
}

安全性考虑

  • 此服务仅限本地使用,不建议暴露到公网
  • 使用API密钥保护接口
  • 默认只允许执行SELECT查询

许可证

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • modelcontextprotocol
  • Serveurs de protocole de contexte modèle

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • OffchainLabs
  • Aller la mise en œuvre de la preuve de la participation Ethereum

  • n8n-io
  • Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.

  • huahuayu
  • Une passerelle API unifiée pour intégrer plusieurs API d'explorateur de blockchain de type étherscan avec la prise en charge du protocole de contexte modèle (MCP) pour les assistants d'IA.

    Reviews

    5 (1)
    Avatar
    user_Yr12fR1q
    2025-04-15

    I've been using AI MCP Servers by AIWalaBro for several months, and the performance is outstanding. Perfect for my AI projects, it offers seamless integration and high-speed processing. Highly recommend to anyone in need of reliable server solutions. Check it out here: https://mcp.so/server/MCP-Servers/AIWalaBro.