OpenCode + xCloud
Secure sites and servers with OpenCode on xCloud
Securing sites and servers with OpenCode means asking the open-source terminal agent to read vulnerability findings, firewall rules and Fail2Ban bans from xCloud, and to change the perimeter only after you confirm the server and the effect.
- Skill: xcloud:servers
- Toolsets: vulnerabilities, servers, sites, wordpress-actions
- Free with every xCloud account
YouShow vulnerability counts for every site, worst first.
xcloud_vulnerabilities_indexread-only
Agentshop.example.com has 1 critical and 2 high, blog.example.com has 1 medium, docs.example.com is clean. The critical one is in a checkout plugin and is fixed in a newer version. Want me to back up the shop and update it?
YouYes, then rescan.
xcloud_sites_wordpress_updateneeds approval
AgentBackup finished and the plugin is updated. I started a rescan and will read the count again in a minute.
. 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 Secure sites and servers on xCloud?
Connect OpenCode once; every job on this account uses the same connection. Then ask in plain words.
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.
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" } } } }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.
opencode mcp auth xcloud opencode mcp listNo 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.
{ "mcp": { "servers": { "xcloud": { "type": "remote", "url": "https://app.xcloud.host/mcp", "oauth": false, "headers": { "Authorization": "Bearer {env:XCLOUD_TOKEN}" } } } } }Check it worked
Then ask OpenCode for the job itself, for example:
Show vulnerability counts for every site on this team, worst first. Name the top three findings.
In practice
How Does Security Work from OpenCode?
OpenCode lives in the terminal you already use for code, so a security check is one line typed between a commit and a push. xCloud's tools arrive with a server prefix, which means every call you see in the session starts with xcloud_: xcloud_vulnerabilities_index for the team-wide rollup, xcloud_sites_vulnerabilities_list for one site. You ask which sites carry the worst findings, OpenCode makes the single rollup call, and the answer comes back sorted worst first with the plugin or theme each finding names. There is no dashboard tab to open and no table to export. The list sits in your scrollback, where you can copy a plugin name straight into the next prompt.
The perimeter work is where OpenCode's per-agent controls earn their place. You can switch a server's tools off globally and turn them on for a single agent, and for this job that is a sensible split: keep xcloud away from your everyday coding agent and enable it for an operations agent that you open when you review a server. Firewall rules, Fail2Ban bans, the SSH restriction state and sudo users are read with xcloud_servers_firewallRules, xcloud_servers_fail2ban_banned-ips, xcloud_servers_firewall_ssh-restriction-status and xcloud_servers_sudoUsers_index, and none of those reads stops for a prompt. A ban, an unban, a new rule or a sudo change is different. OpenCode names the server and the effect first and waits for your yes, and it explains the SSH lockout risk before anything touches port 22.
What comes back also differs from a dashboard in one useful way: OpenCode tells you what it cannot do. Ask it to switch on the 8G firewall or the AI bot blocker and it answers with the dashboard path instead of pretending, because both are dashboard switches. It can still read what those rules block through xcloud_sites_access-logs with the nginx log type. When a finding points at a plugin, OpenCode proposes the update, offers xcloud_sites_backup first, and rescans with xcloud_sites_vulnerability-scan afterwards. A rescan finishes asynchronously, so it checks the count again before it tells you the finding is gone.
OpenCode specific: The full xCloud server is 188 operations plus two search tools, and all of them land in OpenCode's context. For a security session, scope the connection with the toolsets parameter, https://app.xcloud.host/mcp?toolsets=vulnerabilities,servers, so the vulnerability, firewall and Fail2Ban tools are present and the rest are not. If you sign in with Read-only access on the xCloud approval screen, an audit session cannot change anything even by mistake, and you can run opencode mcp auth xcloud again with Full access the day you want to ban an address. Keep the xcloud* pattern out of any allow list that skips prompts, so OpenCode's own check stands beside xCloud's confirmation.
What xCloud does for security
xCloud reads vulnerability findings for one site or across your whole team, starts rescans and ignores or restores a finding. On servers it manages firewall rules, Fail2Ban bans, the SSH restriction state and sudo users. Protections such as the AI bot blocker, the 7G and 8G firewall and per-site IP rules stay dashboard switches.
- Start with the team-wide rollup. For a fleet question the agent reads the vulnerability rollup across every site on the team in one call and sorts it worst first. For one site it reads the findings and the counts by severity instead.
- Rescan and triage findings. A rescan runs without a confirmation stop and finishes asynchronously, so the agent checks the count again afterwards. Findings carry a severity and a source, and severity is the triage key. A false positive can be ignored with a reason and restored later.
- Fix what the finding points to. Most findings are fixed by updating a plugin, a theme or WordPress core. The agent proposes the updates, takes a backup first if you want one, and waits for your approval, because updating plugins or themes always stops for confirmation.
- Review the server's perimeter. The agent reads firewall rules, the Fail2Ban banned IP list, the SSH restriction status and the sudo users. It can add or disable a rule, ban or unban an address and whitelist xCloud's own IPs after you confirm the server and the effect.
- Report what is dashboard-only. AI bot blocking, the 7G and 8G firewall and a single site's IP allow and block list are dashboard switches. The agent reads what it can, such as the 7G and 8G logs, and gives you the dashboard path and the site's dashboard link for the rest.
Reference
Security Settings and Limits on xCloud
The facts OpenCode works within when it secures sites and servers. Where a row names the dashboard, that step stays yours to take there.
| Setting or limit | What applies |
|---|---|
| Vulnerability findings | Per-site list and counts by severity (critical, high, medium, low), plus a team-wide rollup across every site you can reach |
| Rescans | Triggering a rescan is a routine action that runs without a confirmation stop. It is asynchronous, so the agent polls the count or the site events |
| Ignore and restore | A finding can be ignored with a reason and un-ignored later. Both are changes to the finding, not to the site |
| Firewall rules | List, create, enable, disable and delete server rules by name, protocol (tcp or udp), traffic (allow or deny), port and optional source IP |
| Fail2Ban | List banned IPs, ban one or more addresses and unban an address. Adding addresses to Fail2Ban's own ignore list is an SSH step described in the Fail2Ban guide |
| Whitelisting | xCloud's infrastructure IPs and the caller's IP can be whitelisted. The SSH restriction status says whether SSH is limited to trusted addresses |
| Sudo users | List, create or update, and delete OS-level privileged accounts. Private keys are never returned, and a temporary account is available for short jobs |
| 7G and 8G firewall | Switched on in the dashboard. Their logs are readable through the nginx log type of the site's access log read |
| AI bot blocker | A dashboard toggle: Site, Tools, Nginx and Security on Nginx, Tools, Security on OpenLiteSpeed |
| Per-site IP rules | Dashboard-only: Site, Tools, IP Management. The API lists a site's rules but does not change them; server-wide blocks are on the API |
| Automated security updates | xCloud installs security updates on servers it provisions, and Automatic Reboot restarts the server only when a reboot is required. Both are configured in the dashboard |
| Security headers | The API lists a site's custom Nginx configuration. Adding headers is a dashboard or SSH step, described in the security headers guide |
Rules OpenCode has to follow
- Firewall, Fail2Ban and sudo-user changes name the exact server and the effect before they run, and they wait for your yes. Locking out SSH is the risk the agent explains first.
- The agent never disables SSH or a database service to tidy up a ruleset, and it does not delete the default SSH rule on its own.
- Updating a plugin or theme to fix a finding stops for your approval, and the agent offers a backup first.
- Ignoring a finding needs a reason you give. The agent records it and tells you how to restore it.
- AI bot blocking, the 7G and 8G firewall, per-site IP rules and automated update settings are dashboard steps. The agent says so, gives the path and the dashboard link, and never claims it changed them.
- A temporary sudo user is for a specific job and is removed when the job ends.
Example prompts
What Can You Ask OpenCode to Do for Security?
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.
Show vulnerability counts for every site on this team, worst first. Name the top three findings.List firewall rules and Fail2Ban bans on the Frankfurt server. Is SSH restricted to trusted IPs?Rescan shop.example.com, wait for it to finish, then diff the findings against the last list.Show the vulnerability count for every site on this team, sorted worst first, and name the top three findings.Run a vulnerability scan on the shop site and tell me what it finds.List the findings on the blog site and ignore the false positive in the contact form plugin, with the reason.Update every plugin on the shop site, then run a vulnerability scan, and stop if anything is still open.List the firewall rules on the Frankfurt server and tell me whether SSH is restricted to trusted IPs.Show the IPs Fail2Ban has banned on the Frankfurt server, and unban 203.0.113.10.Whitelist the xCloud IPs on the Frankfurt server.Which sudo users exist on the Frankfurt server? Flag any that look temporary or unused.OpenCode and Security: Frequently Asked Questions
What people ask before they let OpenCode secure sites and servers through xCloud.
Can OpenCode ban an IP address on my xCloud server?
Yes, with Full access. OpenCode calls the Fail2Ban ban tool for the address you name, but it states the server and the effect first and waits for your yes. With Read-only access it can list the banned IPs and nothing more.
How do I keep OpenCode from touching firewall rules in my everyday sessions?
Turn the xcloud tools off globally in your OpenCode config and enable them only for an operations agent. Because OpenCode prefixes every xCloud tool with xcloud_, one pattern covers the whole set, including the firewall and sudo-user tools.
Can an agent show vulnerabilities across all my sites at once?
Yes. xCloud has a team-wide rollup that lists findings for every site you can reach, which the agent sorts worst first. For one site it reads the findings and the counts by severity, and it can start a rescan.
Can the agent ban an IP address on my server?
Yes. It can ban addresses in Fail2Ban, list the banned IPs and unban one, and it can create, disable and delete server firewall rules. It confirms the server and the effect first, so you do not lock yourself out.
Can the agent turn on the 8G firewall or the AI bot blocker?
No. Both are dashboard switches. The agent can read the 7G and 8G firewall logs through the site's nginx logs, and it tells you where the switches are: the site's Tools section. It does not claim to have changed them.
Can the agent block an IP for just one site?
Not from here. Per-site IP allow and block lists are managed in the dashboard under Site, Tools, IP Management, and the agent can only list what is there. Server-wide blocks, through firewall rules and Fail2Ban, are on the API.
Does the agent fix a vulnerability on its own?
No. It reports the finding and proposes the update that remediates it, usually a plugin, theme or core update. Updates always stop for your approval, and the agent can take a backup first and rescan afterwards to confirm the finding is gone.
Other agents
Security with Other Agents
The same job, the same xCloud tools, a guide for each client.
- Secure sites and servers with Claude CodeAnthropic's terminal coding agent. One claude mcp add command, plus the xCloud skills plugin with nine skills on top.
- Secure sites and servers with ClaudeAnthropic's chat assistant on the web and desktop. Add xCloud as a custom connector, no terminal needed.
- Secure sites and servers with Claude CoworkAnthropic's desktop agent for delegated work. Add the xCloud connector, then hand off hosting jobs.
- Secure sites and servers with CursorThe AI code editor. One mcp.json entry with the compact URL, because Cursor stops at 40 tools.
- Secure sites and servers with CodexOpenAI's coding agent for the terminal. A codex mcp add command or a config.toml entry, then codex mcp login.
- Secure sites and servers with Hermes AgentNous Research's agent with memory and a built-in scheduler. An mcp_servers entry in config.yaml and one login.
- Secure sites and servers with OpenClawThe open-source agent runtime with chat apps and automations. ClawHub skill plus the MCP client.
- Secure sites and servers with WindsurfThe Cognition editor, now Devin Desktop. devin mcp add for the Devin Local agent, a serverUrl entry for legacy Cascade.
- Secure sites and servers with GitHub CopilotCopilot agent mode in VS Code. One .vscode/mcp.json entry, or the Agent Plugins package.
- Secure sites and servers with Gemini CLIGoogle's terminal agent. One gemini mcp add command, OAuth found automatically.
- Secure sites and servers with ChatGPTOpenAI's chat assistant. A developer-mode app with the xCloud MCP URL and OAuth.
- Secure sites and servers with ChatGPT dotsOpenAI's always-on agent in ChatGPT. Uses the xCloud MCP plugin you add in ChatGPT, with custom rules and scheduled tasks.
- Secure sites and servers with GrokxAI's terminal agent, Grok Build. One grok mcp add command or a config.toml entry.
- Secure sites and servers with Grok BotxAI's always-on Bots on a cloud computer. One Remote HTTPS MCP plugin, OAuth sign-in, routines on a schedule.
- Secure sites and servers with KiroAWS's agentic IDE. One url entry in .kiro/settings/mcp.json, plus the portable xCloud Agent Plugins package.
- Secure sites and servers with AntigravityGoogle's agentic IDE. One serverUrl entry in mcp_config.json and a browser sign-in.
- Secure sites and servers with ZedThe Zed editor's Agent Panel. One context_servers entry in settings.json and a browser sign-in.
More OpenCode guides
- OpenCode and xCloud overview
- Deploy from Git with OpenCode
- Run Docker apps with OpenCode
- Install one-click apps with OpenCode
- Manage WordPress with OpenCode
- Back up and stage sites with OpenCode
- Manage SSL and domains with OpenCode
- Manage servers with OpenCode
- Troubleshoot a broken site with OpenCode
- Speed up a slow site with OpenCode
Run Your Hosting from OpenCode
xCloud MCP, the Agent Skills and the Public API are free with every account. Connect once and ask.