Give Claude Code a Remote Linux Box That Never Sleeps (Using MCP)
TL;DR
- Claude Code connects to a remote xshellz.box via MCP with one command:
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp.- The box is an always-on Ubuntu 24.04 sandbox; it runs 24/7, keeps your agent alive when your laptop sleeps, and costs from $0/month with no idle timeout.
- Root access is safe because the box uses gVisor and Linux userns-remap to give the agent a fake root environment, not real host control.
Claude Code can run commands on a remote Linux server via MCP. Connect an xshellz.box, the always-on sandbox we operate, by adding the xshellz-mcp server: claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp. Claude Code then reads files, runs builds, and executes code on the hardened box instead of your laptop. Same setup our production fleet uses.
How can I let Claude Code run commands on a remote Linux server using MCP?
The short answer is the one-line SSH command above. The xshellz.box agent shell ships with a preinstalled MCP server, so you need zero configuration on the box side. When you add that server to Claude Code, every command it runs goes to the remote sandbox, not your local machine. Because the box is always-on (every tier, including free, with 0 idle timeout), a long-running build or a test suite keeps going after you close your laptop lid.
What is MCP and how does it work with Claude Code?
The Model Context Protocol (MCP) is an open standard that lets AI agents talk to external tools over a uniform interface. Claude Code treats an MCP server as a set of capabilities it can call: run a shell command, list a directory, read a file. When you register a remote box as an MCP server, the protocol handles authentication and serialization; your SSH transport does the heavy lifting. On the box, the xshellz-mcp binary sits behind the agent user and translates MCP requests into real operations inside the sandbox. No sockets to expose, no bespoke daemon to manage.
How do I connect Claude Code to an xshellz.box via SSH?
Grab a box from the Agent Shell dashboard. You get an SSH hostname and a port. Then run one command on your laptop:
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp
That is it. The box already has the MCP server and all 6 preinstalled coding agents (borg, Claude Code, Codex, Gemini, opencode, pi). Claude Code can now ask the box to compile code, lint a project, or run a suite; the output streams back to your terminal. The box runs Ubuntu 24.04 LTS, so you have a familiar environment, and because it is always-on, an agent session survives a laptop reboot.
Is it safe to give Claude Code root access to a remote box?
Absolutely, because the root the agent sees is not real host root. Every xshellz.box uses gVisor and Linux user-namespace remapping to create a fake-root sandbox. The agent can apt install packages, write to system directories, and even break things inside the container, but it cannot escape to the underlying hypervisor or your other boxes. Only your /root home directory persists across rebuilds; the rest of the filesystem resets when the box is updated, so a rogue command cannot permanently damage the OS. You get real root power inside a padded cell.
How much does it cost to run an MCP server on an always-on box?
Every xshellz.box tier is always-on, including the free plan ($0/month). There is no trial countdown and no idle shutdown: the box stays online 24/7 while you pay for the resources you pick. The MCP server binary is preinstalled on every box at no extra cost, and you bring your own Claude Code subscription or API key. The only recurring cost is the box itself, which you can spin up and tear down in seconds if you need it only occasionally.
Frequently asked questions
Can I use my own SSH key to connect Claude Code to the box?
Yes. The box gives you root SSH access with your own key pair. The MCP connection uses a preconfigured agent user; you can rotate that key through the xshellz dashboard without touching the server binary.
What happens if my laptop goes to sleep while Claude Code is working on the box?
Nothing stops. The box is always-on, so the MCP server keeps running. When you wake the laptop, Claude Code reconnects and picks up where it left off. No build gets killed because the lid closed.
Do I need to install the MCP server on the box myself?
No. The xshellz-mcp binary ships on every new box, including the free plan. You only need to run the claude mcp add command on your local machine to wire them together.