Mysql Aiops
Governed MySQL/MariaDB DBA ops: slow-query, lock-wait, replication & fragmentation RCA; 35 tools.
- Transport
- Not stated
- Package
- —
- Registry id
- io.github.AIops-tools/mysql-aiops
No install snippet on purpose. A working MCP config is a command, its arguments and an environment block — the last two are where API keys live, so this catalogue never stores them and cannot publish them. Follow the link above for the authors' own instructions.
Disclaimer: Community-maintained open-source project. Not affiliated with, endorsed by, or sponsored by Oracle Corporation or the MariaDB Foundation. "MySQL" is a trademark of Oracle Corporation; "MariaDB" is a trademark of MariaDB plc; all product/trademark names belong to their respective owners. MIT licensed.
Governed AI-ops for MySQL 8.x and MariaDB 10.6+ DBA operations — connecting
to a server with PyMySQL and reading information_schema /
performance_schema — with a built-in governance harness: unified audit
log, token/runaway budget guard, undo-token recording, and descriptive
risk-tier labels. The server flavor (mysql vs mariadb) is
detected from version() and flavor-dependent statements branch automatically
(SHOW REPLICA STATUS vs SHOW SLAVE STATUS).
What it does
Four flagship signature analyses, plus the guarded reads and writes around them:
- Slow-query RCA — take the worst
events_statements_summary_by_digestentry (plus an optionalEXPLAIN FORMAT=JSONplan) and map its numbers — no-index share (SUM_NO_INDEX_USED), lock-time share, rows-examined/sent ratio, tmp-disk spill, call count, plan access types — to a cited cause and a concrete action. Every finding carries its measured number, not a black-box verdict. - InnoDB lock-wait & deadlock chain RCA — build the wait-for tree from
performance_schema.data_lock_waits(MariaDB:information_schema.innodb_lock_waits), name the root blocker (blocks others, waits on none), and parse the last deadlock out ofSHOW ENGINE INNODB STATUS. - Replication lag RCA — map the replica's IO/SQL thread state,
Seconds_Behind_Sourceand error fields to a cited cause + action (stopped IO thread, failed applier statement, lagging applier, intentionalSQL_Delay). - Table fragmentation analysis — rank tables by reclaimable
data_freefrominformation_schema.tablesinto citedOPTIMIZE TABLEcandidates.
What works
- CLI (
mysql-aiops ...):init,overview,server,activity,query,index,table,repl,analyze,remediate,secret,doctor,mcp. - MCP server (
mysql-aiops mcpormysql-aiops-mcp): 35 tools (26 read, 9 write), every one wrapped with the bundled@governed_toolharness. - Encrypted credentials: the account password lives in an encrypted store
~/.mysql-aiops/secrets.enc(Fernet + scrypt) — never plaintext on disk. Unlock with a master password fromMYSQL_AIOPS_MASTER_PASSWORD(MCP/CI) or an interactive prompt (CLI). - Reversibility: mutating writes fetch the real before-state first and record a faithful inverse —
create_index↔drop_index;drop_indexcaptures the index definition out ofSHOW CREATE TABLEso undo recreates it exactly;set_global_variablecaptures the prior value fromSHOW GLOBAL VARIABLESso undo sets it back. Irreversible ops (kill_session,kill_query,optimize_table,analyze_table,reset_query_stats) record prior state for audit but declare no undo. - Safety: every state-changing CLI op supports
--dry-runand requires double confirmation; every write MCP tool takes adry_runpreview. All identifiers that cannot be parameterised (schema/table/index/column/variable names) are validated against a strict charset and backtick-quoted; all values are bound query parameters.
What this tool does, and does not, decide
It delivers MySQL / MariaDB DBA operations — reads and writes — accurately and efficiently, and records every one of them. It does not decide whether a write is allowed to happen. That is the agent's judgement, or the permission of the account you connect it with: point it at a MySQL/MariaDB account granted only SELECT / PROCESS / REPLICATION CLIENT and no write privileges (no INSERT/UPDATE/DELETE/DDL), and the writes fail at the server — the place that actually owns the permission.
From the project's README.