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

Manage Cloudflare caching with Gemini CLI

Managing Cloudflare with Gemini CLI means asking it, in your terminal, to verify a WordPress site's Cloudflare link, purge the edge cache or toggle development mode through the xSpeed Hub MCP server.

cloudflare_verifypurge_cloudflareset_cloudflare_dev_modepurge_cacheget_settings

Last updated: October 2026

Example session · Gemini CLI

You: The new hero image on blog is not showing for logged-out visitors. Use xSpeed Hub to check Cloudflare.

cloudflare_verify(site: blog) read-only
→ Credentials and zone resolve; Cloudflare connected

Gemini CLI: Cloudflare is connected on blog. The old hero image may sit in the edge cache and in xSpeed's page cache on the server. Run purge_cache for blog's page cache, then purge_cloudflare?

You: Yes, both.

purge_cache(site: blog, type: page) changes site
→ page cache purged (46 entries)

purge_cloudflare(site: blog) changes site
→ Cloudflare edge cache purged

Gemini CLI: The page cache and the edge cache for blog are both purged. Request the page from a logged-out session to see the new image.

01

How Gemini CLI handles this

You are in a Gemini CLI session and a page you changed still shows the old content from outside your network. You suspect Cloudflare, so you ask Gemini to look at it for the site by name. It calls list_sites to find the handle and then cloudflare_verify, a read that asks Cloudflare whether the stored token and zone still resolve. You see the answer in the terminal, with nothing changed on the site.

With the link confirmed, Gemini can call purge_cloudflare to clear the edge copy, or set_cloudflare_dev_mode to bypass the edge for about three hours so your origin changes show at once. Both writes need Cloudflare connected in xSpeed on that site. Neither accepts site: "all", so for several sites Gemini calls the tool once per site, and you read each result as it comes back.

Gemini CLI shows a confirmation before an MCP tool runs, with choices to proceed once, always allow that tool, always allow the whole xspeedhub server, or cancel. The tools appear as mcp_xspeedhub_ followed by the tool name, and policy rules can allow, deny or ask for a named tool. The setting to watch is trust: when the server entry sets trust to true, every tool call runs without that question, both Cloudflare writes included, and starting Gemini CLI with --approval-mode=yolo (or --yolo) approves every tool call too. The prompt shows the tool name and its arguments, so read the site handle in it before you answer, particularly when you manage several sites with similar names. Afterward, ask Gemini to list the calls it made.

02

Set up Gemini CLI once

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

Run this once. --scope user writes the server to ~/.gemini/settings.json so it works in every project; without it Gemini CLI saves to the project's .gemini/settings.json, which is the default.

Terminal
gemini mcp add --scope user --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp

3Authenticate with /mcp auth

Start gemini and run /mcp auth xspeedhub. A browser page opens where you sign in to xSpeed Hub and approve access, and Gemini CLI receives the redirect on a local port. There is no token to paste, and the client keeps the credentials it receives. Run /mcp afterwards to check that xspeedhub shows as connected and lists its tools.

Text
/mcp auth xspeedhub
1 / 3

Full Gemini CLI 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. Gemini CLI shows a confirmation for an MCP tool call unless the server entry sets trust to true or you start Gemini CLI with --approval-mode=yolo (or --yolo), which approves every tool call. You can proceed once, always allow that tool, always allow the whole xspeedhub server, or cancel; the last two choices stop later prompts for those tools. Policy rules in ~/.gemini/policies can allow, deny or ask for a named tool by server and tool name. The Hub has no confirmation step of its own, so a trusted server, YOLO mode or an allow rule lets a write run as soon as your connection allows writes.

03

What do I ask?

Three prompts written for Gemini CLI. More for this job are below.

Prompt for Gemini CLI
Use xSpeed Hub to verify the Cloudflare connection on shop and print what Cloudflare said.
Prompt for Gemini CLI
With xSpeed Hub, clear the Cloudflare edge cache for blog only, then confirm it worked.
Prompt for Gemini CLI
Use xSpeed Hub to switch Cloudflare development mode on for shop for this debugging session, and remind me to turn it off.
04

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.

05

Reference

