How Grok Build handles this
You are in a Grok Build session and a page you changed still looks old when you request it from outside. You ask Grok to check Cloudflare for that site. It calls list_sites to match the handle, then cloudflare_verify, which asks Cloudflare whether the credentials and zone saved in xSpeed still resolve. You see the answer in the terminal with nothing changed on the site.
If the link is healthy, Grok can run purge_cloudflare to clear only the Cloudflare edge copy, or set_cloudflare_dev_mode to bypass the edge for about three hours so origin changes show immediately. Both writes need Cloudflare connected in xSpeed on that site, and neither accepts site: "all", so each call covers a single site. A purge_cache call of type all also clears the edge when Cloudflare is connected, which Grok may suggest when you changed content as well as styles.
Grok Build signs in to the Hub using OAuth and keeps the credentials it receives, so there is no token for you to paste. It starts in Ask mode, which prompts for any tool call that no rule has allowed, so purge_cloudflare and set_cloudflare_dev_mode prompt until you say otherwise. A rule such as MCPTool(xspeedhub__cloudflare_verify) lets the read through, and rules are evaluated deny, then ask, then allow. Always-approve skips the prompt, Auto mode lets a classifier approve tools it judges safe, and a deny rule is the way to stop a tool for good. Name the site and the tool in your request, and ask Grok to say what it changed once the call returns.
Set up Grok Build once
Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Grok Build 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 with grok mcp add
Run this once. Add --scope project to write the server to .grok/config.toml in the current directory instead of your user config, which is only sensible if the repo never holds a token. Grok Build handles the OAuth flow for a remote server on its own.
grok mcp add --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp
3Sign in from the TUI
Start grok and open /mcps. Select xspeedhub and press i to authenticate, or just use a Hub tool and let the browser flow start on first use. Sign in to xSpeed Hub and approve access. There is no token to paste; Grok Build stores the credentials it receives in ~/.grok/mcp_credentials.json. If the connection fails, run grok mcp doctor xspeedhub.
/mcps
Full Grok Build 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. Grok Build starts in Ask mode, which prompts for anything a rule has not already allowed, so a Hub write tool prompts until you say otherwise. You can allow the reads with a rule such as MCPTool(xspeedhub__get_*) in the permission section of your config, and leave the writes unmatched. Evaluation runs deny, then ask, then allow. Two other modes remove the prompt: Always-approve, from /always-approve, Ctrl+O or --always-approve, approves tool calls unless a deny rule or a hook stops them, and Auto lets a classifier approve tools it judges safe. If a Hub write must never run unprompted, add a deny rule. The Hub itself has no confirmation step.
What do I ask?
Three prompts written for Grok Build. More for this job are below.
With xSpeed Hub, check the Cloudflare connection on shop and show me what Cloudflare returned.
Use xSpeed Hub to clear only the Cloudflare edge cache for blog.
With xSpeed Hub, turn Cloudflare development mode on for shop while I test, and tell me when to turn it off.
What happens, step by step
When Cloudflare sits in front of a WordPress site, it keeps its own copy of your files at the edge. Through xSpeed Hub an agent can check that the site's Cloudflare credentials still work, purge the edge cache, and turn development mode on or off. All three need Cloudflare connected in xSpeed on that site, and each works on one site at a time.
01
Verify the connection
cloudflare_verify calls Cloudflare's API with the credentials stored on the site and checks that the token and zone still resolve. It purges nothing and works on a read-only connection. If Cloudflare is not connected on that site, the call comes back as an error and the agent should tell you rather than retry.
02
Purge the edge
purge_cloudflare empties the Cloudflare edge cache for the site's zone. It does not touch the copies on your server. When Cloudflare is in front of a site, a content change usually needs both, so the agent runs purge_cache first and purge_cloudflare after it, or one purge_cache of type all, which reaches the edge when Cloudflare is connected.
03
Turn development mode on to see origin changes
set_cloudflare_dev_mode with enabled true bypasses the edge for about three hours, so changes on the origin show immediately. It slows the site for real visitors the whole time. Your client's prompt is the gate here, because the Hub's instructions do not name this tool in their confirm list.
04
Turn it off when you finish
set_cloudflare_dev_mode with enabled false switches development mode off. Cloudflare also ends it on its own after about three hours. No Hub tool reads whether it is currently on, so note when you turned it on.
05
Read a failure
A rejected token, an empty zone ID or a refused call comes back as an error that names the action, the HTTP status and Cloudflare's message when it gave one. It is not reported as a success. The credentials themselves are set in the xSpeed Cache panel in wp-admin, not through the Hub.
Reference
| Read tool | cloudflare_verify; purges nothing and works on a read-only connection |
|---|---|
| Write tools | purge_cloudflare and set_cloudflare_dev_mode (enabled true or false) |
| Needs | Cloudflare connected in xSpeed on that site: integration on, an API token (or the legacy key and email) and a Zone ID |
| Edge purge scope | Everything Cloudflare holds for the site's zone; the server copies stay |
| Development mode | Bypasses the edge for about 3 hours, then Cloudflare switches it off |
| Token permissions | Zone Cache Purge, and Zone Settings Edit for development mode |
| What verify proves | The token and zone resolve; a token without Zone Settings Edit still verifies |
| Through purge_cache | Type all also clears the edge when Cloudflare is connected; page, assets, object and rest do not |
| Every site at once | None of the three accept site: "all"; one site per call |
| Failure shape | An error with the action, the HTTP status and Cloudflare's message |
| Read-only connection | The connection token with Read-only everywhere on, or a Viewer member's sign-in; purge_cloudflare and set_cloudflare_dev_mode are refused and cloudflare_verify works. An OAuth sign-in gets the scopes the client asks for, so the switch does not make it read-only |
| Confirmation | None on the Hub; your client's prompt is the gate |
Rules worth keeping
- Run cloudflare_verify first, but do not read a pass as proof that every call will work. A token that lacks Zone Settings Edit verifies and purges fine, then fails the first time development mode is switched.
- Purge the server and the edge together after a content change. Purging only the site leaves visitors on the old page until the edge copy expires.
- Turn development mode off as soon as you are done. It slows the site for real visitors for up to about three hours, and no tool reports its state.
- Never paste a Cloudflare token or Global API Key into the chat. Connect Cloudflare in the xSpeed Cache panel in wp-admin, and use a scoped API token rather than the Global API Key.
- purge_cloudflare and set_cloudflare_dev_mode are write tools. The Hub runs them as soon as your connection allows writes, so your client's approval prompt and a read-only connection (the connection token with Read-only everywhere on, or a Viewer member's sign-in) are the gates that matter.
Good to know with Grok Build
Allow only cloudflare_verify with an MCPTool rule, and add a deny rule for set_cloudflare_dev_mode if it must never run unprompted, because deny rules still apply under Always-approve, which skips the prompt for Hub writes too. Auto mode lets a classifier approve tools it judges safe, which is a model's judgement, not a lock. The Hub itself runs a write as soon as your connection allows, so for inspection sessions the dependable fix is a read-only connection: sign in as a Viewer member, or pass the connection token with Read-only everywhere on. Grok's default OAuth sign-in gets the scopes it asks for, and the switch does not change that. On a read-only connection cloudflare_verify still works, and purge_cloudflare and set_cloudflare_dev_mode are refused.
More prompts for this job
They work in any client connected to xSpeed Hub.
Use xSpeed Hub to check that the Cloudflare connection on shop still works.
With xSpeed Hub, purge the Cloudflare edge cache on blog.
I changed the checkout page on shop. Use xSpeed Hub to purge the site cache and the Cloudflare edge.
Use xSpeed Hub to turn Cloudflare development mode on for shop. I am editing the theme.
With xSpeed Hub, turn Cloudflare development mode off on shop.
Ask xSpeed Hub to verify Cloudflare on shop and tell me what is wrong if it fails.
Using xSpeed Hub, which of my sites have a working Cloudflare connection? Check them one at a time.
Frequently asked questions
Keep going
Manage Cloudflare with other agents
More with Grok Build
Documentation
- How to connect Cloudflare
- How to serve assets from a CDN
- How to enable Page Cache
- How to write prompts for xSpeed Hub
- Grok Build + xSpeed
- Every AI agent that works with xSpeed
From the blog