← All posts

The 'Infinite Sandbox' Strategy: How to Wire an xshellz.box into Claude Code as an MCP Server

August 26, 2026 · 5 min read · The xShellz Team

TL;DR

  • Connect Claude Code to a remote Linux box over MCP with one command: claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp.
  • An xshellz.box runs in a gVisor sandbox with fake root, so you can safely give the agent full run of a Linux machine.
  • The box is always-on and the free tier has 0 idle shutdown, meaning your agent keeps working even after you close your laptop.

You connect Claude Code to a remote Linux server over MCP by adding an SSH-based MCP server with one command: claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp. We run xshellz boxes on our own fleet, and this is the exact setup our Agent Shell ships with.

how do i connect claude code to a remote linux server using mcp

Use the built-in MCP server in an xshellz.box. The box includes a dedicated agent user with the xshellz-mcp binary already in its path. From your local machine, run:

claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp

Replace <port> and <host> with the values shown in your box’s dashboard. That one line registers the remote box as an MCP server named xshellz. Claude Code can now execute commands, read files, and manage processes inside that sandbox as if it were a local extension. The connection works even over the public internet because the box runs 24/7 with no idle timeout.

what is mcp and how does it work with claude code?

MCP is the Model Context Protocol, an open standard that lets AI agents talk to local or remote services through a common interface. Instead of building a custom plugin, you define a server that exposes resources, tools, and prompts. Claude Code can connect to any MCP server and use those capabilities directly in your conversation. When you wire it to a remote Linux box over SSH, the agent gains a real shell: it can install packages, run long-lived processes, or spin up a web server. The protocol itself is transport-agnostic, but the SSH transport keeps things simple and auditable. You can read the full spec at modelcontextprotocol.io.

how do i set up an mcp server over ssh to a remote box?

An xshellz.box gives you a preconfigured MCP endpoint: the xshellz-mcp binary listens on the SSH channel and translates MCP calls into actual shell commands inside the box. No Docker, no YAML config, no TCP port to open. You just ssh in with the agent user, and the binary is invoked as the login command. The box itself runs Ubuntu 24.04 LTS with 6 preinstalled coding agent CLIs, so the environment is ready the moment you connect. If you already have a box, copy the SSH command from your dashboard. If not, spin one up from the Agent Shell page and it will be reachable in seconds.

is it safe to give claude code root access to a linux server?

Not on a raw VPS. But an xshellz.box is hardened to make root safe. It uses Linux user namespace remapping (userns-remap) so that what the agent sees as UID 0 inside the box translates to an unprivileged user on the host. On top of that, the box runs inside a gVisor sandbox, a user-space kernel that intercepts system calls and blocks dangerous actions like loading kernel modules or accessing host devices. The root filesystem is ephemeral and resets on every image rebuild, while /root persists your personal configuration. Even if an agent were to go rogue, the blast radius is contained to the re-creatable environment.

can i use an xshellz.box as an mcp server for my coding agent?

Yes, it is built for exactly that. Each box ships as an MCP server that gives Claude Code and other agents a real Linux machine with root access inside the sandbox. You get all the preinstalled tools: git, Node 22, Python 3, tmux, build-essential, and more. The agent can start a background server, run a test suite, or train a model in a notebook. Because the box is always-on, you can close your laptop and let the agent finish a long build. The free tier includes this perpetual uptime, and you can keep the box for as long as you need. When you want to automate further, you can wire the same box into borg (your terminal agent) or any other MCP-compatible tool.

Frequently asked questions

Do I need to install anything on the box to use it as an MCP server?

No. The xshellz-mcp binary and the agent user are preinstalled on every xshellz.box. You do not have to configure SSH keys, install Node, or set up any daemon. Just run the one-line claude mcp add command from your local machine, and the box is immediately available to Claude Code.

What happens if the agent breaks the box?

The root filesystem is ephemeral and resets whenever the box is rebuilt on a newer image. Your persistent data lives in /root, which survives a rebuild. If the agent corrupts something outside of /root, stopping and starting the box gives you a clean slate. No data loss for your personal configuration.

Can I use my own API keys with Claude Code on the box?

Yes. All 6 preinstalled coding agent CLIs, including Claude Code, are bring-your-own-key. You can run claude directly inside the box after connecting via MCP, and it will use whatever keys you have set up in your environment.