Read toolcloudflare_verify; purges nothing and works on a read-only connection
Write toolspurge_cloudflare and set_cloudflare_dev_mode (enabled true or false)
NeedsCloudflare connected in xSpeed on that site: integration on, an API token (or the legacy key and email) and a Zone ID
Edge purge scopeEverything Cloudflare holds for the site's zone; the server copies stay
Development modeBypasses the edge for about 3 hours, then Cloudflare switches it off
Token permissionsZone Cache Purge, and Zone Settings Edit for development mode
What verify provesThe token and zone resolve; a token without Zone Settings Edit still verifies
Through purge_cacheType all also clears the edge when Cloudflare is connected; page, assets, object and rest do not
Every site at onceNone of the three accept site: "all"; one site per call
Failure shapeAn error with the action, the HTTP status and Cloudflare's message
Read-only connectionThe 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
ConfirmationNone on the Hub; your client's prompt is the gate
06

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 Gemini CLI

Setting trust on the xspeedhub server tells Gemini CLI to run its tools without asking, and the setting covers every tool on that server, not just the reads. Choosing always allow for the whole server has the same effect, and so do the --trust flag and starting Gemini CLI with --approval-mode=yolo (or --yolo), which approves every tool call. That means set_cloudflare_dev_mode and purge_cloudflare would run without a prompt. Choose always allow for cloudflare_verify alone, or write a policy rule that allows that one tool. If you want a hands-off audit, use a read-only connection instead of trust, either the connection token with Read-only everywhere on (passed with --header) or a Viewer member's sign-in: cloudflare_verify works, and both writes are refused by the Hub.

07

More prompts for this job

They work in any client connected to xSpeed Hub.

Prompt
Use xSpeed Hub to check that the Cloudflare connection on shop still works.
Prompt
With xSpeed Hub, purge the Cloudflare edge cache on blog.
Prompt
I changed the checkout page on shop. Use xSpeed Hub to purge the site cache and the Cloudflare edge.
Prompt
Use xSpeed Hub to turn Cloudflare development mode on for shop. I am editing the theme.
Prompt
With xSpeed Hub, turn Cloudflare development mode off on shop.
Prompt
Ask xSpeed Hub to verify Cloudflare on shop and tell me what is wrong if it fails.
Prompt
Using xSpeed Hub, which of my sites have a working Cloudflare connection? Check them one at a time.
08

Frequently asked questions

By default it asks before it runs a tool call. If the xspeedhub server is set to trusted, you started Gemini CLI with --approval-mode=yolo or --yolo, or you chose always allow for the server or for that tool, the question is skipped. The Hub adds no prompt of its own, so trust or a write-enabled connection means the purge runs straight away.

Yes. cloudflare_verify is a read tool, so it works on a read-only connection. Use the connection token with Read-only everywhere on, passed with --header, or a Viewer member's sign-in. That connection refuses purge_cloudflare and set_cloudflare_dev_mode, which makes it a safe choice for checks.

Cloudflare has to be connected in xSpeed on that site: the integration switched on, an API token (or the legacy Global API Key with your Cloudflare email) and the Zone ID of the domain. You set these in the xSpeed Cache panel in wp-admin. Without them, the tools return an error instead of acting.

A purge_cache of type all does, when the site has Cloudflare connected, and it reports each step. A page, assets, object or rest purge stays on your server. purge_cloudflare clears only the edge, so use it when the server copy is already fresh.

About three hours. Cloudflare switches it off on its own after that. While it is on, the edge is bypassed, so origin changes show at once and real visitors get a slower site. Turn it off yourself with set_cloudflare_dev_mode set to false when you are done.

Verifying and purging do not need Zone Settings Edit on the token, so a token without it looks fine. Development mode writes a zone setting, so it is refused. Edit the token in Cloudflare so it has both Zone Cache Purge and Zone Settings Edit, then try again.

Not with purge_cloudflare, which takes one site per call. A purge_cache of type all with site set to all clears the edge on each site that has Cloudflare connected, and the result is reported per site. The Hub tells the agent to confirm a write across every site with you once first.

09

Keep going

Manage Cloudflare with other agents

More with Gemini CLI

Documentation

From the blog

Manage Cloudflare, from Gemini CLI.

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