Zhwt/go-mcp-mysql logo

Zhwt/go-mcp-mysql

Free

易于使用、零依赖的 MySQL MCP 服务器 (Go),具有可配置的只读模式和模式检查。

FreeFree tier
Type
Open Source

About Zhwt/go-mcp-mysql

go-mcp-mysql is a zero-dependency, ready-to-use Model Context Protocol (MCP) server written in Go for interacting with MySQL databases. It eliminates the need for Node.js or Python environments, providing a lightweight binary that can be easily deployed. The server supports full CRUD operations on MySQL databases and tables, with a configurable read-only mode to prevent accidental write operations. It also includes an optional EXPLAIN-check feature that validates query plans before execution, enhancing safety. Tools are organized into schema tools (list_database, list_table, create_table, alter_table, desc_table) and data tools (read_query, write_query). Configuration can be done via command-line arguments or a DSN string. Note: this project is a work in progress and may not yet be production-ready.

Key Features

Zero dependency – single Go binary, no Node.js or Python runtime required
Full CRUD operations (create, read, update, delete) on MySQL databases and tables
Configurable read-only mode to prevent accidental write operations
Optional EXPLAIN-check flag to validate query plans before execution
Schema tools: list_database, list_table, create_table, alter_table, desc_table
Data tools: read_query and write_query
Supports configuration via CLI arguments or MySQL DSN string
Open source and installable via 'go install' or precompiled binaries

Pros & Cons

Pros
  • No runtime dependencies – works with just a Go binary
  • Easy setup – configure via CLI arguments or DSN
  • Read-only mode adds safety for production use
  • EXPLAIN-check helps prevent dangerous queries
  • Open source and free to use
Cons
  • Project is a work in progress and may not be production-ready
  • Limited to MySQL – no support for other databases
  • No built-in authentication or user management beyond MySQL credentials

Best For

Enabling LLM agents to safely query and modify MySQL databasesAutomating database management tasks through AI assistantsProviding a lightweight, deployable MCP server for MySQL without heavy dependenciesRunning read-only database analytics with safety guardrails

FAQ

What is go-mcp-mysql?
It is a Model Context Protocol (MCP) server written in Go that allows AI assistants (like Claude) to interact with MySQL databases. It provides tools for CRUD operations and schema management.
How do I install it?
You can download the latest precompiled binary from the GitHub Releases page, or install it from source using 'go install -v github.com/Zhwt/go-mcp-mysql@latest' (requires Go installed).
How do I configure it?
You can configure it via command-line arguments (--host, --user, --pass, --port, --db) or by using a DSN string with the --dsn flag. Optionally add --read-only for read-only mode or --with-explain-check to enable query plan validation.
What tools does it provide?
Schema tools: list_database, list_table, create_table, alter_table, desc_table. Data tools: read_query and write_query.
Is it production-ready?
The project is a work in progress and may not yet be ready for production use, as stated in the repository.