OpenCode + xCloud

Speed up a slow site with OpenCode on xCloud

Speeding up a slow site with OpenCode means asking your terminal agent why a site is slow and letting xCloud answer from measurements: CPU, RAM and disk samples, cache state, the latest PageSpeed result, the access log and the PHP version.

  • Skill: xcloud:performance
  • Toolsets: pagespeed, sites, servers, broken-links
  • Free with every xCloud account

YouWhy is shop.example.com slow? Reads only.

xcloud_sites_cacheSettingsread-only

xcloud_servers_monitoringHistoryread-only

AgentPage cache is off and object cache is off. The server's disk is at 96 percent and has been climbing for a week. Fix the disk first, then turn page cache on under Site, WordPress, Caching. I cannot switch it on from here; the dashboard link for the site is below.

YouThanks. Purge nothing for now.

. Keep a human in the loop: xCloud stops and asks before anything that creates, deploys, updates, reboots, deletes or buys.

Setup

How Do You Set Up OpenCode to Speed up a slow site on xCloud?

Connect OpenCode once; every job on this account uses the same connection. Then ask in plain words.

  1. Add the xCloud MCP server

    Run this from the project that should use xCloud, or add --global to make it available everywhere. OpenCode writes the entry under mcp.servers in its config (OpenCode v2 no longer accepts server names directly under mcp). Remote servers use OAuth by default, so there is nothing else to fill in; the equivalent hand-written entry is shown below.

    Terminal
    opencode mcp add xcloud --url https://app.xcloud.host/mcp
    
    # the entry it writes to opencode.jsonc
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "servers": {
          "xcloud": {
            "type": "remote",
            "url": "https://app.xcloud.host/mcp"
          }
        }
      }
    }
  2. Sign in with OAuth

    This opens your browser on the xCloud approval screen, where you tick the teams and choose Read-only or Full access. Inside OpenCode, /mcps does the same: pick xcloud and sign in. Then opencode mcp list should show xcloud as connected.

    Terminal
    opencode mcp auth xcloud
    opencode mcp list
  3. No browser? Use an API key

    For a headless or CI machine, create a token with the mcp:invoke scope plus the read abilities for the areas it will use (read:servers and read:sites, with read:billing and read:addons for billing and add-on tools) and the matching write: abilities if it should change things in Settings, Developers, API Tokens and export it as XCLOUD_TOKEN. Setting oauth to false turns off the automatic sign-in, and the {env:XCLOUD_TOKEN} reference keeps the token out of the file. The entry still lives under mcp.servers.

    JSON
    {
      "mcp": {
        "servers": {
          "xcloud": {
            "type": "remote",
            "url": "https://app.xcloud.host/mcp",
            "oauth": false,
            "headers": {
              "Authorization": "Bearer {env:XCLOUD_TOKEN}"
            }
          }
        }
      }
    }
  4. Check it worked

    Then ask OpenCode for the job itself, for example:

    Prompt
    Why is shop.example.com slow? Read monitoring history, cache settings and the latest PageSpeed run before you answer.

In practice

How Does Performance Work from OpenCode?

You are in a terminal with opencode running, often in the repository of the site that feels slow, and you type one line: why is shop.example.com slow. OpenCode registers every tool a remote MCP server offers under the server name, so the diagnosis shows up in your session as xcloud_sites_show, xcloud_sites_status, xcloud_sites_monitoring_history, xcloud_servers_monitoringHistory, xcloud_sites_cacheSettings, xcloud_sites_pagespeed_latest, xcloud_sites_access-logs, xcloud_servers_services and xcloud_sites_wordpress_status. They are all reads, so none of them stops for approval. You can watch the agent walk from the site to its server, then through history, caches, PageSpeed and services, without typing a second message.

What comes back is a short written finding with the numbers behind it, not a list of generic tips. It might say the server's disk is nearly full, or that page cache and object cache both read as off while the mobile PageSpeed run shows a slow server response, or that one client has been hammering a single path since the hour the slowdown began. When the cause is a cache layer, OpenCode cannot switch it on for you. It tells you the dashboard path, Site, WordPress, Caching, and gives you the site's dashboard link instead. If every number looks normal it says that, and it does not invent a cause to have something to report.

