Claude Code + xCloud
Back up and stage sites with Claude Code on xCloud
Backing up and staging sites with Claude Code means asking Anthropic's terminal agent to check your backups, take one before a risky change and open a staging copy of the branch you are on, using xCloud's MCP tools from the same session where you write the code.
- Skill: xcloud:sites
- Toolsets: sites
- Free with every xCloud account
YouBack up shop.example.com, wait for it, then run the migration.
sites_backupStatusread-only
AgentNative site. Daily schedule is on, last backup 23 hours ago, completed, stored locally. Taking a fresh one now.
sites_backup
AgentBackup queued. Following it... completed. Running npm run migrate.
. 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 Claude Code to Back up and stage sites on xCloud?
Connect Claude Code once; every job on this account uses the same connection. Then ask in plain words.
Add the xCloud MCP server
Run this in your terminal, then type /mcp inside Claude Code, pick xcloud and choose Authenticate. The browser opens on the xCloud approval screen, where you tick the teams and choose Read-only or Full access.
claude mcp add xcloud --transport http https://app.xcloud.host/mcpInstall the xCloud skills plugin
Optional but recommended. Inside Claude Code, add the xCloud marketplace, install the plugin and reload. The nine skills teach Claude Code which tool to reach for, how to dry-run and confirm, how to poll a long job and how to diagnose a failed deploy.
/plugin marketplace add xCloudDev/xcloud-agent-skills /plugin install xcloud@xcloud-agent-skills /reload-pluginsNo 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 pass it as a header. Keep the single quotes: xCloud tokens contain a pipe character.
claude mcp add xcloud --transport http https://app.xcloud.host/mcp \ --header 'Authorization: Bearer YOUR_TOKEN'Check it worked
Then ask Claude Code for the job itself, for example:
Is the shop site backed up? Show the last backup time, its status and where it is stored.
In practice
How Does Backups and staging Work from Claude Code?
The strongest reason to do this in Claude Code is timing. You are in the project directory, about to run a migration, a dependency upgrade or a large refactor, and the safest moment for a backup is right now, not after a detour to a dashboard. You type the request where you are working. Claude Code resolves the site from the domain in the repository or from the name you give it, reads whether it is a native site or a Docker app, and calls the matching read tools: sites_backupSettings and sites_backupStatus for a native site, sites_docker_backupSettings and sites_docker_backups for a Docker app. The answer comes back as a few lines in the terminal: whether a schedule is on, when the last backup ran, whether it completed and where it is stored.
Because Claude Code can also run commands in your shell, the backup can gate the rest of the session. Tell it to take a backup of the shop site, wait until it is completed, then run the migration. Claude Code calls sites_backup, which xCloud runs without an approval prompt, follows the task until it reads completed or failed, and only then runs the next command. If the backup fails it stops and tells you why instead of carrying on. For a Docker app it says first that the app is stopped for a moment while its volumes are captured, which matters when the app is in production. The same connection works headless: claude -p with an API key that carries the mcp:invoke scope plus read:sites can run a read-only check of which sites have no backup schedule from a cron job or a CI step.
Staging is where the repository awareness pays off. Claude Code reads the current branch with git, so 'stage this branch' needs no branch name. For a Laravel, Node.js, custom PHP or Lovable site it proposes the staging environment, tells you that creating one needs a paid plan, waits for your yes, calls sites_stagingSites_create and gives you the staging URL. You can then ask it to run your smoke tests against that address from the terminal. A WordPress site is different. Staging is a dashboard step, and so is every restore, so for those Claude Code gives you the path, Site > Site Backup > Previous Backups > Restore, and the site's dashboard link instead of improvising.
Claude Code specific: A queued backup is not a finished backup, and Claude Code does not wait for one unless you say so. If you ask for a backup and a migration in separate prompts, put 'wait until it is completed' in the first one. If you installed only the xCloud plugin and skipped claude mcp add, Claude Code can read backup state through the GET-only REST fallback but cannot start a backup or create staging, so run /mcp and confirm xcloud is connected first.
What xCloud does for backups and staging
xCloud lets the agent read every site's backup state, start a backup on demand for native and Docker sites, and create a staging environment for Git sites. Restores, storage providers and WordPress staging stay in the dashboard, and the agent tells you the exact path when you ask for one.
- Find the site. The agent resolves the site by name or domain, restates which one it is about to act on, and reads whether it is a native site or a Docker app, because the two use different backup operations.
- Read the protection state. It reads the backup settings, status, count and recent backups. That answers whether the site has a schedule, when the last backup ran, whether it succeeded and where it is stored, before anything is changed.
- Back up now. A backup starts without an approval prompt. A native site takes a local backup by default or a remote one when a storage provider is connected. A Docker app is stopped briefly while its volumes are captured, so the agent says so before it backs up a production app.
- Wait for the result. xCloud queues the backup and returns straight away. The agent follows the backup task or row until it is terminal, then reports completed or failed instead of treating the queued response as done.
- Stage the change. For a Git site such as Laravel, Node.js, custom PHP or Lovable, the agent creates a staging environment from the branch you name, after you approve, and gives you its URL. A WordPress staging site is a dashboard step, and the agent gives you the path.
- Hand off restores and settings. If you ask to restore a backup, change a native site's schedule or add a storage provider, the agent explains that these are dashboard-only and gives the path and the site's dashboard link. It never improvises a workaround.
Reference
Backups and staging Settings and Limits on xCloud
The facts Claude Code works within when it backs up and stage sites. Where a row names the dashboard, that step stays yours to take there.
| Setting or limit | What applies |
|---|---|
| Native site backup | On demand through the API; the type is local (the default) or remote. A remote backup needs a storage provider with a working connection, otherwise xCloud refuses it with a 422 before anything is queued |
| Docker app backup | On demand through the API for Compose deploys and most one-click apps. The app is cold-stopped for a moment while volumes are captured. A remote copy goes to an S3-compatible or SFTP provider; Google Drive and pCloud are not supported for Docker apps |
| Reading backups | Backup list, count, status and settings are readable for every site. Docker apps also expose one backup's detail |
| Docker backup housekeeping | The agent can label a Docker backup with a note and delete one. Deleting is irreversible, so it names the exact backup by date and note first |
| Native schedule and retention | Read-only through the API. Change them in the dashboard under Site > Site Backup > Backup Settings |
| Docker backup settings | Writable through the API: automatic backup on or off, daily, weekly or monthly frequency, and the number of days to keep backups |
| Restores | Dashboard-only for every site type: Site > Site Backup > Previous Backups > Restore. A backup can also be restored to another site from the same page |
| Storage providers | Dashboard-only, under Integrations > Storage Provider. Backup settings return a provider's identifier and status, never its credentials |
| Team-wide backup policy | Applying one backup policy to many sites is dashboard-only, under Global Settings > Site Backup |
| Git staging | Created through the API for Git sites on paid plans. On the free plan xCloud answers 403 because it is a plan limit, not a permission |
| WordPress staging | Dashboard-only: xCloud answers 422 when the API is asked for it. Push and pull between staging and production also happen in the dashboard |
| Snapshots | Snapshots are listed per site. The server-wide snapshot list holds site snapshots, not a server image. Taking or restoring a snapshot, and a whole-server provider backup, stay in the dashboard |
Rules Claude Code has to follow
- A backup runs without an approval prompt, but the agent says when it briefly stops a Docker app and does not trigger one on a busy production app without telling you.
- A queued backup is not a finished backup: the agent reports completed or failed only after it has read the result.
- Restoring a backup, changing a native site's schedule, adding a storage provider and creating WordPress staging are dashboard steps; the agent gives you the path instead of guessing an operation.
- Creating a staging environment stops for your approval, and deleting a backup names the exact backup first.
- Before you push staging data to production in the dashboard, take a backup of the production site so you can recover if the push goes wrong.
Example prompts
What Can You Ask Claude Code to Do for Backups and staging?
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.
Is the shop site backed up? Show the last backup time, its status and where it is stored.Back up the shop site, wait until it is completed, then run npm run migrate. Stop if the backup fails.Create a staging environment for the API site from the branch I am on and print the URL.When was the last backup of the shop site, did it succeed, and where is it stored?Check the backup settings on every site and list the ones with no schedule.Take a backup of the n8n Docker app now, before I upgrade it, and tell me when it is done.Switch the n8n Docker app to a daily backup and keep backups for 14 days. Show me the change before you apply it.Create a staging environment for the API site from the feature/checkout branch and give me its URL.List the snapshots of the shop site and tell me which is newest.I need to restore the shop site to last night's backup. Tell me where to click.Claude Code and Backups and staging: Frequently Asked Questions
What people ask before they let Claude Code back up and stage sites through xCloud.
Can Claude Code run my migration only after the backup finishes?
Yes, if you ask for it in the same prompt. Claude Code starts the backup, follows it until xCloud reports completed or failed, and runs the migration only on completed. If the backup fails, it stops and reports the failure.
Does Claude Code know which branch to stage?
Yes. Started inside the repository, it reads the current branch with git and uses it unless you name another. Creating a staging environment still stops for your approval, and it needs a paid plan and a Git site such as Laravel, Node.js, custom PHP or Lovable.
Can an AI agent restore a backup for me?
No. Restoring a native or Docker backup is a dashboard step, under Site > Site Backup > Previous Backups > Restore. The agent can list the backups, tell you which one is newest and completed, and give you the site's dashboard link so you can start the restore yourself.
Does the agent ask before it takes a backup?
No. A backup is a routine action, so xCloud runs it without a confirmation prompt. For a Docker app the agent tells you first that the app stops briefly while its data is captured, and it reports the result only after the backup has finished.
Can the agent change my backup schedule?
For Docker apps, yes: it can turn automatic backups on or off, set daily, weekly or monthly, and set how many days backups are kept. For native sites the schedule, retention and destination are read-only through the API, so you change them in the dashboard under Site > Site Backup > Backup Settings.
Can the agent connect my S3 bucket or other storage?
No. Storage providers are added in the dashboard, under Integrations > Storage Provider, so credentials never pass through a chat. Once a provider exists, the agent can read which one a site's backup settings point at and use it for a remote backup.
Can the agent create a staging site for WordPress?
Not through the API. xCloud answers 422 for WordPress staging, so you create it in the dashboard from the site overview. For Laravel, Node.js, custom PHP and Lovable sites the agent can create a staging environment, which needs a paid plan.
Other agents
Backups and staging with Other Agents
The same job, the same xCloud tools, a guide for each client.
- Back up and stage sites with ClaudeAnthropic's chat assistant on the web and desktop. Add xCloud as a custom connector, no terminal needed.
- Back up and stage sites with Claude CoworkAnthropic's desktop agent for delegated work. Add the xCloud connector, then hand off hosting jobs.
- Back up and stage sites with CursorThe AI code editor. One mcp.json entry with the compact URL, because Cursor stops at 40 tools.
- Back up and stage sites with CodexOpenAI's coding agent for the terminal. A codex mcp add command or a config.toml entry, then codex mcp login.
- Back up and stage sites with OpenCodeThe open-source terminal coding agent. One remote MCP entry, then opencode mcp auth xcloud.
- Back up and stage sites with Hermes AgentNous Research's agent with memory and a built-in scheduler. An mcp_servers entry in config.yaml and one login.
- Back up and stage sites with OpenClawThe open-source agent runtime with chat apps and automations. ClawHub skill plus the MCP client.
- Back up and stage sites with WindsurfThe Cognition editor, now Devin Desktop. devin mcp add for the Devin Local agent, a serverUrl entry for legacy Cascade.
- Back up and stage sites with GitHub CopilotCopilot agent mode in VS Code. One .vscode/mcp.json entry, or the Agent Plugins package.
- Back up and stage sites with Gemini CLIGoogle's terminal agent. One gemini mcp add command, OAuth found automatically.
- Back up and stage sites with ChatGPTOpenAI's chat assistant. A developer-mode app with the xCloud MCP URL and OAuth.
- Back up and stage sites with ChatGPT dotsOpenAI's always-on agent in ChatGPT. Uses the xCloud MCP plugin you add in ChatGPT, with custom rules and scheduled tasks.
- Back up and stage sites with GrokxAI's terminal agent, Grok Build. One grok mcp add command or a config.toml entry.
- Back up and stage sites with Grok BotxAI's always-on Bots on a cloud computer. One Remote HTTPS MCP plugin, OAuth sign-in, routines on a schedule.
- Back up and stage sites with KiroAWS's agentic IDE. One url entry in .kiro/settings/mcp.json, plus the portable xCloud Agent Plugins package.
- Back up and stage sites with AntigravityGoogle's agentic IDE. One serverUrl entry in mcp_config.json and a browser sign-in.
- Back up and stage sites with ZedThe Zed editor's Agent Panel. One context_servers entry in settings.json and a browser sign-in.
More Claude Code guides
- Claude Code and xCloud overview
- Deploy from Git with Claude Code
- Run Docker apps with Claude Code
- Install one-click apps with Claude Code
- Manage WordPress with Claude Code
- Manage SSL and domains with Claude Code
- Manage servers with Claude Code
- Troubleshoot a broken site with Claude Code
- Speed up a slow site with Claude Code
- Secure sites and servers with Claude Code
Run Your Hosting from Claude Code
xCloud MCP, the Agent Skills and the Public API are free with every account. Connect once and ask.