Skip to main content
KadiCache
Engineering Journal · Architecture9 min read1,851 wordsVerified 2026-11-23

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.

Developer terminal with scoped MCP OAuth connected through a security shield to synchronized WordPress agency sites
0.000 Layout Shift14 Sections✓ Verified
⚡ Executive Summary · 30-Second Spec100% Code-Verified
WP Admin Path
WP Admin -> KadiCache -> AI & MCP (5 Sub-Tabs) + KadiCache Pulse
Measured Impact
20 Typed MCP Tools · 15-Slot Atomic Checkpoints · 4 Permission Scopes
DevTools Proof Marker
McpCheckpoints::rollback() | OAuth 2.1 PKCE S256
  • 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)

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 AgentBlast Radius on HallucinationAutomatic 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)NoOnly if agent remembers flagLinux .bash_history only
WP Core Application PasswordFull Admin REST API (can delete pages/users)NoNoNone in WP Core
Unscoped Custom WebhookBroad plugin mutation without rollbackNoNoCustom logs required
KadiCache Native MCP (OAuth 2.1)Strictly Bounded to 4 Scopes & 20 Typed ToolsAutomatic (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.

FIG 011-Click MCP 2025-06-18 setup snippets for Claude Code, Cursor, VS Code, and Antigravity over Streamable HTTP.Zoom 2x

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): Allows get_status (returning 24h cookieless RUM lcp_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 10 kadicache:// 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 inside McpCheckpoints::create() before saving a single byte!
  • destructive (Human-in-the-Loop Approval Gate): Actions like bounded database cleanup (DatabaseCleanup::start()) or full reset require explicit destructive scope or an out-of-band human approval token (McpApprovals.php).
FIG 02SHA-256 hashed scoped tokens and OAuth 2.1 PKCE client grants with granular read, operate, and configure permissions.Zoom 2x

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:

PHP
// 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!

FIG 03Immutable MCP activity audit trail and 1-click configuration rollback snapshots.Zoom 2x

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):

BASH
# 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=30d

For 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):

JSON
{
  "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:

  1. Simulate first (Safe Mode) to confirm zero host or plugin conflicts.
  2. Apply configuration (automatically minting checkpoint cp_... with reason "Exclude new IG widget from lazy load & lock container").
  3. Run targeted Soft Purge (purge_cache with scope = "urls", mode = "soft") on /shop/ rather than wiping the entire 8,000-page catalog.
  4. Re-probe via diagnose_url to confirm X-KadiCache: HIT on both mobile and desktop representations.

Agency Governance Best Practices#

  • Give Junior Developers read or operate Tokens Only: Reserve configure tokens for senior performance engineers.
  • Rotate Tokens Every 30–90 Days: McpAuditLog.php records 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 at 4.4 ms TTFB.

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 GroupRequired ScopeRepresentative Tools & kadicache:// URIsExact Agency Use Case
Live Status & RUM (read)readget_status, kadicache://status/overview, kadicache://vitals/rum-24h, kadicache://vitals/rum-7dSpot p75 LCP/INP/CLS regressions and cache hit-ratio drops across 25 sites
URL & Conflict Diagnostics (read)readdiagnose_url, get_settings, inspect_database, kadicache://diagnostics/conflicts, kadicache://object-cache/autoloadProbe Desktop + Mobile headers, inspect top 15 bloated wp_options, detect plugin conflicts
Cache, Object & Preload Ops (operate)operatepurge_cache (soft/hard, all/urls), run_preload, flush_object_cache, get_preload_statusTrigger zero-downtime post-deploy Soft Purges and prioritized sitemap warmups
Guarded Config & Simulation (configure)configuresimulate_settings, update_settings, list_checkpoints, rollback_checkpoint, manage_cloudflarePreview changes in Safe Mode, apply exclusions with automatic cp_* snapshot, or 1-click undo
Database Hygiene & Approvals (destructive)destructiveclean_database (--dry-run or gated), get_approval_statusExecute 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:

YAML
# .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:

  1. 7-Day & 28-Day Cache Efficiency: Total requests served via advanced-cache.php (X-KadiCache: HIT) vs origin MySQL rebuilds saved.
  2. Mobile p75 Core Web Vitals Trajectory: Before-and-after lcp_p75, inp_p75, and cls_p75 across their top WooCommerce revenue URLs.
  3. Database & wp_options Health: Rows safely swept from wp_actionscheduler_logs and current autoloaded KB vs the 800 KB ceiling.
  4. 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?
Never. KadiCache MCP exposes strictly typed performance, diagnostic, cache, and database-hygiene tools defined in McpSchemaRegistry.php—never arbitrary SQL execution, PHP eval(), or post/order deletion! Even database cleanup requires explicit destructive scope approval.
What happens if an AI agent changes Delay JS or RUCSS settings and breaks a client header menu?
Before ANY configuration mutation executes, McpCheckpoints::create() automatically snapshots the entire current KadiCache settings array into a 15-slot lock-guarded ring buffer (cp_<12-hex>). You or Claude Code can restore the exact prior state in 1 second via rollback_checkpoint or WP Admin -> KadiCache -> AI & MCP -> Checkpoints & Audit Log.
How does OAuth 2.1 + PKCE differ from sharing a WordPress Application Password?
WordPress Application Passwords grant the full capabilities of your Administrator account across every REST endpoint on the site! KadiCache OAuth 2.1 + PKCE (McpOAuth.php) issues revocable, rate-limited tokens restricted strictly to KadiCache MCP tools and capped by 4 permission scopes (read, operate, configure, destructive).
How do agencies manage 25 client sites simultaneously instead of connecting one site at a time?
Pair client sites to KadiCache Pulse (/pulse) and mint a Fleet MCP token scoped to an explicit site allowlist—letting Claude Code audit 25 client stores in one prompt while keeping staging and VIP production scopes isolated.
Verified WordPress Architecture · Architecture
Apply these exact optimizations on your WordPress or WooCommerce site in 2 minutes.
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

Integrations/Mcp/McpServer.phpIntegrations/Mcp/McpCatalog.phpIntegrations/Mcp/McpCheckpoints.phpIntegrations/Mcp/McpOAuth.phpCli/McpCli.php
Connected Topical Cluster · Continue Deepening Your Setup