The difference with OpenCode is how much you decide about which agent sees xCloud. The server brings 188 operations plus two search tools next to OpenCode's built-in tools, and a diagnosis session adds time series and log lines to the context. Keep the xcloud tools off your everyday coding agent and switch them on for an agent you set up for operations, or connect the compact profile when you only want a quick answer. Ask for a bounded window when you want traffic checked, such as the last 200 lines, because the access log is read over SSH and a wide request is slow.

OpenCode specific: A performance session pulls time series and log lines into the model's context, and OpenCode shares that context with every other tool it has. If answers get vague late in a long session, start a fresh one for the diagnosis, ask for the 24-hour range instead of seven days, and keep the access log window small. On the free plan the monitoring history reads are refused as a plan limit, and OpenCode will print that refusal, so treat it as a limit and not as missing data.

What xCloud does for performance

xCloud reads the site's and the server's CPU, RAM and disk samples, which cache layers are on, the latest PageSpeed result, traffic in the access log, service health and the site's PHP version. The agent names the cause from that data, then hands you the switches that only the dashboard can flip.

  1. Resolve the site and its server. The agent looks up the site and the server it runs on, because the answer often comes from both. A slow site is frequently slow because a neighbour on the same server is.
  2. Check status and monitoring history. A site that is mid-deploy or failed explains slowness without any measurement. Otherwise the agent reads the site's and the server's samples, and a 24-hour or 7-day series to tell whether the slowdown is new. Disk comes early: a nearly full disk slows everything, the database first.
  3. Read the cache layers. The agent reads the cache settings before saying anything about caching: whether page cache, Redis or Object Cache Pro object cache and Cloudflare edge cache are on, and which server stack the site runs. It never reports that no cache configuration is readable without calling it.
  4. Read PageSpeed and traffic. The latest completed PageSpeed run is free to read. A new scan is worth starting only when there is no result or the site changed since, and the agent tells you it is spending a scan. The access log shows spikes, a crawl or one client hammering a path.
  5. Check services and PHP. The agent checks that PHP, the web server, Redis and the database are running, and reads the site's PHP version and pending updates. A stopped Redis next to an object cache that reads as on is a found answer.
  6. Name the cause and hand off. You get the most likely cause with its numbers. The fix is either something the agent can do, such as a purge after you agree, or a dashboard switch it names with the path and the site's dashboard link. If every number looks normal, it says so instead of inventing a cause.

Reference

Performance Settings and Limits on xCloud

The facts OpenCode works within when it speeds up a slow site. Where a row names the dashboard, that step stays yours to take there.

Setting or limitWhat applies
Monitoring historySite and server CPU, RAM and disk samples as a 24-hour or 7-day series. History is not available on the free plan, and the agent says that is a plan limit rather than reporting no data
Cache stateRead through sites.cacheSettings: page cache, object cache (Redis, Object Cache Pro) and Cloudflare edge cache. It returns settings only, never cache contents
Enabling a cache layerDashboard-only: Site, WordPress, Caching. The API reads the layers and purges them, and cannot switch one on for an existing site
Page cache detailsCache duration, URL and cookie exclusions and ignored query parameters are dashboard-only and are not returned by the cache settings read
PageSpeedThe latest mobile and desktop results and the history are read for free. One scan runs both strategies
Scan conflictsA 409 while a scan is running means it is still pending or scanning. The agent polls it instead of starting another, and it is not a cooldown
Cache purgePurging runs without a confirmation stop but throws away a warm cache, so the agent asks first on a live site and reports each layer as queued or skipped
TrafficThe access log shows spikes and bots. It is read over SSH, so the agent asks for a bounded window
PHP versionRead from the site's status. Changing one site's PHP version is a dashboard step: Site, Site Settings
Server PHP defaultChanging the server default PHP changes only the command-line php and the version new sites get. It does not move any existing site
Broken linksA broken-link scan on a WordPress site returns findings grouped by source page, and a truncated scan is reported as partial

