Get the FREE Ultimate OpenClaw Setup Guide →

go -mysql

Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio zhwt-go-mcp-mysql go-mcp-mysql --host localhost --user root --pass password --port 3306 --db mydb

How to use

This MCP server provides a set of tools to interact with a MySQL server through a Model Context Protocol interface. It supports CRUD operations on databases and tables, as well as read-only mode to prevent unintended writes. You can optionally enable an explain check so that the server runs an EXPLAIN on each write operation to validate the generated query plan before executing it. Use the available schema tools to inspect and modify database schemas, and data tools to read or modify data in a controlled way. The server is designed to be lightweight and self-contained, requiring no Node.js or Python environment since it’s implemented in Go.

How to install

Prerequisites:

  • Go or a pre-built binary is available in your environment.
  • Access to the MySQL server you want to manage.

Installation steps:

  1. Release binary approach:
# Download the latest release and place it in a directory in your PATH
# Example path adjustment may be required for your OS
# After downloading, ensure the binary is executable and accessible via your shell
  1. Build from source (requires Go):
# Install the latest version from GitHub
go install -v github.com/Zhwt/go-mcp-mysql@latest
  1. Verify installation:
# Ensure the binary is available in PATH
which go-mcp-mysql
# Or check version/help
go-mcp-mysql --help
  1. Run with your desired configuration (example shown in the README):
# Using the example configuration from the README
# You can run the server directly or wire it into your MCP orchestration.

Additional notes

Notes and tips:

  • The server supports a read-only mode via the --read-only flag. In read-only mode, only list, read_, and desc_ tools are available.
  • By default, CRUD queries are executed with an EXPLAIN check for safety. Use --with-explain-check to disable this behavior.
  • If you place the binary outside of your PATH, specify the full path to the executable in the command field, as shown in the README's example for a local path.
  • You can choose between using command-line arguments or a DSN string to configure the connection to MySQL (see the DSN example in the README).
  • Ensure network access and proper permissions for the user account to perform the desired operations on the MySQL server.

Related MCP Servers

Sponsor this space

Reach thousands of developers