Skip to main content
Glama

MySQL MCP Server

by LeonMelamud

MySQL MCP 服务器

功能强大的 MCP 服务器,可直接访问 MySQL 数据库。该服务器使 AI 代理能够通过简单的界面与 MySQL 数据库交互、执行 SQL 查询并管理数据库内容。

特征

资源

  • 通过note:///{id} URI 访问存储在数据库中的笔记
  • 每个笔记都有标题和内容
  • 用于简单内容访问的纯文本 MIME 类型

工具

  • create_note - 在数据库中创建新的文本注释
    • 将标题和内容作为必需参数
    • 将注释存储在 MySQL 数据库中
  • list_tables - 列出所连接数据库中的所有表
  • count_tables获取数据库中表的总数
  • search_tables - 使用 LIKE 模式搜索表
  • describe_table - 获取特定表的结构
  • execute_sql自定义 SQL 查询

先决条件

  • Node.js 18 或更高版本
  • MySQL 服务器已安装并正在运行
  • 具有适当权限的数据库

设置

  1. 克隆此存储库:
    git clone git@github.com:LeonMelamud/mysql-mcp.git cd mysql-mcp
  2. 安装依赖项:
    npm install
  3. 使用您的 MySQL 连接详细信息在根目录中创建一个.env文件:
    MYSQL_HOST=localhost MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=your_database
  4. 构建服务器:
    npm run build

安装

对于克劳德桌面

将服务器配置添加到您的 Claude Desktop 配置文件:

在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "mysql": { "command": "node", "args": ["/path/to/mysql-server/build/index.js"], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" } } } }

对于克莱恩

将服务器配置添加到您的 Cline MCP 设置文件:

在 MacOS 上: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json在 Windows 上: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

{ "mcpServers": { "mysql": { "command": "node", "args": ["/path/to/mysql-server/build/index.js"], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" }, "disabled": false, "autoApprove": [] } } }

使用示例

安装完成后,您可以在与 Claude 的对话中使用 MySQL MCP 服务器:

列出数据库中的所有表

Please list all the tables in my MySQL database.

执行 SQL 查询

Run this SQL query: SELECT * FROM users LIMIT 5

创建笔记

Create a note titled "Meeting Notes" with the content "Discussed project timeline and assigned tasks."

发展

对于使用自动重建的开发:

npm run watch

调试

使用 MCP Inspector 调试服务器:

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

一个强大的服务器,使 AI 代理能够与 MySQL 数据库交互、执行 SQL 查询并通过简单的界面管理数据库内容。

  1. 特征
    1. 资源
    2. 工具
  2. 先决条件
    1. 设置
      1. 安装
        1. 对于克劳德桌面
        2. 对于克莱恩
      2. 使用示例
        1. 列出数据库中的所有表
        2. 执行 SQL 查询
        3. 创建笔记
      3. 发展
        1. 调试
      4. 执照

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          This server enables AI models to interact with MySQL databases through a standardized interface.
          Last updated -
          5
          646
          61
          JavaScript
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A server that enables AI models to interact with MySQL databases through a Model Control Protocol, providing tools for table creation, schema inspection, query execution, and data retrieval.
          Last updated -
          20
          Python
          MIT License
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          Connect and interact with MySQL databases seamlessly. Execute SQL queries, manage database connections, and retrieve data directly through AI assistants. Enhance your AI capabilities with structured access to your MySQL data.
          Last updated -
          9
          14
          3
          TypeScript
          MIT License
        • -
          security
          F
          license
          -
          quality
          Enables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
          Last updated -
          Python
          • Linux
          • Apple

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/LeonMelamud/mysql-mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server