Loading...

A ready-to-use Model Context Protocol (MCP) server for interacting with MySQL databases, supporting CRUD operations and read-only modes.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
A ready-to-use Model Context Protocol (MCP) server for interacting with MySQL databases, supporting CRUD operations and read-only modes.
This MCP server offers a balance between functionality and risk. The read-only mode and explain check provide some safety, but the ability to execute arbitrary write queries and the handling of credentials require careful management and oversight. It is safest when used in read-only mode with trusted queries, and riskiest when write access is enabled without proper input validation.
Performance will depend on the complexity of the SQL queries and the size of the database. Consider indexing frequently queried columns to improve read performance.
The primary cost consideration is the resource usage of the MySQL server itself. Complex queries can consume significant CPU and memory.
{
"mcpServers": {
"mysql": {
"command": "go-mcp-mysql",
"args": [
"--host", "localhost",
"--user", "root",
"--pass", "password",
"--port", "3306",
"--db", "mydb"
]
}
}
}list_databaseLists all databases available on the MySQL server.
Read-only operation, no data modification.
list_tableLists tables in the MySQL server, optionally filtered by name.
Read-only operation, no data modification.
create_tableCreates a new table in the MySQL server using a provided SQL query.
Modifies the database schema, potentially causing disruption.
alter_tableAlters an existing table in the MySQL server using a provided SQL query.
Modifies the database schema, potentially causing disruption.
desc_tableDescribes the structure of a specified table.
Read-only operation, no data modification.
read_queryExecutes a read-only SQL query against the database.
Read-only operation, no data modification.
write_queryExecutes a write SQL query against the database.
Modifies data in the database.
update_queryExecutes an update SQL query against the database.
Modifies data in the database.
delete_queryExecutes a delete SQL query against the database.
Deletes data from the database.
None
This MCP server offers a balance between functionality and risk. The read-only mode and explain check provide some safety, but the ability to execute arbitrary write queries and the handling of credentials require careful management and oversight. It is safest when used in read-only mode with trusted queries, and riskiest when write access is enabled without proper input validation.
The server defaults to read and write access, giving the LLM full control over the database unless the `--read-only` flag is enabled. There is no built-in sandboxing or rollback mechanism, so caution is advised.
Production Tip
Enable the `--read-only` flag in production environments to prevent accidental data modification, and carefully monitor query execution.
Add the `--read-only` flag to the command-line arguments when starting the server.
Use either command-line arguments (`--host`, `--user`, `--pass`, `--port`, `--db`) or a DSN string via the `--dsn` flag.
The server will likely return an error message from the underlying MySQL driver.
The documentation does not explicitly mention connection pooling; it may or may not be implemented.
Download the latest release from GitHub or use `go install -v github.com/Zhwt/go-mcp-mysql@latest`.
Authentication is handled through the MySQL database credentials; there is no separate authentication layer for the MCP server itself.
Yes, as long as the server has network access to the remote database and the appropriate connection details are provided.