The MySQL Integration with Model Context Protocol Server is a zero-burden, ready-to-use MCP server designed for interacting with MySQL databases and automation. It eliminates the need for Node.js or Python environments, providing tools for CRUD operations and a read-only mode to prevent unintended write operations. The server can also check query plans using the EXPLAIN
statement before executing queries by adding the --with-explain-check
flag.
Note: This project is a work in progress and may not yet be ready for production use.
$PATH
or an accessible location.shell
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"
]
}
}
}
For more details, refer to MySQL DSN.
Note: If the binary is outside your
$PATH
, replacego-mcp-mysql
with the full path to the binary.
--read-only
to enable read-only mode. Only tools like list
, read_
, and desc_
will be available.--with-explain-check
to disable the default behavior of checking query plans with EXPLAIN
.list_database
Returns: A list of database names.
list_table
name
(optional) – Filters tables by name.Returns: A list of matching table names.
create_table
query
– The SQL query to create the table.Returns: Number of rows affected.
alter_table
query
– The SQL query to alter the table.Returns: Number of rows affected.
desc_table
name
– The name of the table to describe.read_query
query
– The SQL query to execute.Returns: The query result.
write_query
query
– The SQL query to execute.Returns: Number of rows affected and last insert ID.
update_query
query
– The SQL query to execute.Returns: Number of rows affected.
delete_query
query
– The SQL query to execute.This project is licensed under the MIT License.
The MySQL Integration with Model Context Protocol Server is a lightweight, easy-to-use solution for MySQL database interaction and automation. It is designed to be zero-burden and does not require Node.js or Python environments.