# Grok Build + xSpeed: Manage WordPress Caching

> Grok Build is xAI's coding agent for the terminal, and with xSpeed Hub added as a remote MCP server it can read cache status, purge, change settings and run speed tests on every WordPress site in your workspace. You run one command, sign in once, and ask in plain language.

Page: https://xspeedcache.com/agent/grok-build/
Last updated: October 2026

- One grok mcp add command, one URL, every site you connected to the Hub
- Hub tools arrive as xspeedhub__<tool>, so allow rules can match the reads and leave writes on the prompt
- grok mcp doctor checks the configuration and the connection when something does not work

## How do I connect Grok Build to xSpeed?

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

```bash
grok mcp add --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp
```

### 3. Sign 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
```

### 4. Or use a connection token (alternative)

If you prefer a header, copy the connection token from Connect AI in the Hub (only the workspace owner sees it), export it as XSPEED_HUB_TOKEN, and name the variable in your config. Grok Build then sends it as a bearer token, and the token never lands in the file.

File: `~/.grok/config.toml`

```toml
[mcp_servers.xspeedhub]
url = "https://app.xspeedcache.com/xspeed/mcp"
bearer_token_env_var = "XSPEED_HUB_TOKEN"
```

**Authentication:** OAuth sign-in or connection token. Approve access in the browser the first time the Hub needs it, or press i on the server in the /mcps panel; Grok Build stores the credentials it receives. If you would rather use a header, pass the connection token from the Hub's Connect AI page from an environment variable.

**Check it worked:** ask "Use xSpeed Hub to list my sites, then show the object cache status of each one."

## Does Grok Build ask before it changes my site?

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.

xSpeed Hub has no confirmation step of its own. Read tools change nothing on your sites, with one exception to know about: contact_support sends an email to xSpeed support, and a read-only connection can still call it. A write tool (a purge, a settings change, a cache toggle, or a speed test that spends the shared allowance) runs as soon as your connection allows writes. Three things stand between a prompt and a change: your connection's scope, because a read-only connection refuses every write tool (the connection token has a Read-only everywhere switch, and a Viewer member only ever gets read access); your AI client's own tool-approval prompt; and the Hub's instructions to the agent, which tell it to confirm the target site and to ask once before a write that touches every site.

## Example session

```
You: Using xSpeed Hub, is Redis working on shop? If it is, turn the object cache on.
  → get_object_cache_status(site: shop) [read-only]: object cache off, Redis drop-in not installed
  → test_object_cache(site: shop) [read-only]: Redis reachable on 127.0.0.1, 2 ms round trip
Agent: Redis answers from the server, and the object cache is off. Turning it on installs the drop-in on shop. Do that now?
You: Yes, enable it.
  → toggle_object_cache(site: shop, enabled: true) [changes site]: object cache enabled, drop-in installed