Rules OpenCode has to follow

  • The agent diagnoses from measurements, not guesses, and it calls the cache settings read before it says anything about caching.
  • It never offers to turn on Redis or any other cache layer itself. Enabling a layer is a dashboard step, and the agent gives you the path and the dashboard link.
  • It never presents a change of server PHP default as a substitute for changing one site's PHP version.
  • A cache purge on a live site, a new PageSpeed scan and any server-level PHP change are announced first. Server-level changes also need your explicit yes.
  • A site that errors rather than loads slowly goes to troubleshooting, and a failed deploy goes to deploy.

Example prompts

What Can You Ask OpenCode to Do for Performance?

Type these as written and swap in your own repository, site and server names. Reads and routine actions such as backups, cache purges, PageSpeed scans and vulnerability scans run straight away; creating, deploying, updating, rebooting, deleting, buying or starting a broken-link scan stops and asks first.

Prompt
Why is shop.example.com slow? Read monitoring history, cache settings and the latest PageSpeed run before you answer.
Prompt
Show CPU, RAM and disk for the server behind shop.example.com over the last 24 hours. Is this new?
Prompt
Is Redis object cache on for shop.example.com? If it is off, give me the dashboard path and link.
Prompt
Why is shop.example.com slow? Check the cache, the server load and the latest PageSpeed result.
Prompt
Is Redis object cache on for the shop site? If it is off, tell me where to switch it on.
Prompt
Show CPU, RAM and disk for the shop site over the last 24 hours and tell me whether the slowdown is new.
Prompt
Run a PageSpeed scan on the shop site and compare the score with the previous scans.
Prompt
Look at the access log of the shop site for a traffic spike or a bot hammering one path.
Prompt
Which PHP version is the blog site running, and are there pending updates I should apply?
Prompt
Purge all caches on the shop site.
Prompt
Scan the shop site for broken links and list the pages with the most.

OpenCode and Performance: Frequently Asked Questions

What people ask before they let OpenCode speed up a slow site through xCloud.

Can OpenCode turn on Redis or page cache for a slow site?

No. OpenCode can read which cache layers are on and purge them, but enabling a layer for an existing site is a dashboard step under Site, WordPress, Caching. It tells you that path and gives you the site's dashboard link.

Will OpenCode use up a PageSpeed scan to check my site?

Not unless the result is missing or the site changed since the last run. It reads the latest completed result first, which is free, and says so before it starts a new scan.

Can the agent turn on caching for my slow site?

No. It can read which cache layers are on and purge them, but switching page cache, Redis object cache or Cloudflare edge cache on for an existing site is a dashboard step under Site, WordPress, Caching. The agent tells you the path and gives you the site's dashboard link.

What does a 409 mean when the agent starts a PageSpeed scan?

It means a scan for that site is still pending or running. The agent polls the existing scan instead of starting another, and it is not a cooldown period. A new scan is only worth starting when there is no recent result or the site has changed.

Will changing the server's PHP default speed up my site?

No. The server default changes only the command-line php and the version new sites get, and it does not move any existing site. The PHP version of one site is changed in the dashboard under Site, Site Settings.

Why does the agent say monitoring history is unavailable?

Monitoring history is a paid-plan feature, so on the free plan the request is refused as a plan limit. The agent reports it that way rather than saying there is no data, and it falls back to the samples and measurements the plan does include.

Does purging the cache ask for my confirmation?

xCloud itself runs a purge without a confirmation stop, because it is a routine action. The agent still asks you first on a live site, since a purge throws away a warm cache and the next visitors wait while it rebuilds.

Other agents

Performance with Other Agents

The same job, the same xCloud tools, a guide for each client.

Run Your Hosting from OpenCode

xCloud MCP, the Agent Skills and the Public API are free with every account. Connect once and ask.