A minimal Model Context Protocol (MCP) server for read-only MySQL queries.
- Copy the config template and edit it:
cp config.example.toml config.toml- Ensure
mysql.dsnuses a read-only MySQL account.
go run . -config config.tomlmysql_query- Input:
{ "query": "SELECT ..." } - Output:
{ "columns": [...], "rows": [...], "rowCount": 3, "truncated": false }
- Input:
- Only
SELECT,SHOW,DESCRIBE, andEXPLAINstatements are allowed by default. - The server enforces a read-only transaction and rejects queries containing semicolons.
- Use
deny_substringsin TOML to block edge-case write/lock clauses. - Configure row limits and timeouts via TOML.