Stop Copy-Pasting Errors: How to Give Claude Code a Real Linux Server via MCP
Imagine you ask Claude Code to fix a bug, but it needs to run a test and check the output. Instead of you copying the command, pasting into another terminal, and pasting the result back, you could give Claude its own Linux machine. It can run the test, see the output, and fix the code, all while staying inside the safety of a sandbox. That’s what wiring an xshellz.box into Claude Code via MCP does.
The one command that makes it work
Every xshellz.box comes as an always-on Ubuntu 24.04 machine with a hardened environment built to hand an AI agent real root safely. It uses fake-root via userns-remap and a gVisor sandbox, so the agent gets full filesystem control without touching a raw VPS. The box is free and never idle-stops.
Once you have a box (sign up at xshellz.com and grab one), you’ll see a hostname and a port in your dashboard. To let Claude Code control it, run this single command:
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp
Replace <port> and <host> with the values from your box. That command registers an MCP server named xshellz that connects over SSH using the pre-configured agent user. The xshellz-mcp executable is already installed on the box and exposes tools that let Claude Code run shell commands, read and write files, and inspect the environment, all inside that sandboxed root.
What you can do once it’s wired
Now you can ask Claude Code to handle tasks that need a real terminal. For example:
claude "fix the failing test, then run the full test suite on my xshellz box and show me the result"
Claude will SSH into the box, execute pytest or whatever you use, capture the output, and iterate on the fix. You never leave your editor, never copy-paste a command, and never worry about breaking your local machine because the box is ephemeral by default (only /home survives a reboot).
Need a dependency? You can tell Claude to install packages with apt, pip, or npm. If you want that setup to persist, put the package names in an xshellz.box manifest file on the box's /home directory; one line per package, optionally prefixed with apt:, pip:, or npm:. The box reinstalls those on every boot, so your environment is always reproducible.
This approach shines when you need a persistent environment where the agent can install packages, run long tests, or keep state between sessions. It won’t replace a full VM if you need raw host access or heavy GPU workloads, but for most coding tasks, it’s a fast, safe way to end the terminal copy-paste loop.