# Purge the WordPress cache with GitHub Copilot in VS Code

> Purging the WordPress cache with GitHub Copilot in VS Code means asking its agent mode, in the editor where you just changed the site, to clear the xSpeed cache and warm it again through xSpeed Hub.

Page: https://xspeedcache.com/agent/github-copilot/purge-cache/
Last updated: October 2026

You are in VS Code, working in the repository for a WordPress site, and you have just committed a change. In the Copilot chat in agent mode you type the request: purge the cache on shop for the files I changed. Copilot calls list_sites, chooses a purge type, and runs purge_cache. VS Code shows the tool call in the chat and, before it runs, a confirmation dialog.

VS Code starts in Manual permissions, so a tool call that is not auto-approved shows that confirmation. You can allow it once, or for the session, the workspace or all future calls, so how often you see the dialog depends on what you choose. A wider choice means later purges in that scope run without it. Chat: Manage Tool Approval lists the xSpeed tools grouped by server, so you can trust the reads and leave purge_cache on a prompt. The result then returns in the chat: the type, the site, how many entries cleared, and for a purge of type all the object cache and Cloudflare edge too.

Because xSpeed Hub has no confirmation of its own, the VS Code dialog and your connection scope are the two gates that matter. For a purge across every site the Hub also tells Copilot to say it will touch all the sites and wait for your yes, though that is guidance to the model, not a lock. VS Code caps the tools in one request at 128, and the Hub's 29 take only a part of that.

## Set up GitHub Copilot in VS Code once

### 1. Put 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.

### 2. Add xSpeed Hub to your user mcp.json

Open the Command Palette and run MCP: Open User Configuration, then add this entry. Servers in your user profile are available in every workspace. MCP: Add Server walks you through the same thing, and the project-level .mcp.json file works too if you want the entry shared with your team; that file uses a top-level mcpServers object instead of servers.

File: `mcp.json (MCP: Open User Configuration)`

```json
{
  "servers": {
    "xspeedhub": {
      "type": "http",
      "url": "https://app.xspeedcache.com/xspeed/mcp"
    }
  }
}
```

### 3. Start the server and sign in

Run MCP: List Servers, pick xspeedhub and choose Start. VS Code asks whether you trust the server, then opens a browser page where you sign in to xSpeed Hub and approve access. There is no token to paste, and VS Code keeps the credentials it receives. Open the Chat view and use the Configure Tools button to see the xSpeed tools.

```
MCP: List Servers
```

Full setup: https://xspeedcache.com/agent/github-copilot/

### 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 VS Code the default permission level is Manual permissions: a tool call that is not auto-approved shows a confirmation, and you can allow it once or for the session, the workspace or all future calls. Chat: Manage Tool Approval lists tools grouped by MCP server, so you can trust get_cache_status and the other reads while purge_cache and update_settings stay on a prompt. Allow all, Autopilot and global auto-approval skip those prompts, including for external tool calls, and then a write runs as soon as your connection allows writes. xSpeed Hub has no confirmation step of its own.

## Prompts

- I changed the footer styles on blog. Use xSpeed Hub to purge only the assets cache there and tell me how many files went.
- With xSpeed Hub, purge the page cache on shop for the template files in my working changes, then start the preloader.
- Use xSpeed Hub to purge every site in my workspace and list any that failed.

## Example session

```
You: Committed the footer fix on blog. Use xSpeed Hub to purge assets there.
  → list_sites [read-only]: 6 sites; blog is blog.example.com
Agent: I will run purge_cache with type assets on blog. VS Code will ask you to confirm the tool call. Continue?
You: Allow.
  → purge_cache(site: blog, type: assets) [changes site]: 31 minified CSS and JS files cleared
Agent: Done. The assets cache on blog is empty and rebuilds on the next request; the cached pages were not touched.
```

## How it works

1. **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.
2. **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.
3. **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.
4. **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.
5. **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

- 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 GitHub Copilot in VS Code

