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

SST

Terminal

OpenCode + xSpeed

OpenCode is an open-source AI 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 add one block to your config, sign in once, and say use xspeedhub in a prompt.

  • One config block, one URL, every site you connected to the Hub
  • Tools appear as xspeedhub_<tool>, so permission rules can match reads and writes by name
  • Enable the Hub for one agent only, so its 29 tools stay out of every other session

Last updated: October 2026

OpenCode Terminal
xSpeed Hub 29 tools
  • shop
  • blog
  • docs
Connects with a remote mcp entry in the config, then opencode mcp auth. Sign-in: OAuth sign-in or connection token.
01

How do I connect OpenCode to xSpeed?

Put your sites in xSpeed Hub once, then add one URL to OpenCode.

1Connect4 steps

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.

~/.config/opencode/opencode.json
{
  "$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.

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

~/.config/opencode/opencode.json
{
  "mcp": {
    "xspeedhub": {
      "type": "remote",
      "url": "https://app.xspeedcache.com/xspeed/mcp",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer {env:XSPEED_HUB_TOKEN}"
      }
    }
  }
}
1 / 4
Sign-in OAuth sign-in or connection token

Run opencode mcp auth xspeedhub and approve access in the browser; OpenCode stores the tokens it receives. If you would rather use a header, switch OAuth off for the server and send the connection token from the Hub's Connect AI page.

2Askexample session
Check it worked

Use xspeedhub to list my sites and show which ones have a cache hit ratio under 60%.

Example session · OpenCode

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

02

Prompts to try in OpenCode

Paste one as it is, or change the site name.

Prompt
Use xspeedhub to show the cache hit ratio of every site and flag anything under 70%.
Prompt
Use xspeedhub to purge the assets cache on shop, then show its cache status.
Prompt
Use xspeedhub to start the preloader on blog and report how many URLs it queued.
Prompt
Use xspeedhub to run a mobile PageSpeed test on docs and compare it with the stored history.
Prompt
Use xspeedhub to preview a safe optimize_site pass on landing. Do not apply it.
03

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

04

Does OpenCode ask before it changes my site?

OpenCode

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

05

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
06

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.

07

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.

ClientMade byTypeHow you connect itSign-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
08

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
Read the guide →

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
Read the guide →

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
Read the guide →

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
Read the guide →
09

Frequently asked questions

Add an xspeedhub block under mcp in your OpenCode config with type remote and the url https://app.xspeedcache.com/xspeed/mcp, then run opencode mcp auth xspeedhub and approve access in the browser. After that you can say use xspeedhub in a prompt.

No. OpenCode 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, set oauth to false on the server and send it in an Authorization header.

It can, depending on your rules. Most OpenCode permissions default to allow, so a Hub write tool runs without a prompt unless you add an ask or deny rule for it. The Hub has no confirmation step of its own, so set those rules, or send the connection token with Read-only everywhere on, or sign in as a Viewer member, before you let an agent loose on live sites.

In your permission config, add a rule that sets every tool whose name starts with xspeedhub_ to ask, then add allow rules for the names that start with xspeedhub_get_ and xspeedhub_list_. OpenCode applies the last matching rule, so the catch-all goes first. Use deny instead of ask for any tool you never want to run.

The 29 tools of the xSpeed Hub MCP server, registered with the server name as a prefix, for example xspeedhub_purge_cache. Sixteen only read; thirteen change a site or spend the shared speed-test allowance.

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.

Run opencode mcp logout xspeedhub to remove the stored credentials, and delete or disable the entry in your config. 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 OpenCode.

10

Also works with

Sources checked (5)

Connect OpenCode to every site at once.

xSpeed Hub is free and has no site cap. Connect your sites, add one URL, and ask.