# MainWP Dashboard

Central WordPress management tool running on kaburusvr.uk. Manages 24 client sites.

## Deployment

- Host: kaburusvr.uk (Hetzner) - Path: `/home/kaburusvr.uk/public_html/wp-content/plugins/mainwp` - Dashboard URL: `https://kaburusvr.uk/wp-admin/admin.php?page=mainwp_tab` - Child plugin: installed on every managed site

## MCP Integration

Location: `/usr/local/bin/kaburu-shell-mcp-mainwp.py`

Runs raw SQL queries against the MainWP database (`wpfm_*` tables) via SSH + WP-CLI. Read-only — no write operations.

### Available Tools

Tool Query Purpose
————-———
`mainwp_sites` `wpfm_mainwp_wp` + `wpfm_mainwp_wp_sync` List all sites, versions, sync times
`mainwp_updates_available` `wpfm_mainwp_wp` plugin_upgrades/theme_upgrades Sites with pending plugin/theme updates
`mainwp_lighthouse_scores` `wpfm_mainwp_lighthouse` Lighthouse scores for all sites
`mainwp_lighthouse_site` `wpfm_mainwp_lighthouse` filtered Scores for one site
`mainwp_lighthouse_underperforming` `wpfm_mainwp_lighthouse` filtered Sites below threshold
`mainwp_uptime_status` `wpfm_mainwp_monitors` Uptime monitor status
`mainwp_wordfence_issues` `wpfm_mainwp_wordfence` Wordfence scan/attack data

### ⚠️ Critical: Column Name Dependency

The MCP queries reference MainWP database columns by name. When the MainWP plugin is updated, column names or data types can change silently. If tools return `(no results)` or SQL errors after an update, check:

1. Column name changes: Compare MCP SQL against `wp –allow-root db query “DESCRIBE wpfm_mainwp_<table>“` on kaburusvr 2. Data type changes: `plugin_upgrades` and `theme_upgrades` are JSON `longtext`, NOT integers. Queries using `> 0` will fail. Use `!= '' AND != '[]'` instead. 3. Table rename: Monitor table uses `m.last_status` not `m.status`, `m.lasttime_check` not `m.last_check`, `m.wpid` not `m.site_id`

### Fix History

2026-07-09: MainWP 5→6 update broke three queries: - `mainwp_updates_available`: JSON columns compared with `> 0` (fixed to `!= '' AND != '[]'`) - `mainwp_uptime_status`: Wrong column names (`status`→`last_status`, `last_check`→`lasttime_check`, `site_id`→`wpid`) - Discovery: read-only by design — no Lighthouse trigger exists. Scans run from the dashboard only.

## ⚠️ Never Use Root CLI

MainWP is managed through the dashboard or the MCP tools above. Never SSH as root to run WP-CLI updates — it resets file ownership and breaks the dashboard. See CLAUDE.md for the full rule.