Home / Guides

Claude Code on a VPS: Install It There or Connect Remotely

Two ways to use Claude Code on a VPS: install it on the server and SSH in, or keep Claude Code on your laptop and reach the server over MCP with Shellway. Steps, a comparison and safety.

By Sandeep Kumar Saini, founder of Shellway · Published 1 Dec 2026 · Updated 1 Dec 2026

Short answer: there are two ways to use Claude Code on a VPS. You can install Claude Code on the server and open it over SSH. Or you can keep Claude Code on your laptop and add a remote MCP server such as Shellway, so your local session runs commands on the VPS. Install on the server if you write most of your code there. Connect remotely if the server is something you look after, not where you code.

Shellway is our product. Claude Code facts below come from Anthropic's official Claude Code docs, checked on 1 December 2026 (sources at the end).

Option 1: install Claude Code on the VPS

This is the most direct setup. Claude Code runs on the server, so every file and command it uses is on the server.

What you need (from the official setup page):

  • A server with Ubuntu 20.04 or newer (Debian 10+ and Alpine 3.19+ are also listed), 4 GB of RAM or more, and an x64 or ARM64 processor.
  • A Claude Pro, Max, Ultra, Team, Enterprise or Console account. The free claude.ai plan does not include Claude Code.

Steps:

  1. SSH into the server as a normal user, not root:
    ssh you@your-server
  2. Install Claude Code with the native installer:
    curl -fsSL https://claude.ai/install.sh | bash
  3. Open a new terminal, go to your project and start it:
    cd /srv/myapp
    claude
  4. Sign in when Claude Code asks you to.

Keep the session alive. If your SSH connection drops, the session drops with it. Many people run Claude Code inside tmux (a general Linux tool, not part of Claude Code) so they can disconnect and come back later:

tmux new -s claude
claude
# detach: Ctrl+B then D. Come back later: tmux attach -t claude

From your phone: Claude Code has a Remote Control mode (claude remote-control) that lets you continue the session from the Claude app or claude.ai/code. It is available on the Pro, Max, Ultra, Team and Enterprise plans, and the docs say "your computer has to stay on and the claude process has to keep running."

Good for: coding on the server all day, big repos that live only on the server, one server.

Things to weigh: your Claude login lives on the server. The server needs enough RAM. You repeat the install and sign-in on each server. If the server is under load or out of disk, the tool you would use to fix it runs on that same server.

Option 2: keep Claude Code local, reach the VPS over MCP

Here Claude Code stays on your laptop. A small Shellway app runs on the VPS and makes an outgoing connection, so you don't open any ports and don't need a VPN. Claude Code connects to Shellway as a remote MCP server, and it can then read files and run commands on the server alongside your local project.

Steps (full server guide: run your Linux server or VPS from ChatGPT or Claude):

  1. Pick the user. The app can do exactly what its Linux user can do. Don't use root:
    sudo adduser shellway
    sudo -iu shellway
  2. Pair the server. In the Shellway dashboard, copy the one-line setup command and paste it into the server's terminal. It brings its own Node if the server has none.
  3. Make it start after a reboot:
    npx -y shellway@latest service install
    sudo loginctl enable-linger shellway
  4. Add Shellway to Claude Code on your laptop (also shown on the Claude setup page):
    claude mcp add --transport http shellway https://mcp.getshellway.com/mcp
    Sign in to Shellway when Claude Code asks you to.
  5. Ask. In Claude Code, try: "Which of my computers are online? On my VPS, check disk, memory, load and any failed systemd services."

Claude Code calls list_devices to find the server, then run_command to run the checks there. For long jobs, such as a build or a backup, it can use start_process and read_process_output. More ready prompts: server health check.

Prompts that work well with this setup:

  • "Read the last 200 lines of /var/log/myapp/error.log on the VPS and compare the stack trace with src/server.ts in this repo."
  • "On the VPS, go to /srv/myapp, run git pull, then restart the myapp service and call localhost:3000/health. Stop and tell me if any step fails."
  • "Compare the .env keys on the VPS with .env.example here. Show only the key names, not the values."

Good for: coding on your laptop and deploying to a server, looking after several servers from one session, and checking a server from your phone. The same connector also works in the Claude and ChatGPT phone apps (phone guide).

Things to weigh: commands on the server go through MCP tool calls, not an interactive shell. A command that stops to ask for a password, like plain sudo, is a bad fit: give the user one narrow sudo rule instead. The server must be on and the Shellway app running.

Which one should you pick?

Claude Code on the VPSClaude Code local + Shellway
Where Claude Code runsOn the serverOn your laptop
Claude login stored onThe serverYour laptop
Ports to openSSH, to log inNone (outgoing connection only)
Several serversInstall and sign in on eachPair each one, ask from one session
From a phoneRemote Control, while claude keeps runningClaude or ChatGPT phone app
Also works in ChatGPT, CursorNoYes
Best whenYou code on the serverYou code locally and run servers

You can also use both: run Claude Code on your main dev server, and pair your other servers with Shellway so one session can check them all.

Is it safe?

Either way, the AI can do what its user on the server can do. Start small.

With Shellway, the rules are set on the server itself, so a chat cannot change them:

npx shellway start --readonly            # read-only: look, never change
npx shellway policy allow /srv/myapp     # only this folder
npx shellway policy block-deletes        # block delete commands
npx shellway policy show                 # see the current rules
  • Outgoing connection only: Shellway opens no ports on the server.
  • Read-only mode: the AI can read, search and list, but cannot change anything.
  • Allowed folders and blocked commands: checked on the server.
  • Action log: every action shows in your dashboard. Remove the server there to cut access at once.

It is not a sandbox. Run the app as a normal user, and grant only the sudo rules it needs, for example one systemctl restart rule. Many people start with a read-only first week.

Common questions

Can Claude Code connect to a remote server over SSH?

Claude Code runs commands where it is installed. To work on a server, you either install it there and SSH in, or add a remote MCP server like Shellway so your local Claude Code can run commands on the server.

How much RAM does Claude Code need on a VPS?

The official setup page lists 4 GB of RAM or more (checked 1 December 2026). If you connect over MCP instead, Claude Code runs on your laptop.

Does the VPS need an open port for Shellway?

No. The app makes an outgoing connection, so you don't open a port or change the firewall, and you don't need a VPN.

Can I use this with several servers?

Yes. Pair each server with the same account, then name the one you mean: "on web-2, show the nginx error log." Pro covers 3 computers and Pro Max covers 10.

What does it cost?

Shellway starts with a 7-day free Pro trial, no card needed. After that, the free plan gives 50 actions a day on 1 computer. Starter is $5/month (₹499 in India) for 1 computer, Pro is $19/month for 3 and Pro Max is $49/month for 10. See pricing. Claude Code itself needs a paid Claude plan or a Console account.

Sources

Claude Code facts checked on 1 December 2026. Shellway facts: pricing, tools, security.

Try Shellway free: 7-day Pro trial, no card