Connect Claude Code to a Remote Linux Box via MCP: One Command, Zero Timeouts
TL;DR
- Run
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcpto give Claude Code a persistent remote sandbox that never sleeps.- The sandbox provides fake-root access inside a gVisor sandbox with user-namespace remapping, so your agent can install packages, write files, and run builds safely off your laptop.
- Every xshellz box is always-on with no idle timeout; your coding session survives closing your laptop, so the agent keeps working while you're away.
Give Claude Code a remote Linux playground that stays up when you close the lid. We operate the xShellz fleet, and this is the setup our own boxes use: one command links Claude Code to a hardened Ubuntu 24.04 environment.
how do i connect claude code to a remote linux box via mcp
From your local machine, run:
claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp
That command tells Claude Code to treat the remote box as an MCP server over SSH. Your agent will execute shell commands, read and write files, and manage processes inside the box instead of on your laptop. Replace <port> and <host> with the details from your xshellz.box dashboard.
what is mcp for ai coding agents
The Model Context Protocol lets AI tools like Claude Code talk to external servers in a structured way. Instead of running everything locally, the agent sends tool requests to a remote system that handles them securely. For details, see the MCP specification. When you use the command above, your local Claude Code client communicates with a preconfigured MCP server on your xshellz.box, giving it a dedicated environment for software development tasks.
how to setup mcp server over ssh for claude code
On an xshellz.box, the MCP server is already installed. The xshellz-mcp binary and the agent user are configured out of the box. No manual setup is needed. The command claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp works immediately after you create a box. For other remote Linux hosts, you would need to install and configure the server yourself; see Claude Code's MCP documentation for guidance.
can i run claude code on a remote server safely
Yes, and it is often safer than running it locally. An xshellz.box uses a gVisor sandbox with user-namespace remapping to give the agent root-like access without touching the real host. Your agent can install packages, write files, and run builds inside this isolated environment. The root filesystem is ephemeral, so a bad command cannot permanently damage the underlying server. Only /root persists across sessions, giving you a stable home for configuration and project files.
how to use xshellz.box as an mcp server
Every Agent Shell comes with the MCP server preinstalled alongside six coding agent CLIs, including Claude Code. After you create a box, the one-line command above connects it to your local editor. The box runs 24/7 with no idle timeout, so your agent continues working even after you disconnect. If you need a programmable environment for your AI tools, this is the setup we use in production ourselves.
Frequently asked questions
What if I already have a Linux server?
You can use the same MCP command with any remote host, but you will need to install and configure the xshellz-mcp binary and create the agent user yourself. On xshellz, both are preinstalled and ready to go.
Does this work with AI editors other than Claude Code?
The MCP protocol is standard, so any client that supports MCP should work. We have tested it primarily with Claude Code, but the same server can be used by other tools that implement the specification.
Is the sandbox suitable for production workloads?
The sandbox is hardened for agent workloads. For hosting production applications, xshellz offers one-click deploys of WordPress, Ghost, Next.js, and more through the dashboard.