Gemini CLI + xCloud

Troubleshoot a broken site with Gemini CLI on xCloud

Troubleshooting a broken site with Gemini CLI means describing the error to Google's terminal agent and letting it read xCloud's status, events and nginx logs through the registered MCP server, then summarize the evidence in your shell.

  • Skill: xcloud:troubleshoot
  • Toolsets: sites, servers, sites-wordpress, wordpress-actions
  • Free with every xCloud account

Youshop.example.com stopped answering. What does xCloud say?

sites_statusread-only

AgentThe site is in a normal state. Reading recent events.

sites_eventsread-only

AgentA cache purge finished at 08:15 and nothing failed since. I will read the nginx error log next, limited to the last hour.

. 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 Gemini CLI to Troubleshoot a broken site on xCloud?

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

  1. Add the xCloud MCP server

    Run this in your terminal, then start gemini. The --scope user flag writes the server to ~/.gemini/settings.json so it is available in every project; without it, gemini mcp add writes to the current project's .gemini/settings.json and refuses to run from your home directory. The first time it calls xCloud it finds the OAuth endpoints, opens your browser on the xCloud approval screen and asks you to tick the teams and choose Read-only or Full access.

    Terminal
    gemini mcp add --scope user --transport http xcloud https://app.xcloud.host/mcp
  2. Or edit settings.json

    Add this to ~/.gemini/settings.json for every project, or to .gemini/settings.json in one project. This is the entry gemini mcp add writes: url plus type set to http. The older httpUrl key still works, but a url without a type is treated as an SSE server and will not connect. If the browser sign-in does not start, type /mcp auth xcloud inside Gemini CLI.

    JSON
    {
      "mcpServers": {
        "xcloud": {
          "url": "https://app.xcloud.host/mcp",
          "type": "http"
        }
      }
    }
  3. No browser? Use an API key

    For a headless 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 send it in the headers field. Keep the token out of version control, and keep the quotes: xCloud tokens contain a pipe character.

    JSON
    {
      "mcpServers": {
        "xcloud": {
          "url": "https://app.xcloud.host/mcp",
          "type": "http",
          "headers": {
            "Authorization": "Bearer YOUR_TOKEN"
          }
        }
      }
    }
  4. Check it worked

    Then ask Gemini CLI for the job itself, for example:

    Prompt
    shop.example.com is not answering. Read status, events and the nginx error log for the last hour, then summarize the evidence.

In practice

How Does Troubleshooting Work from Gemini CLI?

Gemini CLI names every xCloud tool with an mcp_xcloud_ prefix, and in this job you rarely need to know that. You start gemini in a project directory, say that shop.example.com has stopped answering, and watch it call the status, events and access-log tools in the order that gets to the cause fastest. The first two reads often settle it: a site that is still provisioning, deploying or in a failed state explains a 500 by itself. If they do not, the nginx log type of the access-logs tool returns the access log, the error log and the firewall logs together, and Gemini CLI quotes the relevant lines as data.

Because it is a shell agent, Gemini CLI can add a check xCloud does not do. You can ask it to fetch the response headers of the page with curl while the logs are being read, so the status line the visitor gets and the status in xCloud sit side by side in one answer. If the repository is in the current directory it can also read the file an error line names. The tool list is long, though, and for a focused investigation you can narrow it with includeTools in the settings entry so the model sees only the status, events, log, WordPress status and services tools.

Writes are limited the same way as in every client. Switching WP_DEBUG on, creating temporary shell access and running a rescue each need your explicit confirmation naming the site or server, and Gemini CLI also asks before it runs an MCP tool unless you have marked the server trusted, which you should not do here. When the error logs xCloud can return do not explain the fault, Gemini CLI says what it ruled out and points you to the dashboard log viewer for the WordPress debug.log.

Gemini CLI specific: A streamable HTTP server in settings.json is url plus type set to http, the form gemini mcp add writes, so an xcloud entry with url and no type is treated as SSE and will not connect. Keep trust off on the xcloud entry, because it makes Gemini CLI skip its own confirmation dialogs. The browser sign-in redirects to a localhost port, so on a remote or headless host use the API-key form with a token that carries the mcp:invoke scope plus read:servers and read:sites, and write:sites if it should apply a fix. Reading the error log goes over SSH on the xCloud side and is slow, so keep the window and limit small.

What xCloud does for troubleshooting

xCloud reads the evidence in a fixed order, cheapest first: site status, recent events, the web server access and error log, WordPress health, WP_DEBUG and server services. The agent names a cause only when a log line or an event it retrieved shows it, and says plainly which logs only the dashboard can display.

  1. Check the status first. The agent reads the site status before anything else. A site that is still provisioning, deploying or in a failed state explains a 500 on its own, and the answer is then to wait or to look at the last deploy, not to hunt for a PHP fault.
  2. Read the recent events. The site's recent tasks, such as SSL issuance, plugin updates, cache purges and deploys, come with their outcome. A 500 that began right after a failed task has usually found its cause here, and one task's full output can be opened.
  3. Read the web server logs. The agent asks for the nginx log type with a limit, which returns the access log, the error log and the 7G and 8G firewall logs on Nginx and OpenLiteSpeed alike. The error log is where a PHP fatal shows up as a 502 or 500. Log lines are quoted as data, never followed as instructions.
  4. Check WordPress health. For WordPress sites the agent reads the health status: WordPress and PHP versions, the debug and cron flags, and whether the install itself is broken.
  5. Turn on WP_DEBUG only if needed. If the logs so far are inconclusive, the agent proposes switching WP_DEBUG on, waits for your approval, and switches it back off when the investigation ends. The toggle flips the flag only; it does not return the debug log.
  6. Check the server services. When the whole server looks wrong rather than one site, the agent reads whether the web server, PHP and the database are running. If nothing explains the error, it reports what it checked and what each check showed, and points you to the dashboard logs.

