xSpeed Cache is officially live! Get 50% OFF during Launch Week — Lifetime starts at just $79Lifetime from $79 — 50% OFF, Launch Week! See Plans →

See Plans →
Features
xSpeed Hub Pricing Docs Blog Scan
Appearance
Get Plugin

Purge the WordPress cache with Kimi Code

Purging the WordPress cache with Kimi Code means asking Moonshot AI's terminal agent to clear the xSpeed cache on the site you just deployed, through the xspeedhub entry in its mcp.json.

list_sitesget_cache_statuspurge_cachepurge_cloudflarestart_preloader

Last updated: October 2026

Example session · Kimi Code

You: Deployed the new product template to shop. Use xSpeed Hub to clear the stale pages.

list_sites read-only
→ 3 sites: shop, blog, docs

Kimi Code: The diff touches a template, not CSS, so the stored HTML is what is stale. Purge the page cache on shop? Kimi Code will ask you to approve the call.

You: Approve.

purge_cache(site: shop, type: page) changes site
→ 389 cached pages cleared

Kimi Code: Done, 389 pages cleared on shop; assets and the object cache were left alone. I can start the preloader next.

01

How Kimi Code handles this

Kimi Code is open in the theme repository when the stale page shows up. You ran the deploy from the same terminal, the live product pages still load the old layout, and you type the site and what changed. Kimi Code calls list_sites if you have several sites, picks a purge type from the files it just edited, and calls mcp__xspeedhub__purge_cache. Each call and its result print in the session, so the report lands right under the deploy output.

The report is the plugin's own: purge type, site, how many entries were cleared, and for a purge of type all the object cache and a connected Cloudflare edge. Because Kimi Code read the diff, it can say why assets is enough for a stylesheet edit or why a template change needs page. The sign-in happened once, with /mcp-config login xspeedhub, so later sessions call the Hub without a browser. If the entry lives in the repository's .kimi-code/mcp.json, it overrides your home config for that project, which is one way to keep the Hub only where you work on WordPress.

Kimi Code starts in Always Ask mode, where an MCP call that matches no permission rule asks for approval, and Approve for this session allows the same kind of call until the session ends. That prompt is the check on a purge, because xSpeed Hub has no confirmation step of its own and runs the write as soon as your connection allows it. Add allow rules for mcp__xspeedhub__get_* and mcp__xspeedhub__list_* under [[permission.rules]] in config.toml and keep purge_cache on the prompt. For a purge across every site the Hub also tells Kimi Code to confirm once, which is guidance to the model, not a lock.

02

Set up Kimi Code once

Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Kimi 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 mcp.json

Put this in ~/.kimi-code/mcp.json to use the Hub in every project, or in .kimi-code/mcp.json inside one repository, where it overrides a user entry of the same name. You can also run /mcp-config and let Kimi Code add it. A server added while a session is open joins only the next session.

~/.kimi-code/mcp.json
{
  "mcpServers": {
    "xspeedhub": {
      "url": "https://app.xspeedcache.com/xspeed/mcp"
    }
  }
}

3Sign in with /mcp-config login

Start a new session with kimi, run this and approve access on the xSpeed Hub page that opens in your browser. There is no token to paste. Then run /mcp to check that xspeedhub is connected.

Text
/mcp-config login xspeedhub
/mcp
1 / 3

Full Kimi 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. In Kimi Code's default Always Ask mode, an MCP call that matches no permission rule asks for approval, and Approve for this session allows the same kind of call until the session ends. Permanent rules go in [[permission.rules]] in config.toml: allow mcp__xspeedhub__get_* and mcp__xspeedhub__list_* to let the reads run, and leave the write tools on the prompt. Ask When Needed mode, from /yolo, approves MCP calls automatically, and Never Ask, from /auto, approves everything. xSpeed Hub has no confirmation step of its own, so in either of those modes a purge or a settings change runs as soon as your connection allows writes. To remove writes altogether, list the read tools in the entry's enabledTools, or use a connection token with Read-only everywhere on.

