Claude Code & MCP for 25 WordPress Agency Sites
Connect Claude Code and Cursor to 25+ client WordPress sites via KadiCache MCP OAuth 2.1, Safe Mode simulation, and 1-click checkpoints.

- Logging into 25 separate
/wp-admin/dashboards after Tuesday plugin updates to inspect cache hit rates, RUM p75 regressions, and broken CSS wastes 6+ engineering hours every week. - Giving an AI agent raw SSH root credentials or unrestricted WordPress Application Passwords is an unacceptable agency security risk—one hallucinated command could drop tables or wipe settings.
- KadiCache embeds a native Model Context Protocol (MCP) server (
McpServer.php) with OAuth 2.1 + PKCE, 4 granular scopes (read,operate,configure,destructive), Safe Mode dry-run simulation, and 15-slot pre-mutation checkpoints (cp_<12-hex>) for instant 1-click rollback.
Table of Contents (14 sections)
- Why Generic SSH / REST Access Is Unsafe for AI Fleet Maintenance
- Architecture of KadiCache's Native OAuth 2.1 MCP Server
- 1. Four Strict Permission Scopes (read -> operate -> configure -> destructive)
- 2. Safe Mode Sandbox Simulation (McpSimulator.php)
- 3. Automatic 15-Slot Ring-Buffer Checkpoints (McpCheckpoints.php)
- Step-by-Step Playbook: Wiring Claude Code to a 25-Site Agency Portfolio
- Step 1: Connect Individual VIP Stores (OAuth 2.1) or Multi-Site Fleet (/pulse)
- Step 2: Run the Monday Morning 25-Site Health & CrUX RUM Audit in 45 Seconds
- Step 3: Simulate, Apply With Checkpoint, Re-Probe, and Verify
- Agency Governance Best Practices
- Inside KadiCache's 20 MCP Tools, 10 Telemetry Resources & 5 Guided Prompts
- Automating Post-Deploy Cache Warmup & Regression Checks in GitHub Actions
- Handling Multisite Networks Safely Over MCP (NetworkLifecycle.php)
- Generating Monthly Executive Performance Reports for Retainer Clients
Connecting Claude Code, Cursor, or VS Code to 25 client WordPress sites used to force agency leads into an ugly trade-off: either waste every Tuesday morning manually clicking through 25 /wp-admin/ dashboards, or hand an AI coding agent raw SSH/WP-CLI root access and pray it never hallucinates a destructive command on a $2M/year WooCommerce store.
Why Generic SSH / REST Access Is Unsafe for AI Fleet Maintenance#
Large language models excel at correlating HTTP headers, reading RumHistogram p75 regressions, and spotting why a new marketing script slowed mobile LCP—yet general-purpose shell or WordPress REST credentials violate the Principle of Least Privilege in four ways:
| Access Mechanism Given to AI Agent | Blast Radius on Hallucination | Automatic Pre-Change Snapshot? | Dry-Run Simulation? | Per-Action Audit Trail? |
|---|---|---|---|---|
Raw SSH + wp-cli (wp db query) | Total (can drop tables or edit PHP files) | No | Only if agent remembers flag | Linux .bash_history only |
| WP Core Application Password | Full Admin REST API (can delete pages/users) | No | No | None in WP Core |
| Unscoped Custom Webhook | Broad plugin mutation without rollback | No | No | Custom logs required |
KadiCache Native MCP (OAuth 2.1) | Strictly Bounded to 4 Scopes & 20 Typed Tools | Automatic (cp_<12-hex>) | Built-in Safe Mode (McpSimulator) | Immutable McpAuditLog.php |
That architectural gap is why we built a first-party Model Context Protocol (MCP) server directly into KadiCache (Integrations/Mcp/McpServer.php, McpCatalog.php, McpOAuth.php, and McpCheckpoints.php) paired with centralized multi-site orchestration inside KadiCache Pulse.
Architecture of KadiCache's Native OAuth 2.1 MCP Server#
Open WP Admin -> KadiCache -> AI & MCP on any WordPress install and you will find five dedicated operational sub-tabs: Connect & Quick Setup, Access & Scoped Tokens, Tools & Resources Catalog, Checkpoints & Audit Log, and Chat UI Preview.
1. Four Strict Permission Scopes (read -> operate -> configure -> destructive)#
Every OAuth 2.1 grant or scoped Bearer token minted in McpOAuth.php / McpTokenStore.php enforces a hard permission ceiling before any tool handler in McpCatalog.php executes:
read(Zero-Mutation Telemetry & Diagnostics): Allowsget_status(returning 24h cookieless RUMlcp_p75,inp_p75,cls_p75,ttfb_p75,hit_ratio_pct, Object Cache metrics, and active conflicts),diagnose_url(PageDiagnostic::inspect()),get_settings,get_preload_status,inspect_database, and reading all 10kadicache://telemetry resources. Ideal for junior analysts or automated morning Slack digests!
operate(Safe Cache & Preload Operations): Adds non-configuration operational actions: soft/hard URL cache purges (purge_cache), triggering sitemap warmup (run_preload), and flushing Object Cache epochs.
configure(Guarded Settings Tuning With Mandatory Checkpoints): Allows modifying optimization settings (such as adding a selector to Delay JS exclusions or toggling Local Google Fonts)—automatically creating an atomic rollback checkpoint insideMcpCheckpoints::create()before saving a single byte!
destructive(Human-in-the-Loop Approval Gate): Actions like bounded database cleanup (DatabaseCleanup::start()) or full reset require explicitdestructivescope or an out-of-band human approval token (McpApprovals.php).
2. Safe Mode Sandbox Simulation (McpSimulator.php)#
Before applying any setting change on a live client store, Claude Code can invoke dry-run simulation mode. KadiCache validates every setting key against SettingsRuleValidator.php, checks host capability locks (HostCapabilities.php) and Multisite network governance (NetworkLifecycle::SHARED), previews which caches would be invalidated, and reports potential script/plugin conflicts—without mutating wp_options or clearing live cached HTML.
3. Automatic 15-Slot Ring-Buffer Checkpoints (McpCheckpoints.php)#
Look at Integrations/Mcp/McpCheckpoints.php (lines 16–114) in KadiCache Free Core:
// Verified atomic snapshot pattern from KadiCache\Integrations\Mcp\McpCheckpoints::create()
$snapshot = Settings::configured();
$id = 'cp_' . bin2hex(random_bytes(6));
$record = [
'id' => $id,
'created_at' => time(),
'reason' => substr(sanitize_text_field($reason), 0, 120),
'actor_label' => substr(sanitize_text_field((string) ($auth['label'] ?? 'MCP')), 0, 80),
'changed_keys' => array_slice(array_values(array_map('strval', $changedKeys)), 0, 50),
'settings' => $snapshot,
];Every time an MCP client modifies a setting, McpCheckpoints acquires an atomic lock (McpTokenStore::withLock()), prepends the full pre-change configuration snapshot (cp_a1b2c3d4e5f6) into the 15-checkpoint ring buffer (MAX_CHECKPOINTS = 15), and records the actor label and exact changed_keys. If a client emails saying "Hey, our custom HubSpot popup stopped animating," you restore the exact prior state in under 1 second—either by telling Claude "Roll back to checkpoint cp_a1b2c3d4e5f6" or clicking Rollback inside WP Admin!
Step-by-Step Playbook: Wiring Claude Code to a 25-Site Agency Portfolio#
Here is the exact workflow our agency partners run every week (documented in full inside our 20-Tool AI MCP & Pulse guide):
Step 1: Connect Individual VIP Stores (OAuth 2.1) or Multi-Site Fleet (/pulse)#
For a standalone store, copy the MCP endpoint from WP Admin -> KadiCache -> AI & MCP -> Connect & Quick Setup (or mint a scoped token via WP-CLI in Cli/McpCli.php):
# Mint a read+operate+configure token via WP-CLI for CI/CD or Claude Code
wp kadicache mcp token create --label="Claude-Agency-Ops" --scope=configure --expires=30dFor 25 client sites at once, pair each client site to KadiCache Pulse and add the Fleet MCP server entry inside your local .mcp.json (or claude mcp add):
{
"mcpServers": {
"kadicache-agency-fleet": {
"type": "http",
"url": "https://kadicache.com/api/mcp/fleet",
"headers": {
"Authorization": "Bearer kc_mcp_live_scoped_token_here"
}
}
}
}Step 2: Run the Monday Morning 25-Site Health & CrUX RUM Audit in 45 Seconds#
Instead of opening 25 browser tabs, run one structured prompt inside Claude Code:
“Check 24h RUM p75 metrics, cache hit ratios, Early Drop-In status, and autoloaded wp_options health across all 25 sites in kadicache-agency-fleet. Flag any store where mobile LCP p75 > 2,200 ms, INP p75 > 180 ms, CLS p75 > 0.05, or cache hit ratio < 85%, and diagnose the top offending URL on each flagged site.”
Claude Code calls get_status across your allowed sites in parallel, spots that Client #14 (Boutique Apparel) installed a new Instagram carousel plugin on Friday that pushed /shop/ CLS to 0.14, calls diagnose_url on https://client14.com/shop/, and presents the exact culprit selector—before the client's 28-day Google Search Console CrUX report even turns yellow!
Step 3: Simulate, Apply With Checkpoint, Re-Probe, and Verify#
When you approve a fix on Client #14, enforce this four-step agency SOP:
- Simulate first (
Safe Mode) to confirm zero host or plugin conflicts. - Apply configuration (automatically minting checkpoint
cp_...with reason"Exclude new IG widget from lazy load & lock container"). - Run targeted Soft Purge (
purge_cachewithscope = "urls",mode = "soft") on/shop/rather than wiping the entire 8,000-page catalog. - Re-probe via
diagnose_urlto confirmX-KadiCache: HITon both mobile and desktop representations.
Agency Governance Best Practices#
- Give Junior Developers
readoroperateTokens Only: Reserveconfiguretokens for senior performance engineers. - Rotate Tokens Every 30–90 Days:
McpAuditLog.phprecords every tool call, scope check, IP hash, and timestamp so client compliance audits take two clicks (wp kadicache mcp audit --limit=50). - Never Wipe Full Site Caches During Peak Ad Hours: Teach your team and AI prompts to default to
mode: "soft"URL purges so origin CPU stays flat at4.4 msTTFB.
Inside KadiCache's 20 MCP Tools, 10 Telemetry Resources & 5 Guided Prompts#
Unlike generic REST wrappers that dump raw 400 KB JSON option blobs into your AI context window (burning tokens and confusing tool calls), Integrations/Mcp/Catalog/McpSchemaRegistry.php and McpReportFormatter.php expose concise, strongly typed domain primitives purpose-built for Claude Code, Cursor, and Antigravity:
| MCP Capability Group | Required Scope | Representative Tools & kadicache:// URIs | Exact Agency Use Case |
|---|---|---|---|
Live Status & RUM (read) | read | get_status, kadicache://status/overview, kadicache://vitals/rum-24h, kadicache://vitals/rum-7d | Spot p75 LCP/INP/CLS regressions and cache hit-ratio drops across 25 sites |
URL & Conflict Diagnostics (read) | read | diagnose_url, get_settings, inspect_database, kadicache://diagnostics/conflicts, kadicache://object-cache/autoload | Probe Desktop + Mobile headers, inspect top 15 bloated wp_options, detect plugin conflicts |
Cache, Object & Preload Ops (operate) | operate | purge_cache (soft/hard, all/urls), run_preload, flush_object_cache, get_preload_status | Trigger zero-downtime post-deploy Soft Purges and prioritized sitemap warmups |
Guarded Config & Simulation (configure) | configure | simulate_settings, update_settings, list_checkpoints, rollback_checkpoint, manage_cloudflare | Preview changes in Safe Mode, apply exclusions with automatic cp_* snapshot, or 1-click undo |
Database Hygiene & Approvals (destructive) | destructive | clean_database (--dry-run or gated), get_approval_status | Execute bounded revisions/transients/Action Scheduler sweeps with human sign-off |
Automating Post-Deploy Cache Warmup & Regression Checks in GitHub Actions#
Agencies deploying client theme updates via GitHub Actions or GitLab CI can combine wp kadicache CLI commands (Cli/CacheCli.php & Cli/McpCli.php) with MCP health checks so broken CSS or accidental cache bypasses are caught within 30 seconds of deployment:
# .github/workflows/post-deploy-kadicache-verify.yml
name: Post-Deploy Soft Purge & Cache HIT Verification
on:
workflow_dispatch:
push:
branches: [main]
jobs:
verify-edge-and-early-cache:
runs-on: ubuntu-latest
steps:
- name: Trigger Nonce-Safe Soft Purge & Priority Sitemap Preload via SSH
run: |
ssh deploy@${{ secrets.PROD_HOST }} "
cd /var/www/html &&
wp kadicache purge --mode=soft &&
wp kadicache preload start &&
wp kadicache object-cache status --format=json
"
- name: Assert Anonymous Homepage & Top Product Return X-KadiCache HIT
run: |
curl -fsSI https://clientstore.com/ >/dev/null
HEADERS=$(curl -fsSI https://clientstore.com/)
echo "$HEADERS" | grep -iq "x-kadicache: hit"Look at how clean that CI/CD loop is: zero dropped visitor requests during deployment (--mode=soft serves verified STALE HTML for up to 60 seconds while fresh templates warm in the background), immediate sitemap priority warmup, and an automated assertion that fails the pipeline instantly if a rogue plugin called session_start() and broke page caching!
Handling Multisite Networks Safely Over MCP (NetworkLifecycle.php)#
If several of your 25 client properties live inside a WordPress Multisite network (for example, a university with 18 department subsites or a franchise brand with 30 regional stores), McpCheckpoints::rollback() and McpServer.php automatically enforce NetworkLifecycle::SHARED boundaries—preventing a subsite-scoped token from mutating network-owned Cloudflare credentials or shared early_cache_enabled drop-in policies!
Generating Monthly Executive Performance Reports for Retainer Clients#
Retainer clients rarely renew $350/month care plans just because you say "we updated 11 plugins." They renew enthusiastically when they receive a concise monthly proof card showing real business outcomes pulled straight from KadiCache MCP resources:
- 7-Day & 28-Day Cache Efficiency: Total requests served via
advanced-cache.php(X-KadiCache: HIT) vs origin MySQL rebuilds saved. - Mobile
p75Core Web Vitals Trajectory: Before-and-afterlcp_p75,inp_p75, andcls_p75across their top WooCommerce revenue URLs. - Database &
wp_optionsHealth: Rows safely swept fromwp_actionscheduler_logsand current autoloaded KB vs the800 KBceiling. - Verified Change Ledger: Every configuration adjustment logged with actor name, timestamp, and checkpoint ID inside
McpAuditLog.php.
Ask Claude Code once at the end of every month to compile those four read-scoped MCP resources into a clean Markdown summary per client, and a four-hour manual reporting chore collapses into two minutes.
When an employee leaves your agency or a project contract ends, open WP Admin -> KadiCache -> AI & MCP -> Access & Scoped Tokens (or KadiCache Pulse -> Fleet Tokens) and revoke that single named OAuth 2.1 / Bearer grant in one click. Every remaining engineer, CI/CD runner, and client administrator keeps working uninterrupted with zero shared-password resets across your 25 WordPress installs.
Frequently Asked Engineering Questions
Can Claude Code or Cursor accidentally delete posts, plugins, or WooCommerce orders through KadiCache MCP?
What happens if an AI agent changes Delay JS or RUCSS settings and breaks a client header menu?
How does OAuth 2.1 + PKCE differ from sharing a WordPress Application Password?
How do agencies manage 25 client sites simultaneously instead of connecting one site at a time?
Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.
Connect Claude, Cursor, and VS Code with OAuth 2.1 scopes and atomic checkpoints.
Complete reference for all 21 MCP tools, 11 resources, 6 prompts, and CLI flags.
Mint scoped MCP tokens, inspect audit logs, and roll back checkpoints over SSH.
See why KadiCache is the first WordPress performance engine with native OAuth 2.1 MCP.