Agent: The object cache is on for shop. If anything looks stale on the site, I can flush it.
```

## What is Grok Build?

Grok Build is xAI's coding agent. You use it through a terminal interface, headlessly in scripts with grok -p, or through the Agent Client Protocol in other apps. It reads and edits code, runs commands, and calls tools from MCP servers you add.

MCP, the Model Context Protocol, is how Grok Build reaches services outside your machine. Remote servers are added with grok mcp add, and their tools join the built-in ones under the name server, two underscores, tool. Adding xSpeed Hub that way gives it the Hub's caching tools: status, purge, settings, preloader, object cache, Cloudflare and speed tests, for every site in your workspace.

## Why use Grok Build with xSpeed?

- **Rules that match by name**: Hub tools carry the xspeedhub__ prefix, so one MCPTool rule can allow every get_ read while each write keeps its prompt.
- **A doctor command**: grok mcp doctor checks your configuration and connectivity, which saves guessing when a sign-in or a URL is wrong.
- **User or project scope**: Keep the Hub in your user config for every repo, or add it with --scope project so a repository carries the server definition for the team.

## Good to know

- Always-approve skips prompts for Hub writes too. Use a deny rule for any tool that must never run unprompted, because deny rules still apply in that mode.
- Project-scoped config replaces a user server of the same name entirely. Keep one xspeedhub entry unless you mean to override.
- Grok Build also reads MCP configs from ~/.claude.json, .cursor/mcp.json and project .mcp.json, merged below config.toml. If xspeedhub appears twice, run grok inspect to see where each copy came from.

## Prompts to try

- Use xSpeed Hub to show the cache hit ratio for every site and flag anything under 70%.
- With xSpeed Hub, purge the assets cache on shop, then show the cache status.
- Use xSpeed Hub to run a desktop PageSpeed test on blog and compare it with the stored history.
- Ask xSpeed Hub to start the preloader on docs and report how many URLs it queued.
- Using xSpeed Hub, which of my sites has Cloudflare connected? Verify each connection without purging anything.

## What can Grok Build do with xSpeed?

- [Purge the WordPress cache with Grok Build](https://xspeedcache.com/agent/grok-build/purge-cache/): Clear stale pages after a deploy, an edit or a plugin update, on one site or all of them.
- [Find out why WordPress pages are not cached with Grok Build](https://xspeedcache.com/agent/grok-build/troubleshoot-cache/): Work out why a site misses the cache, serves slow pages or shows a low hit ratio, using read-only checks first.
- [Scan a website for speed problems with Grok Build](https://xspeedcache.com/agent/grok-build/speed-scan/): Get a graded speed report with the fix for every failing check and a link you can share, for your own site or any public URL.
- [Run and track PageSpeed tests with Grok Build](https://xspeedcache.com/agent/grok-build/pagespeed-tests/): Read the PageSpeed scores a site already has, run a new test when something changed, and tell a Lighthouse score from a cache benchmark.
- [Raise a WordPress site's PageSpeed score with Grok Build](https://xspeedcache.com/agent/grok-build/optimize-site/): Preview and apply xSpeed's recommended settings to a site, check the pages still work, and be told plainly what caching cannot fix.
- [Tune WordPress cache settings with Grok Build](https://xspeedcache.com/agent/grok-build/cache-settings/): See which modules a site has, read their current settings, change them, and turn page caching on or off.
- [Warm the WordPress cache with Grok Build](https://xspeedcache.com/agent/grok-build/preload-cache/): Fill the page cache before visitors arrive, for example right after a purge or a deploy.
- [Set up the Redis object cache with Grok Build](https://xspeedcache.com/agent/grok-build/object-cache/): Connect a site to Redis or Memcached so database results survive between requests.
- [Manage Cloudflare caching with Grok Build](https://xspeedcache.com/agent/grok-build/cloudflare/): Check the Cloudflare connection, clear the edge cache and switch development mode on or off for a site.
- [Manage every WordPress site at once with Grok Build](https://xspeedcache.com/agent/grok-build/fleet/): Run one action across all of your sites, or a chosen few, and read the result site by site.

## Which way should I connect?

| Surface | Endpoint | Reaches | Auth | Tools |
| --- | --- | --- | --- | --- |
| [xSpeed Hub MCP](https://xspeedcache.com/docs/hub-mcp/) | `https://app.xspeedcache.com/xspeed/mcp` | Every site in your workspace, one connection | OAuth sign-in in the browser, or a connection token in an Authorization header | 29 tools (16 read, 13 write), seven of them can act on every site at once |
| [xSpeed Cache Site MCP](https://xspeedcache.com/docs/mcp-server/) | `https://your-site.com/xspeed/mcp` | One WordPress site | OAuth sign-in by a site admin, or the site's own token in an Authorization header | The full per-site tool set plus run_command for the WP-CLI surface |
| [xSpeed Scan MCP](https://xspeedcache.com/docs/scan-mcp/) | `https://xspeedcache.com/scan/mcp` | Any public URL, read-only | None. No account. | 5 tools: run_speed_scan, get_speed_scan and three product-info tools |
| [WP-CLI](https://xspeedcache.com/docs/wp-cli-commands/) | `wp xspeed …` | The site whose server the agent has a shell on | Your server login | Every xSpeed command: cache, purge, preloader, objcache, cf, score, settings and more |

## Frequently asked questions

### How do I add xSpeed Hub to Grok Build?

Run grok mcp add --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp, then start grok, open the /mcps panel, select xspeedhub and press i to approve access in the browser. grok mcp doctor xspeedhub checks the setup if something fails.

### Do I need an API key?

No. Grok Build signs in to the Hub with OAuth and stores the credentials it receives. If you prefer a header, the workspace owner can copy the connection token from the Hub's Connect AI page and give it to Grok Build through an environment variable named in bearer_token_env_var.

### Will Grok Build change my site without asking?

In its default Ask mode it prompts for tool calls that no rule has allowed. The Hub has no confirmation step of its own, so a write tool you allow with a rule, or any tool under Always-approve, runs as soon as your connection allows writes. Allow reads only, add deny rules for the rest. For read-only access, send the connection token with Read-only everywhere on, or sign in as a Viewer member.

### Which tools does Grok Build get?

The 29 tools of the xSpeed Hub MCP server, named xspeedhub followed by two underscores and the tool, for example xspeedhub__purge_cache. Sixteen only read; thirteen change a site or spend the shared speed-test allowance.

### Can I use Grok Build with one site and no Hub?

Yes. The xSpeed Cache plugin has its own MCP server at your-site.com/xspeed/mcp, switched on from xSpeed Cache, AI and agents, MCP in wp-admin. The Hub is the better fit once you have more than one site.

### Can Grok Build use WP-CLI instead?

If Grok Build has a shell on the server, it can run wp xspeed commands directly, for example wp xspeed purge. That works without the Hub, but only for the site on that server.

### How do I disconnect Grok Build?

Run grok mcp remove xspeedhub, or toggle the server off in the /mcps panel. Rotating or disconnecting the connection token in the Hub revokes only clients that send that token, so it does not end an OAuth sign-in; that is removed in Grok Build.

## Also works with

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

## Sources

- Grok Build docs: MCP servers: https://docs.x.ai/build/features/mcp-servers
- Grok Build docs: Permissions: https://docs.x.ai/build/features/permissions
- Grok Build docs: Settings reference: https://docs.x.ai/build/settings/reference
- Grok Build docs: Get started: https://docs.x.ai/build/overview
