Windsurf Cascade + WordPress

Connect Windsurf Cascade to WordPress.

Add WPGuard to Windsurf’s MCP configuration, secure your bearer token in your environment, and give Cascade a reviewable path from site inspection to verified WordPress updates.

Self-hosted · Streamable HTTP · Global or workspace MCP configuration

How do I add a WordPress MCP server to Windsurf?

Declare WPGuard in Windsurf’s configuration file using the native Streamable HTTP format and authenticate with a scoped bearer token.

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "wpguard": {
      "serverUrl": "http://127.0.0.1:8642/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_WPGUARD_TOKEN>"
      }
    }
  }
}

Locate your Windsurf configuration

Windsurf stores global MCP configuration at ~/.codeium/windsurf/mcp_config.json on macOS and Linux, or %USERPROFILE%\.codeium\windsurf\mcp_config.json on Windows. Windsurf reads this file on initialization to register active server tools into Cascade’s workspace context.

Use the Streamable HTTP serverUrl property

Unlike stdio servers that execute local binary processes for every conversation, WPGuard runs as a dedicated daemon over Streamable HTTP. Windsurf requires the serverUrl attribute and a nested headers object containing the required Authorization string.

Keep tokens private

WPGuard enforces token authentication on every tool call. If the Authorization: Bearer header is missing or invalid, the server responds immediately with HTTP 401 Unauthorized. Keep your token in private workstation files rather than committing configuration into shared repositories.

Network reachability and loopback

When Windsurf and WPGuard run on the same physical machine, binding to 127.0.0.1:8642 provides zero-latency, private communication. If WPGuard is hosted on a remote server, connect through an SSH tunnel or Tailscale network rather than exposing unencrypted HTTP over the public internet.

Select the right token scope for Cascade.

WPGuard enforces three distinct permission tiers. Match the token scope to the specific task you want Windsurf to perform.

Recon scope (WPGUARD_TOKEN_RECON)

Ideal for read-only audits, SEO reviews, and discovery. Cascade can query registered sites with site_list, inspect active themes and plugins with wp_site_context, read stored post content, and inspect metadata. It cannot write changes or approve modification packets.

Mutate scope (WPGUARD_TOKEN_MUTATE)

The standard operational tier for daily content and settings updates. Cascade can generate preview packets, run automated correction checks, and apply approved mutations to posts, pages, and options. It cannot execute arbitrary PHP code or run raw WP-CLI shell commands.

Admin scope (WPGUARD_TOKEN_ADMIN)

Reserved for administrative site setup, registering new WordPress connections, creating persistent correction rules, and running privileged diagnostics. Use admin tokens only when setting up infrastructure or defining client policies.

Instance-wide isolation

Tokens apply instance-wide across all sites registered on a given WPGuard server. To keep client staging sites separate from live customer environments, run independent WPGuard instances with distinct ports and separated state directories.

Inspect first, preview second, apply third.

Never let an AI editor write directly to WordPress without a dry run. WPGuard structures Cascade’s actions into reviewable phases.

Step 1: Inspect the live site context

Begin by asking Cascade to run wp_site_context on your target site. Cascade retrieves the current WordPress version, active plugins, theme details, and available fields. This grounds Cascade in real site structure rather than assumed schemas.

Step 2: Generate an explicit preview packet

When requesting an edit, instruct Cascade to pass apply=False. WPGuard reads the current stored database record, executes the proposed replacement in memory, and returns a structured packet showing the exact old value, new value, and active rule check results.

Step 3: Review the visual diff in Cascade

Review the proposed diff directly in Windsurf’s chat panel. Confirm that Cascade accurately modified the targeted sentence or option without deleting adjacent block markup, truncating shortcodes, or corrupting HTML entity formatting.

Step 4: Guarded state-hash execution

When you approve the edit, Cascade calls the mutation tool with apply=True and the preview’s state tag. If another user modified the post in WordPress during the preview phase, the state hash fails and WPGuard rejects the write to prevent silent overwrites.

Enforce business rules that outlast the conversation.

Prompt instructions disappear when context compacts. WPGuard’s correction engine deterministically protects mandatory requirements.

Protect mandatory legal and booking terms

If a landing page requires an explicit refund notice, medical disclaimer, or license registration, save that requirement as a correction rule. WPGuard checks the requirement before every mutation and blocks writes that omit required phrases.

Keep rules scoped to the right page

Correction checks are strictly scoped. A rule protecting specific booking policies on your checkout page will not restrict blog posts, documentation, or header menus across other pages on your site.

Maintain an auditable rule provenance

Every rule preserves the prompt, date, and user reason that created it. When policies change, operators can inspect why a rule was instituted, update the criteria, or retire the rule cleanly.

Deterministic validation outside the LLM

Because correction rules execute in WPGuard’s Python core rather than inside Cascade’s token prediction loop, they cannot be bypassed by clever phrasing, hallucinations, or long conversation histories.

Verify visual rendering before marking work done.

A successful database write is not proof that the page looks right. WPGuard provides automated browser verification.

Beyond database read-backs

An agent confirming that MySQL accepted a new string does not verify that CSS styling remains intact. Broken HTML tags, unrendered shortcodes, or layout shifts only appear when the page renders in a real browser engine.

Automated Playwright screenshot receipts

WPGuard can trigger headless Playwright to capture full-page desktop (1280px) and mobile (390px) screenshots following a mutation, preserving visual receipts in your local artifact directory for quick operator review.

Automated layout and asset diagnostics

The render check inspects the rendered DOM for missing image assets (HTTP 404 responses), horizontal viewport overflow, broken link paths, heading hierarchy anomalies, and unhandled JavaScript console errors.

Adopt a staging-first operational habit

Always connect Windsurf to a staging clone first. Test Cascade’s suggested changes, verify the preview packet, and review the screenshot receipts before running mutations against live customer-facing sites. Learn more in our staging to production safety guide.

Connect Windsurf Cascade to your WordPress site.

Run WPGuard locally, configure your bearer token, and preview your first guarded WordPress edit.