MCP server for MySQL database operations

MCP server for MySQL database operations

mysql•bymalove86

An MCP server that lets AI models connect to MySQL databases and run queries and schema inspection through standardized tools.

License: Not specified•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Provides a connect_db tool to establish a MySQL connection using supplied credentials, optional when environment variables are already set.
  • •Provides a query tool for executing SELECT statements with optional prepared-statement parameters.
  • •Provides tools to list all tables in the connected database and describe a specific table's structure.
  • •Supports a remote URL mode where the server holds sensitive database credentials and clients connect without providing connection details.

BEST FOR

  • •Letting AI models explore MySQL schemas by listing tables and describing table structures.
  • •Running parameterized SELECT queries against MySQL from an MCP-enabled AI client.

ABOUT MYSQL

MCP server for MySQL database operations is cataloged as an MCP server attributed to malove86. An MCP server that lets AI models connect to MySQL databases and run queries and schema inspection through standardized tools. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for MySQL database operations are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

上游原版 README

在 GitHub 查看同一版本原文

README.md · fec23ce57bad · 采集于 2026-11-13 08:54:49 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

mcp-mysql-server

一个基于Model Context Protocol的MySQL数据库操作服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。

安装

npx @malove86/mcp-mysql-server

配置

服务器支持两种部署模式:

1. 本地运行模式

在MCP设置配置文件中使用命令行运行:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@malove86/mcp-mysql-server"],
      "env": {
        "MYSQL_HOST": "your_host",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_PORT": "3306"
      }
    }
  }
}

2. 远程URL模式 (v0.2.2+)

指向远程运行的MCP服务器:

{
  "mcpServers": {
    "mcp-mysql-server": {
      "url": "http://your-server-address:port/mcp-mysql-server"
    }
  }
}

在远程服务器上,您需要设置环境变量后启动MCP服务器:

# 设置环境变量
export MYSQL_HOST=your_host
export MYSQL_USER=your_user
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database
export MYSQL_PORT=3306  # 可选,默认为3306

# 启动服务器
npx @malove86/mcp-mysql-server

注意:MYSQL_PORT是可选的,默认值为3306。

版本功能

v0.2.4+ 新特性

  • 多用户并发支持:服务器现在可同时处理多个用户的请求
  • 高效连接池管理:使用改进的连接池,支持最多50个并发连接
  • 请求级别隔离:每个请求都有唯一标识符,便于跟踪和调试
  • 详细日志记录:记录每个请求的执行过程和资源使用情况
  • 改进的错误处理:更精确地捕获和报告数据库错误
  • 性能优化:连接池复用和优化的连接管理提高处理速度

v0.2.2+ 特性

  • 自动数据库连接:在服务器启动时,如果设置了环境变量,会自动尝试连接数据库
  • 无需客户端参数:当使用URL模式时,客户端不需要提供数据库连接信息
  • 无感知数据库操作:可以直接使用list_tables、query等工具,无需先调用connect_db
  • 更安全:敏感的数据库凭据只在服务器端存在,不会暴露在客户端对话中
  • 优雅的容错:即使初始连接失败,后续操作会自动重试连接

可用工具

1. connect_db

使用提供的凭据建立与MySQL数据库的连接。如果已通过环境变量设置了连接,此工具是可选的。

{
  "host": "localhost",
  "user": "root",
  "password": "your_password",
  "database": "your_database",
  "port": 3306  // 可选,默认为3306
}

2. query

执行SELECT查询,支持可选的预处理语句参数。

{
  "sql": "SELECT * FROM users WHERE id = ?",
  "params": [1]  // 可选参数
}

3. list_tables

列出已连接数据库中的所有表。

{}  // 从v0.2.4开始不再需要任何参数

4. describe_table

获取特定表的结构。

{
  "table": "users"
}

功能特点

  • 安全的连接处理,自动清理
  • 支持预处理语句参数
  • 全面的错误处理和验证
  • TypeScript支持
  • 自动连接管理
  • 服务器环境变量配置
  • 支持URL远程连接模式
  • 多用户并发支持
  • 高性能连接池

性能

  • 支持最多50个并发连接(可配置)
  • 连接池自动管理,提高资源利用率
  • 详细的请求跟踪和性能监控

安全性

  • 使用预处理语句防止SQL注入
  • 通过环境变量支持安全密码处理
  • 执行前验证查询
  • 完成后自动关闭连接
  • URL模式下敏感凭据不暴露在客户端
  • 连接隔离,防止用户间数据泄露

贡献

欢迎贡献!请随时提交Pull Request到 https://github.com/Malove86/mcp-mysql-server.git

许可证

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for MySQL database operations from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mysql)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage