KM

kevinwatt/mysql-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

18 stars 10 forks 质量 61 趋势 22MIT

与 MySQL 数据库集成的 MCP 服务器执行,为 LLMs 提供安全的数据库访问能力.

概览

与 MySQL 数据库集成的 MCP 服务器执行,为 LLMs 提供安全的数据库访问能力. * * 执行只读 SELECT 查询 * 列出所有数据库表 * 显示表结构 * 查看计划信息 * 执行INSERT/UPDATE/DELETE 提供交易支持 * 参数化数据安全查询 * 返回受影响的行并插入ID * * SELECT 查询只读交易模式 * 查询长度和结果大小限制 * 性能监测和记录 * 自动交易处理 1. 点击 Dive桌面 2. 复制并粘贴此配置中的"+添加 MCP 服务器": 3个.

概述(AI 翻译)

与 MySQL 数据库集成的 MCP 服务器执行,为 LLMs 提供安全的数据库访问能力.

□ 特性

  • ** 读取业务**
  • 执行只读的 SELECT 查询
  • 列出所有数据库表格。
  • 显示表格结构
  • 查看计划信息
  • ** 写业务**
  • 用交易支持执行InSERT/UPDATE/DEELTE
  • 数据安全参数化查询
  • 返回受影响的行并插入ID
  • ** 警卫**
  • SELECT 查询的只读交易模式
  • 查询长度和结果大小限制
  • 业绩监测和伐木
  • 自动处理交易

□ 安装

□ 用潜水桌面

  1. 在 Dive 桌面上点击“ + 添加 MCP 服务器”

  2. 复制并粘贴此配置:

  3. 点击"保存"安装 MCP 服务器

□ 工具文档

  • ** mysql query**

  • 执行只读的 SELECT 查询

  • 投入:

  • [[T0] (字符串): 要执行的 SQL SELECT 查询

  • 限制:

  • 最大查询长度: 4096个字符

  • 最大结果行: 1 000

  • 查询超时: 30秒

  • ** mysql 执行**

  • 执行数据修改操作

  • 投入:

  • [[T1] (字符串): SQL 语句(INSERT/UPDATE/DELETE)

本页由 AI 翻译,技术细节请以原文为准。

README

MySQL MCP Server

An MCP server implementation that integrates with MySQL databases, providing secure database access capabilities for LLMs.

Features

  • Read Operations
    • Execute read-only SELECT queries
    • List all database tables
    • Show table structures
    • View schema information
  • Write Operations
    • Execute INSERT/UPDATE/DELETE with transaction support
    • Parameterized queries for data safety
    • Returns affected rows and insert IDs
  • Security
    • Read-only transaction mode for SELECT queries
    • Query length and result size limits
    • Performance monitoring and logging
    • Automatic transaction handling

Installation

npm install -g @kevinwatt/mysql-mcp

Usage with Dive Desktop

  1. Click “+ Add MCP Server” in Dive Desktop
  2. Copy and paste this configuration:
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@kevinwatt/mysql-mcp"
      ],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "",
        "MYSQL_DB": "your_database"
      }
    }
  }
}
  1. Click “Save” to install the MCP server

Tool Documentation

  • mysql_query

    • Execute read-only SELECT queries
    • Inputs:
      • sql (string): SQL SELECT query to execute
    • Limits:
      • Maximum query length: 4096 characters
      • Maximum result rows: 1000
      • Query timeout: 30 seconds
  • mysql_execute

    • Execute data modification operations
    • Inputs:
      • sql (string): SQL statement (INSERT/UPDATE/DELETE)
      • params (array, optional): Parameters for the SQL statement
    • Features:
      • Returns affected rows count
      • Returns last insert ID
      • Automatic transaction handling
  • list_tables

    • List all tables in current database
    • No inputs required
  • describe_table

    • Show table structure
    • Inputs:
      • table (string): Table name to describe

Usage Examples

Ask your LLM to:

"Show me all tables in the database"
"Describe the structure of users table"
"Select all active users from the database"
"Insert a new record into orders table"

Manual Start

If needed, start the server manually:

npx @kevinwatt/mysql-mcp

Requirements

  • Node.js 18+
  • MySQL Server
  • MCP-compatible LLM service

License

MIT

Author

Dewei Yen

Keywords

  • mcp
  • mysql
  • database
  • dive
  • llm
  • ai
在 GitHub 查看完整 README

安装

npx -y @kevinwatt/mysql-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mysql": { "command": "npx", "args": [ "-y", "@kevinwatt/mysql-mcp" ], "env": { "MYSQL_HOST": "127.0.0.1", "MYSQL_PORT": "3306", "MYSQL_USER": "root", "MYSQL_PASS": "", "MYSQL_DB": "your_database" } } } }