# MySQL MCP Server Setup Deployed Jul 7, 2026 on Core. Connects Hermes to MariaDB on wphost02. ## Architecture ``` Hermes → MCP mysql_query → Python stdio MCP server → autossh tunnel → wphost02:3306 ``` ## Components ### 1. Persistent SSH Tunnel (autossh) `/etc/systemd/system/mysql-tunnel.service` — connects 127.0.0.1:33060 → wphost02:3306 ### 2. MCP Server `/root/.hermes/scripts/mcp-mysql.py` — reads env vars, speaks JSON-RPC 2.0 over stdio. Single tool: `mysql_query(sql)` which returns JSON. ### 3. Database Connection Issues (MariaDB 11.1) - **SSL disabled:** MariaDB doesn't support SSL. Use `--skip-ssl` or `ssl_disabled=True` - **Collation:** Must set `charset="utf8mb4"` and `collation="utf8mb4_general_ci"` — MariaDB doesn't support `utf8mb4_0900_ai_ci` - **Initial attempt:** npm MCP servers fail with MySQL/MariaDB due to protocol/handshake quirks. Custom Python server was necessary. ### 4. Config Stored in `~/.hermes/config.yaml` under `mcp.mysql`. Enabled by default.