Go-based MySQL MCP server

Go-based MySQL MCP server

go-mcp-mysql-pengcunfu•bypengcunfu

A zero-dependency, single-binary MySQL MCP server built in Go that exposes tools for database schema management and CRUD data operations.

License: Apache License 2.0•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Lists all tables in the connected MySQL database server.
  • •Runs read-only SELECT queries and returns the result set as CSV.
  • •Supports write, update, and delete queries with affected row counts.
  • •Offers read-only mode restricting tools to list, read_, and desc_ prefixes to prevent data modification.

BEST FOR

  • •Allowing MCP-capable AI clients to inspect and query MySQL databases.
  • •Managing MySQL table lifecycle and structure through MCP tools.
  • •Safely querying production databases in read-only mode.

ABOUT GO-MCP-MYSQL-PENGCUNFU

Go-based MySQL MCP server is cataloged as an MCP server attributed to pengcunfu. A zero-dependency, single-binary MySQL MCP server built in Go that exposes tools for database schema management and CRUD data operations. 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: Apache License 2.0. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

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 Go-based MySQL MCP server 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.

FREQUENTLY ASKED QUESTIONS

What query optimization feature does it offer?

It offers an optional EXPLAIN check that inspects the query plan before executing CRUD queries to help optimize performance.

How can it be configured?

It supports configuration through command-line parameters such as host, user, pass, port, and db, or through a custom DSN connection string, with DSN taking priority.

Upstream README

View this exact version on GitHub

README.md · 4aa4d92e51fd · Fetched 2026-11-13 13:09:40 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

mysql-mcp-server

Trust Score License Go Report Card GitHub release

零负担、开箱即用的 MySQL MCP 服务器

简体中文


特性

  • 零依赖:无需 Node.js 或 Python 环境,单一可执行文件
  • 安全可靠:支持只读模式,防止意外写入操作
  • 查询优化:可选的 EXPLAIN 检查,优化查询性能
  • 完整 CRUD:支持数据库和表的完整生命周期管理
  • 高性能:基于 Go 语言开发,性能卓越
  • 易于使用:支持命令行参数和 DSN 两种配置方式

注意:本项目正在积极开发中,建议在生产环境使用前进行充分测试。

安装

方式一:下载预编译二进制文件

从 Releases 页面 下载适合您操作系统的最新版本,并将其放入 $PATH 或您可以轻松访问的位置。

方式二:从源码构建

如果您已安装 Go 1.21 或更高版本:

go install -v github.com/pengcunfu/mysql-mcp-server@latest

快速开始

配置方式 A:使用命令行参数

{
  "mcpServers": {
    "mysql": {
      "command": "mysql-mcp-server",
      "args": [
        "--host", "localhost",
        "--user", "root",
        "--pass", "password",
        "--port", "3306",
        "--db", "mydb"
      ]
    }
  }
}

配置方式 B:使用 DSN 连接字符串

{
  "mcpServers": {
    "mysql": {
      "command": "mysql-mcp-server",
      "args": [
        "--dsn", "username:password@tcp(localhost:3306)/mydb?parseTime=true&loc=Local"
      ]
    }
  }
}

提示:更多 MySQL DSN 配置选项请参考 MySQL DSN 文档。

使用绝对路径

如果二进制文件不在 $PATH 中,需要使用完整路径。例如,Windows 用户可以这样配置:

{
  "mcpServers": {
    "mysql": {
      "command": "C:\\Users\\<username>\\Downloads\\mysql-mcp-server.exe",
      "args": ["--host", "localhost", "--user", "root", "--pass", "password"]
    }
  }
}

配置选项

命令行参数

标志说明默认值
--hostMySQL 主机名localhost
--userMySQL 用户名root
--passMySQL 密码-
--portMySQL 端口3306
--db数据库名-
--dsn自定义 DSN(优先使用)-
--read-only启用只读模式false
--with-explain-check执行前使用 EXPLAIN 检查查询计划false

可选标志

标志说明
--read-only启用只读模式,仅允许 list、read_ 和 desc_ 开头的工具,防止数据修改
--with-explain-check在执行 CRUD 查询前使用 EXPLAIN 检查查询计划,帮助优化性能

注意:修改标志后需要重启 MCP 服务器才能生效

可用工具

数据库模式管理

list_table

列出数据库服务器中的所有表。

  • 参数:无
  • 返回:表的名称列表

create_table

在数据库服务器中创建新表。

  • 参数:
    • query:CREATE TABLE SQL 语句
  • 返回:受影响的行数

alter_table

修改现有表结构,不支持删除表或列。

  • 参数:
    • query:ALTER TABLE SQL 语句
  • 返回:受影响的行数

desc_table

查看表结构详情。

  • 参数:
    • name:表名
  • 返回:表的结构信息(CREATE TABLE 语句)

drop_table

删除数据库服务器中的表。

  • 参数:
    • name:表名
  • 返回:执行结果

数据操作

read_query

执行只读 SQL 查询(SELECT)。

  • 参数:
    • query:SELECT SQL 语句
  • 返回:查询结果集(CSV 格式)

write_query

执行写入 SQL 查询(INSERT)。

  • 参数:
    • query:INSERT SQL 语句
  • 返回:受影响的行数和最后插入的 ID

update_query

执行更新 SQL 查询(UPDATE)。

  • 参数:
    • query:UPDATE SQL 语句
  • 返回:受影响的行数

delete_query

执行删除 SQL 查询(DELETE)。

  • 参数:
    • query:DELETE SQL 语句
  • 返回:受影响的行数

贡献

欢迎贡献!如果您有任何想法、建议或发现了 bug,请:

  1. Fork 本仓库
  2. 创建您的特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交您的更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启一个 Pull Request

许可证

本项目采用 Apache License 2.0 许可证。

相关链接

作者

pengcunfu


如果这个项目对您有帮助,请给它一个 star!

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 Go-based MySQL MCP server 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/go-mcp-mysql-pengcunfu)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

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

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

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