Allowing purge_cache for the session, the workspace or all future calls removes the dialog for it, so a later purge in that scope runs as soon as Copilot calls it. Allow all, Autopilot and global auto-approval skip the prompts for every tool, writes included. Keep the broader options for read tools and confirm writes one at a time. Also watch your tool count: VS Code limits a single request to 128 tools, and with several MCP servers enabled the Hub's 29 count toward that, so disable servers you are not using in the session if Copilot stops seeing purge_cache.

## 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

### Can GitHub Copilot in VS Code purge my WordPress cache?

Yes. With xSpeed Hub added as an MCP server in VS Code, ask Copilot in agent mode to purge the site you changed. It calls purge_cache and shows the result in the chat.

### Does VS Code confirm a purge before it runs?

VS Code starts in Manual permissions and shows a confirmation for tool calls that are not auto-approved, and you can allow a tool once, or for the session, the workspace or all future calls. xSpeed Hub has no confirmation of its own, so after you allow purge_cache for a wider scope, or choose Allow all or Autopilot, later purges run without a dialog. A connection token with Read-only everywhere on, or a Viewer sign-in, refuses purges regardless.

### What is the difference between the purge types?

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.

### Does purging xSpeed also clear Cloudflare?

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.

### Can I purge all of my sites with one prompt?

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.

### Will a purge slow my site down?

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.

## Purge the cache with other agents

[Claude Code](https://xspeedcache.com/agent/claude-code/purge-cache/) · [Claude](https://xspeedcache.com/agent/claude/purge-cache/) · [Claude Cowork](https://xspeedcache.com/agent/claude-cowork/purge-cache/) · [ChatGPT](https://xspeedcache.com/agent/chatgpt/purge-cache/) · [Codex](https://xspeedcache.com/agent/codex/purge-cache/) · [Cursor](https://xspeedcache.com/agent/cursor/purge-cache/) · [Windsurf](https://xspeedcache.com/agent/windsurf/purge-cache/) · [Gemini CLI](https://xspeedcache.com/agent/gemini-cli/purge-cache/) · [Antigravity](https://xspeedcache.com/agent/antigravity/purge-cache/) · [Zed](https://xspeedcache.com/agent/zed/purge-cache/) · [Kiro](https://xspeedcache.com/agent/kiro/purge-cache/) · [OpenCode](https://xspeedcache.com/agent/opencode/purge-cache/) · [OpenClaw](https://xspeedcache.com/agent/openclaw/purge-cache/) · [Hermes Agent](https://xspeedcache.com/agent/hermes-agent/purge-cache/) · [Grok Build](https://xspeedcache.com/agent/grok-build/purge-cache/) · [ChatGPT dots](https://xspeedcache.com/agent/chatgpt-dots/purge-cache/) · [Grok](https://xspeedcache.com/agent/grok/purge-cache/) · [Grok Bot](https://xspeedcache.com/agent/grok-bot/purge-cache/) · [Muse](https://xspeedcache.com/agent/muse/purge-cache/) · [Manus](https://xspeedcache.com/agent/manus/purge-cache/) · [Kimi Code](https://xspeedcache.com/agent/kimi/purge-cache/) · [Paperclip](https://xspeedcache.com/agent/paperclip/purge-cache/) · [NanoClaw](https://xspeedcache.com/agent/nanoclaw/purge-cache/)

## More with GitHub Copilot in VS Code

- [Find out why WordPress pages are not cached with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/troubleshoot-cache/)
- [Scan a website for speed problems with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/speed-scan/)
- [Run and track PageSpeed tests with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/pagespeed-tests/)
- [Raise a WordPress site's PageSpeed score with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/optimize-site/)
- [Tune WordPress cache settings with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/cache-settings/)
- [Warm the WordPress cache with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/preload-cache/)
- [Set up the Redis object cache with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/object-cache/)
- [Manage Cloudflare caching with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/cloudflare/)
- [Manage every WordPress site at once with GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/fleet/)

## Documentation

- How to enable Page Cache: https://xspeedcache.com/docs/page-cache/
- How to warm your cache ahead of visitors: https://xspeedcache.com/docs/preloader/
- Managing your fleet with xSpeed Hub: https://xspeedcache.com/docs/managing-your-fleet-with-xspeed-hub/
