How Codex handles this
The useful moment is the end of a task. Codex has changed a theme template, a caching setting or a plugin, and before you accept the work you want a measurement. You ask it to scan the site. If the site is in xSpeed Hub, Codex calls run_speed_scan with the site handle, and with get_speed_scan it first reads what the site scored before, so the comparison is against a real earlier report and not a guess.
The scan returns server probes and a Lighthouse run graded out of 100 on one rubric. The desktop run is the headline and the mobile run is graded beside it. The failing checks come ranked by points recovered, with the xSpeed feature that fixes each. Codex can then act on the list in your repository, or in the plugin settings if you have connected the site, and re-scan with a fresh run to prove the difference.
If the page is not in your Hub, such as a client's live site or a staging page, the no-account Scan MCP grades any public URL. It is read-only, so Codex can use it freely, within four scans per caller per ten minutes. Paste the report link into the pull request or the commit notes, so the reviewer can open the same evidence Codex read and judge the change for themselves.
Set up Codex once
Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Codex 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 and sign in
Add the server with its URL, then log in. The login opens an xSpeed Hub page in your browser; approve access there. There is no token to paste, and Codex keeps the credentials it receives. Start Codex and type /mcp to see the server.
codex mcp add xspeedhub --url https://app.xspeedcache.com/xspeed/mcp codex mcp login xspeedhub
3Keep the Hub's tools on a prompt
Open ~/.codex/config.toml. Set the server to prompt for every tool, then let one read tool run without a question. The tool timeout defaults to 60 seconds, and a PageSpeed test can take up to about two minutes, so raise it.
[mcp_servers.xspeedhub] url = "https://app.xspeedcache.com/xspeed/mcp" default_tools_approval_mode = "prompt" tool_timeout_sec = 150 [mcp_servers.xspeedhub.tools.get_cache_status] approval_mode = "approve"
4Add the xSpeed Scan MCP for sites you do not run
Prompts that scan a public URL use the xSpeed Scan MCP, a separate server from the Hub. Add it to Codex the same way as the Hub above, as a second server (xspeedscan, for example) with the URL https://xspeedcache.com/scan/mcp, and leave out any sign-in setting, such as an OAuth or auth option or an Authorization header, because the Scan MCP needs no account, token or sign-in. On a plan that allows one custom connector, add whichever server the prompts you use need.
https://xspeedcache.com/scan/mcp
Full Codex 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. Codex has two layers for shell work: the sandbox mode limits what commands can touch, and the approval policy sets when Codex stops to ask. MCP tools have their own settings. Each server takes default_tools_approval_mode (auto, prompt, writes or approve) and each tool can override it with approval_mode. Codex also asks about MCP calls that advertise side effects or a destructive annotation, but xSpeed Hub's tool definitions do not declare either, so do not rely on that default for the Hub; set the server to prompt. approval_policy never, --yolo and an auto_review reviewer take the human out of the loop. xSpeed Hub has no confirmation step of its own, so an approved or auto-approved write runs as soon as your connection allows writes.
What do I ask?
Three prompts written for Codex. More for this job are below.
Use xSpeed Hub to read the last scan for shop, make the change we discussed, then run a fresh scan and tell me which grades moved.
With the xSpeed Scan MCP, scan the public staging URL and list the failing checks as a TODO for this branch.
Ask xSpeed Hub for a mobile-only scan of the homepage and report the top three checks by points recovered.
What happens, step by step
An xSpeed Scan grades a site from 0 to 100 using server probes (time to first byte, compression, cache evidence, redirects, platform detection) plus a Lighthouse run, and names the fix for every failing check. An agent can start one two ways. Through xSpeed Hub, run_speed_scan scans a site you have connected. Through the no-account Scan MCP at https://xspeedcache.com/scan/mcp, it scans any public URL and cannot change anything. Either way you get a report link to share.
01
Check what the site already scored
get_speed_scan without a scan id returns the site's scan history, newest first, plus a summary of the latest report. It starts nothing and spends nothing, so the Hub tells the agent to read it first when you ask what a site scored.
02
Start a scan
run_speed_scan runs the full scan on a site you connected to the Hub. strategy is both (the default), desktop or mobile; one device alone costs half the engine's quota. The scan takes 20 to 60 seconds. The Hub waits about 50 seconds and, if the scan is still running, hands back a scan id.
03
Poll if it is still running
Call get_speed_scan with scan_id. While the scan runs it returns the running status and a note to ask again in about 20 seconds. The report page is live from the start and refreshes itself.
04
Read the result
The summary carries the grade, the four dimension scores, what was measured and the top fixes ranked by points recoverable, each with the xSpeed feature that fixes it. The headline grade is the desktop run. The mobile run is graded alongside it, so the agent should mention both when they differ.
05
Scan a site you do not run
For any other public URL, the agent uses the Scan MCP at https://xspeedcache.com/scan/mcp. There is no account and no sign-in. It takes a url, returns the same graded report and a link at xspeedcache.com/scan/r/<id>, and is limited to 4 scans per caller per 10 minutes.
06
Fix, wait, re-scan
After a change, wait several minutes and scan again with fresh: true. Without it, the scan service reuses any report from the last 10 minutes and the agent will show you the old number.
Reference
| Hub route | run_speed_scan, then get_speed_scan with scan_id; only for sites connected to your Hub |
|---|---|
| Scan MCP route | https://xspeedcache.com/scan/mcp, no account, 5 tools, read-only, any public URL |
| Scan MCP limit | 4 scans per caller per 10 minutes |
| Why run_speed_scan is a write | It spends a shared scan allowance and stores a report; it changes nothing on the site |
| Read-only Hub connection | run_speed_scan is refused; get_speed_scan still works. Applies to the connection token with Read-only everywhere on and to a Viewer sign-in; an OAuth sign-in gets the scopes the client asks for |
| Duration | 20 to 60 seconds; the Hub waits about 50 seconds, then returns a scan id |
| Poll argument | scan_id on the Hub tool, scanId on the Scan MCP tool |
| strategy | both (default), desktop or mobile; one device costs half the quota and becomes the headline |
| fresh | true forces a new measurement; otherwise a report from the last 10 minutes is reused |
| Report link | xspeedcache.com/scan/r/<id>; add .md for a Markdown twin an agent can read |
| Report visibility | Hub scans are filed unlisted; Scan MCP scans are public in the scan directory by default |
Rules worth keeping
- Read before you spend. Ask for the scan history first; start a new scan only when you want a fresh measurement or something changed.
- A report link is not private. An unlisted report is kept out of the scan directory and search, but anyone with the URL can open it. A scan started through the Scan MCP is public by default.
- run_speed_scan changes nothing on your site, but the Hub classes it a write, so a read-only connection (the connection token with Read-only everywhere on, or a Viewer sign-in) refuses it and your client may prompt for it. Use get_speed_scan, or the Scan MCP for a public URL, when you want a strictly read-only route.
- Compare like with like. A scan that lost its Lighthouse run is marked partial and is not comparable with a full one, and the lab grade is not the same as real-visitor Core Web Vitals, which the report shows separately.
- A scan cannot reach private, local or password-protected sites, and a site behind a bot challenge returns a report that says its server checks were not measured.
Good to know with Codex
A preview or staging URL has to be reachable from the public internet, because the scan runs from the xSpeed servers and not from your machine. A page behind a password, a VPN or a local address cannot be scanned, and Codex will get an error or an unusable report. Codex only prompts by default for MCP calls that advertise side effects, and the Hub's tools declare none, so set the Hub server to prompt and let get_speed_scan through with a per-tool override. approval_policy never, --yolo and an auto-approving reviewer remove the prompt, and then run_speed_scan, a write-classed tool that spends the shared allowance, runs unasked. The tool timeout defaults to 60 seconds and the Hub waits about 50, so raise it for scans. The Scan MCP is read-only.
More prompts for this job
Prompts about your own sites work in any client connected to xSpeed Hub. A prompt that scans a site you do not run, or names the scan server, needs the xSpeed Scan MCP from the setup above.
Using xSpeed Hub, what did the shop site score on its last speed scan? Do not start a new one.
Use xSpeed Hub to run a speed scan on blog and give me the three fixes that recover the most points, plus the report link.
With xSpeed Hub, scan only the mobile view of shop and tell me the grade.
I changed the theme this morning. Use xSpeed Hub to run a fresh scan on docs and compare it with the previous report.
Use the xSpeed Scan MCP to grade [competitor URL] and tell me what its biggest weaknesses are.
The speed scan on shop is still running. Ask xSpeed Hub to check it again and tell me when it finishes.
Frequently asked questions
Keep going
Scan a site's speed with other agents
More with Codex
Documentation
- xSpeed Scan: free website speed test
- xSpeed Scan MCP: speed-test any site from your AI assistant
- How to run a full site scan
- Running speed tests in xSpeed Hub
- How to write prompts for xSpeed Hub
- Codex + xSpeed
- Every AI agent that works with xSpeed
From the blog