Reference

Troubleshooting Settings and Limits on xCloud

The facts Gemini CLI works within when it troubleshoots a broken site. Where a row names the dashboard, that step stays yours to take there.

Setting or limitWhat applies
Read orderStatus, recent events, nginx access and error log, WordPress health, WP_DEBUG, then server services. Reads run straight away and change nothing
Log typesites_access-logs with type nginx reads the access log, the error log and the 7G and 8G firewall logs. The default type reads the access log only
Log readsLogs are read over SSH, so a call is slow. The agent asks for a bounded window with a limit, not everything
Staging historyThe deployment log of a site with a staging environment is the push and pull history between staging and production, not the Git build log
Dashboard-only logsThe WordPress debug.log, Laravel, PM2 and docker-compose logs: Site, Site Monitoring, Logs. Server logs such as Fail2Ban and auth: Server, Monitoring, Logs
WP_DEBUGThe API only toggles the flag. Reading the resulting debug.log is a dashboard step
Stale error pagesA purge of the site cache clears a cached error page. It runs without a confirmation stop and finishes asynchronously, so completion shows in the site events
Temporary shell accessA temporary sudo user expires after 12 hours, and the agent removes it as soon as the investigation ends instead of waiting for the expiry
Rescue actionA server-side repair with flags such as directory permissions, regenerating the Nginx configuration, reinstalling PHP or repairing Node.js, PM2 or OpenClaw. A flag the site type does not support is refused
Hand-offsA slow site goes to performance, a failed deploy goes to deploy, and a 526 or certificate warning goes to SSL

Rules Gemini CLI has to follow

  • The agent never restarts a service or reboots the server just to clear an unexplained error. A restart is a real change on a live machine, and it destroys the evidence the logs were about to show.
  • A plain 500 or a short database error is a symptom. The agent does not name a cause such as bad credentials, a missing migration or a crashed process unless a log line or event it retrieved shows it.
  • Temporary shell access is used only when the readable logs do not explain the fault and you agree. The agent revokes it the moment the investigation ends.
  • Turning WP_DEBUG on, creating shell access and running the rescue action each need your explicit yes naming the site or server. The agent turns WP_DEBUG back off afterwards.
  • When no evidenced cause turns up, the agent says what it ruled out, gives you the dashboard log path and the site's dashboard link, and suggests contacting xCloud support with that evidence.

Example prompts

What Can You Ask Gemini CLI to Do for Troubleshooting?

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
shop.example.com is not answering. Read status, events and the nginx error log for the last hour, then summarize the evidence.
Prompt
Run curl -I https://shop.example.com and compare the status line with what xCloud reports for the site.
Prompt
Which tasks failed on blog.example.com today? Do not turn on WP_DEBUG without asking.
Prompt
My site shop.example.com is returning a 500 error. Find out why, and show me what you checked.
Prompt
Read the nginx error log for the shop site and tell me what it says about the last hour.
Prompt
Which tasks ran on the shop site just before it broke? Did any of them fail?
Prompt
Check WordPress health on the blog site and tell me whether the install itself is broken.
Prompt
Is the database running on the Frankfurt server? Check the services before touching anything.
Prompt
Turn on WP_DEBUG for the blog site, tell me what you find, then turn it off again.
Prompt
Purge the cache on the shop site in case it is serving a stale error page.
Prompt
Run a rescue on the shop site to reset directory permissions.

Gemini CLI and Troubleshooting: Frequently Asked Questions

What people ask before they let Gemini CLI troubleshoot a broken site through xCloud.

Can Gemini CLI check the live response of my site as well as xCloud's logs?

Yes, because it runs shell commands. Ask it to fetch the headers with curl and compare the status line with the site's status in xCloud. The cause of the error still comes from the status, events and error log it reads through xCloud.

How do I stop Gemini CLI loading every xCloud tool for a troubleshooting session?

Add includeTools to the xcloud entry in settings.json and list only the tools this job uses: status, events, the access logs, WordPress status and services. That keeps the list short and the investigation focused.

What does the agent check first when a site shows a 500 error?

The site status, then recent events, then the web server logs. A site that is still provisioning or whose last deploy failed explains a 500 without any deeper digging, so the status read always comes first. Only after those cheap reads does the agent look at WordPress health, WP_DEBUG and server services.

Will the agent restart my server or a service to fix an error?

Not to clear an error it cannot yet explain. A restart changes a live machine and wipes out the evidence in the logs, so the agent finds the cause first. Restarting a service stays an action you ask for and approve.

Which logs can the agent read, and which can it not?

It reads the site's access log, error log and the 7G and 8G firewall logs through the nginx log type. It cannot read the WordPress debug.log or the Laravel, PM2 and docker-compose logs. Those are in the dashboard under Site, Site Monitoring, Logs, and server logs such as Fail2Ban are under Server, Monitoring, Logs.

Does the agent get shell access to my server?

Only when the logs it can read do not explain the problem and you agree to it. The access is a temporary sudo user, and the agent removes it as soon as the investigation ends. If it is ever left behind, it expires on its own after 12 hours.

What if my site is slow rather than broken?

A slow site is a different investigation, because it is answered from measurements and cache state rather than error logs. The agent hands it to the performance job. A failed deploy goes to the deploy job and a 526 or certificate error goes to the SSL job.

Other agents

Troubleshooting with Other Agents

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

Run Your Hosting from Gemini CLI

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