How do I connect OpenCode to xSpeed?
Put your sites in xSpeed Hub once, then add one URL to OpenCode.
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 your config
Put this block in your global config, or in opencode.json at a project root to scope it to that project. OpenCode reads both JSON and JSONC. No other field is needed: when the Hub answers 401, OpenCode starts the OAuth flow and registers itself through dynamic client registration.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"xspeedhub": {
"type": "remote",
"url": "https://app.xspeedcache.com/xspeed/mcp"
}
}
} 3Sign in with opencode mcp auth
Run this once. It opens a browser page on xSpeed Hub where you sign in and approve access. There is no token to paste; OpenCode stores the credentials it receives. Run opencode mcp list to see the server and its auth status, and opencode mcp debug xspeedhub if the connection fails.
opencode mcp auth xspeedhub
4Or 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 turn OAuth off for this server so OpenCode does not start a sign-in.
{
"mcp": {
"xspeedhub": {
"type": "remote",
"url": "https://app.xspeedcache.com/xspeed/mcp",
"oauth": false,
"headers": {
"Authorization": "Bearer {env:XSPEED_HUB_TOKEN}"
}
}
}
} Use xspeedhub to list my sites and show which ones have a cache hit ratio under 60%.
You: Use xspeedhub: how much does the cache help on blog right now?
run_benchmark(site: blog) read-only
→ cached 38 ms, uncached 412 ms over 5 runs
get_preloader_status(site: blog) read-only
→ last run finished 3 days ago, 212 URLs warmed
OpenCode: Cached responses take about 38 ms against 412 ms uncached. The preloader last ran three days ago, so recent posts may not be warm yet. Start it again?
You: Yes.
start_preloader(site: blog) changes site
→ preloader started, 226 URLs queued
OpenCode: The preloader is running with 226 URLs queued, 14 more than last time. Ask me again in a few minutes and I will check its progress.
Using it
Prompts to try in OpenCode
Paste one as it is, or change the site name.
Use xspeedhub to show the cache hit ratio of every site and flag anything under 70%.
Use xspeedhub to purge the assets cache on shop, then show its cache status.
Use xspeedhub to start the preloader on blog and report how many URLs it queued.
Use xspeedhub to run a mobile PageSpeed test on docs and compare it with the stored history.
Use xspeedhub to preview a safe optimize_site pass on landing. Do not apply it.
What can OpenCode do with xSpeed?
A guide for each job, written for OpenCode.
Purge the WordPress cache with OpenCode
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 OpenCode
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 OpenCode
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 OpenCode
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 OpenCode
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 OpenCode
See which modules a site has, read their current settings, change them, and turn page caching on or off.
Warm the WordPress cache with OpenCode
Fill the page cache before visitors arrive, for example right after a purge or a deploy.
Set up the Redis object cache with OpenCode
Connect a site to Redis or Memcached so database results survive between requests.
Manage Cloudflare caching with OpenCode
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 OpenCode
Run one action across all of your sites, or a chosen few, and read the result site by site.
Trust and safety
Does OpenCode ask before it changes my site?
OpenCode checks MCP tools against its permission rules under the prefixed name, such as xspeedhub_purge_cache, and most permissions default to allow. With no rule of yours in place, a Hub write tool runs without a prompt. Add rules to change that: "xspeedhub_*": "ask" first, then "xspeedhub_get_*": "allow" and "xspeedhub_list_*": "allow", because the last matching rule wins. A deny rule holds even under opencode --auto, which approves everything that is not denied. The Hub itself has no confirmation step, so these rules and read-only access are the gates. For read-only access, send the connection token with Read-only everywhere on, or sign in as a Viewer member.
xSpeed Hub
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.
Good to know
- OpenCode starts from permissive defaults. Until you add an ask or deny rule for xspeedhub_ tools, treat every write tool as able to run on the model's say-so.
- The Hub adds 29 tool definitions to every request in the session. OpenCode's docs warn that MCP servers add to context, so enable it per agent if you only need it sometimes.
- OpenCode waits 5 seconds by default to fetch a server's tool list. If discovery times out, raise the timeout field on the xspeedhub entry, in milliseconds.
Reference
What is OpenCode?
OpenCode is an open-source coding agent that runs in your terminal. It reads and edits code, runs commands, and calls tools from MCP servers you list under the mcp key of its config, alongside its built-in tools.
MCP, the Model Context Protocol, is how OpenCode reaches services outside your machine. A remote server is one block with type remote and a url. 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.
At a glance
- Made by
- SST
- Type
- Terminal
- Connects with
- a remote mcp entry in the config, then opencode mcp auth
- Sign-in
- OAuth sign-in or connection token
- Last checked
- October 2026
Why use OpenCode with xSpeed?
Name it in the prompt
OpenCode lets you refer to a server by name, so use xspeedhub in a prompt points the agent at the Hub without any setup per session.
Permission rules by tool name
Each Hub tool is its own permission key, so one pattern allows the reads and another keeps every write on a prompt or denies it.
A Hub agent of its own
Disable the Hub globally and enable it for a single agent in your config. Your coding agents then never carry the Hub's tool definitions.
How does OpenCode compare with other AI clients?
Every client below reaches the same 29 Hub tools once connected. What differs is where it runs, how you add the server and how it signs in.
| Client | Made by | Type | How you connect it | Sign-in |
|---|---|---|---|---|
| OpenCode | SST | Terminal | a remote mcp entry in the config, then opencode mcp auth | OAuth sign-in or connection token |
| Kimi Code | Moonshot AI | Terminal | an mcpServers entry in mcp.json, then /mcp-config login | OAuth sign-in or connection token |
| Claude | Anthropic | Chat app | Customize, Connectors, Add custom connector | OAuth sign-in or connection token |
| ChatGPT | OpenAI | Chat app | Developer mode, then a custom MCP app | OAuth sign-in |
| Claude Code | Anthropic | Terminal | claude mcp add, then /mcp to sign in | OAuth sign-in or connection token |
Which way should I connect?
OpenCode can use the Hub, one site's own MCP server, or the no-account Scan MCP. The Hub is the one most people want.
xSpeed Hub MCPMost people
https://app.xspeedcache.com/xspeed/mcp - Best for
- Most people. One URL in your AI client, every site behind it.
- Reaches
- Every site in your workspace, one connection
- Sign-in
- OAuth sign-in in the browser, or a connection token in an Authorization header
- Tools
- 29 tools (16 read, 13 write), seven of them can act on every site at once
xSpeed Cache Site MCP
https://your-site.com/xspeed/mcp - Best for
- A single site, or work the Hub does not expose, such as database cleanup.
- Reaches
- One WordPress site
- Sign-in
- OAuth sign-in by a site admin, or the site's own token in an Authorization header
- Tools
- The full per-site tool set plus run_command for the WP-CLI surface
xSpeed Scan MCP
https://xspeedcache.com/scan/mcp - Best for
- Grading a site you do not run, or trying xSpeed before you install anything.
- Reaches
- Any public URL, read-only
- Sign-in
- None. No account.
- Tools
- 5 tools: run_speed_scan, get_speed_scan and three product-info tools
WP-CLI
wp xspeed … - Best for
- Agents that already run commands on the server, such as Claude Code or Codex over SSH.
- Reaches
- The site whose server the agent has a shell on
- Sign-in
- Your server login
- Tools
- Every xSpeed command: cache, purge, preloader, objcache, cf, score, settings and more
Frequently asked questions
Also works with
Documentation
From the blog
- How to Let Claude or ChatGPT Manage Your WordPress Site Speed (via MCP)
- Connecting Claude to a WordPress Fleet in 2026: One of These Five Routes You May Already Be Paying For
- xSpeed Cache MCP vs WP Rocket MCP in 2026: One Connects Once, the Other Once Per Site
- 10 Best WordPress MCP Servers in 2026: 486 in the Directory, Four With More Than Ten Reviews