Wire Claude Code to a 24/7 Linux Sandbox with One MCP Command
TL;DR
- Connect Claude Code to a remote Linux box instantly with
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp.- The box runs in a gVisor sandbox with fake-root, so the agent gets a real shell without risking your local machine.
- Every xshellz.box tier is always-on and free to start, keeping your MCP server running 24/7 even when your laptop is off.
To connect Claude Code to a remote Linux box via MCP, add an MCP server with claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp. This gives Claude Code access to the box's filesystem and shell, letting the agent run commands, edit files, and iterate on code even after you close your laptop. We run this same setup on our own xshellz fleet.
how do i connect claude code to a remote linux box using mcp?
Run the command above from your local terminal. Once added, Claude Code recognizes a new tool backed by the remote box. You can then use Claude Code's normal prompts, and it will execute shell commands, list directories, and read or write files through the MCP server running on the remote host. The box already has 6 preinstalled coding agent CLIs, including Claude Code itself, so you can even chain remote agents. Get an always-on sandbox at Agent Shell (xshellz.box).
what is mcp and how does it work with ssh?
The Model Context Protocol (MCP) defines a standard way for AI agents to communicate with external tools and data sources. Claude Code uses MCP to go beyond its built-in capabilities. When you connect over SSH, the xshellz-mcp binary runs on the remote box and speaks the MCP protocol over the encrypted SSH channel. Claude Code never touches the remote box directly; it issues MCP requests like "list directory" or "run command," and the server handles them inside the sandbox. SSH provides secure authentication, so your local machine stays out of the loop.
how do i set up an mcp server on an xshellz box?
There is nothing to install. Every xshellz.box ships with xshellz-mcp preinstalled and ready under the agent user. Sign up at xshellz.com/agent-shell, grab the SSH host and port from the dashboard, and add your SSH public key. Then run the one-liner locally:
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp
Claude Code prompts you to confirm the host key, and the MCP server is immediately available. The box runs Ubuntu 24.04 LTS, with Node 22, Python 3, and 6 coding agent CLIs already installed.
can i use claude code to run commands on a remote server safely?
Yes, because the remote box is not a raw VPS. Each xshellz.box isolates the agent inside a gVisor sandbox with Linux user namespaces providing fake root. The agent thinks it has full root access, but the kernel-level sandbox restricts what it can actually do. The root filesystem is ephemeral and resets every time the box is rebuilt on a newer image; only /root persists. Even if Claude Code runs rm -rf /, the damage is contained and vanishes on the next boot. Your local machine is never exposed, because no ports are forwarded back.
what is the difference between local mcp and remote mcp over ssh?
A local MCP server runs on your laptop, shares your filesystem, and dies when you close the lid. A remote MCP over SSH decouples the agent runtime. On an xshellz.box, the environment is always-on, so you can start a long task, leave for a meeting, and come back to results. The remote box provides a consistent environment with preinstalled tools (the 6 coding agents, Node 22, Python 3) that you never need to set up locally. The persistent /root directory holds your project checkouts, logs, and agent state even when the underlying OS image is updated.
how much does it cost to keep an mcp server running 24/7?
Nothing to start. Every xshellz.box tier, including the free plan, runs 24/7 with zero idle timeout and zero trial countdown. The free tier includes the MCP server, the entire preinstalled toolchain, and a persistent /root home directory. Paid plans add more CPU, memory, and disk at xshellz.com/pricing. As of August 2026, you can keep an MCP server online indefinitely without spending a penny.
Frequently asked questions
What coding agents besides Claude Code support MCP on an xshellz.box?
The box ships with 6 preinstalled coding agent CLIs, including opencode and pi, both of which can talk to the same xshellz-mcp server. Any MCP-compatible tool that connects over SSH will work.
Does the remote box need to be on the same network as my laptop?
No. The MCP connection is a standard SSH session, so the box can be anywhere on the internet. As long as you can SSH to the box, Claude Code can reach it.
What happens if the xshellz.box reboots while my MCP session is active?
The SSH connection will drop, but the persistent /root directory remains intact. Reconnect with the same claude mcp add command, and Claude Code resumes with its workspace exactly as you left it.