Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed.
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.
Get the latest release and put it in your $PATH
or somewhere you can easily access.
Or if you have Go installed, you can build it from source:
go install -v github.com/Zhwt/go-mcp-mysql@latest
{
"mcpServers": {
"mysql": {
"command": "go-mcp-mysql",
"args": [
"--host", "localhost",
"--user", "root",
"--pass", "password",
"--port", "3306",
"--db", "mydb"
]
}
}
}
{
"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\\<username>\\Downloads\\go-mcp-mysql.exe",
"args": [
...
]
}
}
}
--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.EXPLAIN ?
statement to check whether the generated query plan matches the expected pattern. Add a --with-explain-check
flag to disable this behavior.list_database
list_table
name
: If provided, list tables with the specified name, same as SQL SHOW TABLES LIKE '%name%'
. Otherwise, list all tables.create_table
query
: The SQL query to create the table.alter_table
query
: The SQL query to alter the table.desc_table
name
: The name of the table to describe.read_query
query
: The SQL query to execute.write_query
query
: The SQL query to execute.update_query
query
: The SQL query to execute.delete_query
query
: The SQL query to execute.MIT