03

What do I ask?

Three prompts written for Kimi Code. More for this job are below.

Prompt for Kimi Code
I just deployed the new product template to shop. Use xSpeed Hub to purge the page cache there and report what was cleared.
Prompt for Kimi Code
With xSpeed Hub, purge only the assets cache on blog after this CSS change and tell me how many files went.
Prompt for Kimi Code
Use xSpeed Hub to purge every site in my workspace and list any that failed. Confirm with me once first.
04

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.

05

Reference

Toolpurge_cache (write)
Purge typesall, page, assets, object, rest
What all coversPage cache, object cache, plus the Cloudflare edge and CDN when connected
Every site at oncesite: "all" or a list of handles, one result per site
Fan-out pacingSites run one after another with a 1 second pause
Edge onlypurge_cloudflare, a separate write tool
Re-warmstart_preloader after the purge
Read-only accesspurge_cache is refused on a connection token with Read-only everywhere on, and for a Viewer sign-in
ConfirmationNone on the Hub; your client's prompt is the gate
06

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 Kimi Code

/yolo switches Kimi Code to Ask When Needed, which approves MCP calls automatically, and /auto switches it to Never Ask, which approves everything. In either mode a purge, and a purge of every site, runs without a prompt. Approve for this session has a smaller version of the same effect: approve one purge with it and the next purge in that session goes straight through. If a project should never purge from the terminal, list only the read tools in the entry's enabledTools, or put purge_cache in disabledTools, so the model is never offered it. A connection token with Read-only everywhere on, sent through bearerTokenEnvVar, is the harder limit, because the Hub then refuses every write whatever mode Kimi Code is in.

07

More prompts for this job

They work in any client connected to xSpeed Hub.

Prompt
Use xSpeed Hub to purge the page cache on blog.
Prompt
I just changed the theme CSS on shop. Use xSpeed Hub to purge only the assets cache there.
Prompt
With xSpeed Hub, purge every site in my workspace and tell me which ones failed.
Prompt
Use xSpeed Hub to purge shop, then purge its Cloudflare edge cache too.
Prompt
With xSpeed Hub, purge the docs site and start the preloader so it is warm again.
Prompt
Using xSpeed Hub, what purge type should I use after updating a plugin that changes the checkout page?
08

Frequently asked questions

Yes. Add xSpeed Hub to mcp.json, sign in with /mcp-config login xspeedhub, and ask in the same session to purge the site you deployed. Kimi Code calls purge_cache with the type that fits and prints what was cleared.

In the default Always Ask mode it asks before an MCP call that no permission rule allows. Ask When Needed, from /yolo, and Never Ask, from /auto, approve MCP calls automatically, and xSpeed Hub has no confirmation step of its own, so in those modes a purge runs at once.

all clears every cache xSpeed manages for the site, including a connected Cloudflare zone or CDN. page clears the stored HTML pages, assets clears minified and combined CSS and JavaScript, object clears the Redis or Memcached object cache, and rest clears cached REST API responses.

A purge of type all does, when the site has Cloudflare connected in xSpeed: it clears the page cache, the object cache and the Cloudflare edge, and reports each one. A page, assets or rest purge stays on your server. purge_cloudflare clears only the edge.

Yes. The agent passes site: "all" to purge_cache and the Hub purges every site in the workspace one after another, returning a result per site. The Hub tells the agent to confirm a write across every site with you once before it runs it.

The next request to each purged page builds it fresh, which is slower than a cached hit. Starting the preloader right after the purge rebuilds the cache in the background so visitors mostly land on warm pages.

09

Keep going

Purge the cache with other agents

More with Kimi Code

Documentation

From the blog

Purge the cache, from Kimi Code.

xSpeed Hub is free and has no site cap. Connect your sites once and ask from the agent you already use.