go-mcp-mysql
Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed.
Documentation
go-mcp-mysql
Overview
Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed. This server provides tools to do CRUD operations on MySQL databases and tables, and a read-only mode to prevent surprise write operations. You can also make the MCP server check the query plan by using a `EXPLAIN` statement before executing the query by adding a `--with-explain-check` flag.
Please note that this is a work in progress and may not yet be ready for production use.
Installation
1. Get the latest release and put it in your `$PATH` or somewhere you can easily access.
2. Or if you have Go installed, you can build it from source:
go install -v github.com/Zhwt/go-mcp-mysql@latestUsage
Method A: Using Command Line Arguments
{
"mcpServers": {
"mysql": {
"command": "go-mcp-mysql",
"args": [
"--host", "localhost",
"--user", "root",
"--pass", "password",
"--port", "3306",
"--db", "mydb"
]
}
}
}Method B: Using DSN With Custom Options
{
"mcpServers": {
"mysql": {
"command": "go-mcp-mysql",
"args": [
"--dsn", "username:password@tcp(localhost:3306)/mydb?parseTime=true&loc=Local"
]
}
}
}Please refer to MySQL DSN for more details.
Note: For those who put the binary outside of your `$PATH`, you need to replace `go-mcp-mysql` with the full path to the binary: e.g.: if you put the binary in the Downloads folder, you may use the following path:
{
"mcpServers": {
"mysql": {
"command": "C:\\Users\\\\Downloads\\go-mcp-mysql.exe",
"args": [
...
]
}
}
}Optional Flags
- Add a `--read-only` flag to enable read-only mode. In this mode, only tools beginning with `list`, `read_` and `desc_` are available. Make sure to refresh/restart the MCP server after adding this flag.
- By default, CRUD queries will be first executed with a `EXPLAIN ?` statement to check whether the generated query plan matches the expected pattern. Add a `--with-explain-check` flag to disable this behavior.
Tools
Schema Tools
1. `list_database`
2. `list_table`
3. `create_table`
4. `alter_table`
5. `desc_table`
Data Tools
1. `read_query`
2. `write_query`
3. `update_query`
4. `delete_query`
License
MIT
Frequently asked questions
What is go-mcp-mysql?
go-mcp-mysql is Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed.
How do I install go-mcp-mysql?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is go-mcp-mysql open source?
Yes — it is hosted on GitHub at https://github.com/Zhwt/go-mcp-mysql and has 46 stars.
Related MCP tools
Self-hosted MCP Gateway and Registry for AI agents Go-based implementation. Trusted by 600+ developers. Trusted by 600+ developers.
Lunar.dev: Ground Control for 3rd Party APIs for the Model Context Protocol. Enhance AI assistants with powerful integrations. Go-based implementation.
MCP Aggregator, Orchestrator, Middleware, Gateway in one docker TypeScript-based implementation. Trusted by 1400+ developers.
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases Python-based implementation. Trusted by 900+ developers.
Query anything (GitHub, Notion, +40 more) with SQL and let LLMs (ChatGPT, Claude) connect to using MCP Go-based implementation. Trusted by 1300+ developers.
ToolHive makes deploying MCP servers easy, secure and fun Go-based implementation. Trusted by 1300+ developers. Trusted by 1300+ developers.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP