How Claude Code handles this
The usual moment is right after a deploy. You pushed a theme change or a plugin update from the same terminal, and the live site still serves the old CSS because the cached pages point at it. Instead of opening wp-admin, you tell Claude Code which site and what changed. It calls list_sites to match the name, picks a purge type that fits the change, and runs purge_cache through the xspeedhub server you added with claude mcp add.
What comes back is the plugin's own report: which stores were cleared, how many entries, and whether a connected Cloudflare zone accepted the purge. A purge of type all covers the page cache, the object cache and, when they are connected, the Cloudflare edge and CDN, so Claude Code can tell you in one line whether anything refused. For a CSS-only change it can purge assets instead, which leaves the stored HTML alone.
Claude Code shows each tool call before it runs it unless a permission rule allows that tool, or you run it in auto mode (a classifier reviews actions instead of you) or bypassPermissions mode (no prompts), so a purge appears as mcp__xspeedhub__purge_cache with its arguments, and you approve it or not. For a purge across every site, the Hub also tells Claude Code to say "this will touch all N sites" and wait for your go-ahead before it sends the single site: "all" call.
Set up Claude Code once
Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Claude Code guide.
1Put your sites in xSpeed Hub
Sign in at app.xspeedcache.com with Google or email; the Hub is free and has no site cap. Then connect each WordPress site from its own dashboard: click Connect Hub in the xSpeed Cache top bar, then Connect via xSpeed Hub. Each site needs the free xSpeed Cache plugin.
2Add xSpeed Hub to Claude Code
Run this once. --scope user makes the server available in every project; leave it off and it applies to the current project only, which is Claude Code's default.
claude mcp add --transport http --scope user xspeedhub https://app.xspeedcache.com/xspeed/mcp
3Sign in with /mcp
Start Claude Code, run /mcp, pick xspeedhub and finish the sign-in in your browser. You approve access on an xSpeed Hub page; there is no token to paste, and Claude Code keeps the credentials it receives and refreshes them.
/mcp
Full Claude Code setup, sign-in options and FAQ
Before you send a prompt that changes something
Reads change nothing on your sites, though contact_support emails xSpeed support. Writes run once your connection allows them, so your client's approval prompt and a read-only connection (the token's Read-only everywhere switch, or a Viewer sign-in) are the gates that matter. Claude Code asks before it runs an MCP tool unless a permission rule already allows it, or you work in auto mode, where a classifier reviews actions instead of you, or in bypassPermissions mode, which skips prompts. A rule such as mcp__xspeedhub__get_cache_status allows one tool, and mcp__xspeedhub__get_* allows every read whose name starts with get_. Keep purge_cache, update_settings, toggle_cache and the other write tools on the prompt, because the Hub itself runs a write as soon as your connection allows it.
What do I ask?
Three prompts written for Claude Code. More for this job are below.
I just deployed the new header to shop. Use xSpeed Hub to purge only the assets cache there and tell me what was cleared.
With xSpeed Hub, purge every site in my workspace, then list any site where the purge failed and why.
Use xSpeed Hub to purge the blog site fully, start the preloader, and check the hit ratio again in ten minutes.
What happens, step by step
A purge throws away stored copies so the next visitor gets a fresh page. Through xSpeed Hub an agent can purge everything, only pages, only CSS and JavaScript assets, the object cache or the REST cache, on one site or across every site in a workspace. A full purge also clears the Cloudflare edge when the site has Cloudflare connected.
01
Find the site
The agent calls list_sites when you have more than one site, then matches the name you used to a site handle. If the name could mean two sites, the Hub tells it to ask you rather than guess.
02
Pick the purge type
purge_cache takes a type: all, page, assets, object or rest. all clears the page cache, the object cache and, when they are connected, the Cloudflare edge and CDN. After a theme or CSS change, assets is enough; after a content edit, page; after a deploy, all.
03
Purge
The call runs straight away on that site once your connection allows writes. For every site at once the agent passes site: "all", and the Hub runs the sites one after another with a one-second pause.
04
Clear only the edge if that is all you need
purge_cloudflare empties the Cloudflare edge cache on its own, without touching the copies on your server. A page or assets purge does not reach Cloudflare; a purge of type all does when Cloudflare is connected.
05
Warm it again
start_preloader rebuilds the cache in the background so the first visitors after the purge are not the ones paying for it.
Reference
| Tool | purge_cache (write) |
|---|---|
| Purge types | all, page, assets, object, rest |
| What all covers | Page cache, object cache, plus the Cloudflare edge and CDN when connected |
| Every site at once | site: "all" or a list of handles, one result per site |
| Fan-out pacing | Sites run one after another with a 1 second pause |
| Edge only | purge_cloudflare, a separate write tool |
| Re-warm | start_preloader after the purge |
| Read-only access | purge_cache is refused on a connection token with Read-only everywhere on, and for a Viewer sign-in |
| Confirmation | None on the Hub; your client's prompt is the gate |
Rules worth keeping
- Name the site. With several sites, an unclear name should make the agent ask, and the Hub tells it to.
- A purge of every site is one call with site: "all". The Hub tells the agent to confirm it with you once before it runs.
- Purge the narrowest type that fixes the problem, then warm the cache, so visitors do not all hit uncached pages at once.
- A fan-out result is reported per site. Treat some sites failing as a partial result, not a failure of the whole call.
Good to know with Claude Code
If you added xspeedhub without --scope user, it only exists in the project where you ran claude mcp add, so in another repository Claude Code will say it has no xSpeed tools. Run the add command again with --scope user, or add it to that project, and sign in again with /mcp, or run claude mcp login xspeedhub from the shell, if Claude Code asks. And if you have allowed mcp__xspeedhub__* in your permissions, purges no longer prompt; scope the allow rule to the get_ tools if you want to keep seeing writes. Auto mode and bypassPermissions mode skip the prompt as well.
More prompts for this job
They work in any client connected to xSpeed Hub.
Use xSpeed Hub to purge the page cache on blog.
I just changed the theme CSS on shop. Use xSpeed Hub to purge only the assets cache there.
With xSpeed Hub, purge every site in my workspace and tell me which ones failed.
Use xSpeed Hub to purge shop, then purge its Cloudflare edge cache too.
With xSpeed Hub, purge the docs site and start the preloader so it is warm again.
Using xSpeed Hub, what purge type should I use after updating a plugin that changes the checkout page?
Frequently asked questions
Keep going
Purge the cache with other agents
More with Claude Code
Documentation
- How to enable Page Cache
- How to warm your cache ahead of visitors
- Managing your fleet with xSpeed Hub
- How to write prompts for xSpeed Hub
- Claude Code + xSpeed
- Every AI agent that works with xSpeed
From the blog