Advanced Guide

Remote CLI Server

Run Claude Code and Codex from any browser, anywhere in the world.

Already set up? Connect to your server now. Open Terminal

Overview

The Remote CLI Server lets you use AI coding assistants like Claude Code and Codex directly from your web browser, from anywhere. Instead of being tied to a local terminal, you run a lightweight server on your computer and connect to it through a secure Cloudflare Tunnel.

This system is perfect for working on the go, using a tablet or phone to monitor long-running AI tasks, or sharing your coding environment across devices without any complex setup.

The system has three components that work together:

  • CLI Server — Runs on your computer and manages terminal sessions for Claude Code and Codex.
  • Tunnel Manager — Creates secure public URLs so you can access your server from anywhere.
  • Terminal Client — A web page that connects to your server and gives you a full terminal in the browser.

How It Works

Here is how the three pieces connect together:

Terminal Client

Browser-based interface on any device

Your Browser
HTTPS

Cloudflare Tunnel

Secure encrypted connection to your machine

The Internet
WebSocket

CLI Server

Runs Claude Code & Codex in real terminals

Your Computer

Data flows in real-time through the encrypted tunnel. Your keystrokes go in, terminal output comes back.

The CLI Server uses node-pty to spawn real pseudo-terminal processes, which means Claude Code and Codex behave exactly as they would in a native terminal — full color support, interactive prompts, and all.

The Tunnel Manager wraps the Cloudflare cloudflared tool and gives you an easy web UI for starting and stopping tunnels. Each time you start a tunnel, you get a fresh public URL.

The Terminal Client is a single HTML page powered by xterm.js that renders the terminal in your browser. It connects over WebSocket and sends keystrokes in real-time.

Prerequisites

Before starting, make sure you have the following installed on the computer that will run the server:

  • Node.js (version 16 or later) — Download from nodejs.org
  • Claude Code and/or Codex CLI installed and available in your system PATH.
  • Cloudflare cloudflared (for remote access) — Install with: winget install Cloudflare.cloudflared
  • A modern web browser (Chrome, Edge, Firefox, or Safari)

Download

Download the components you need. Each download is a zip file containing everything required for that piece.

CLI Server

Terminal backend for your computer

4 files

Tunnel Manager

Remote access via Cloudflare Tunnels

3 files

Terminal Client

Browser-based terminal interface

1 file

Setup: CLI Server

The CLI Server runs on your computer and manages terminal sessions. It listens on port 3600 and communicates with the Terminal Client over WebSocket.

1 Extract the files

Create a folder (e.g. CLIServer) and extract the downloaded files into it. You should have:

Folder structure
CLIServer/
  ├── cli-server.js
  ├── package.json
  ├── password.txt
  └── Start CLI Server.bat
2 Set your password

Open password.txt in any text editor and replace the default password with something secure. This password protects your terminal from unauthorized access.

Choose a strong password. Anyone with this password can execute commands on your computer through the terminal.
3 Start the server

Double-click Start CLI Server.bat. On the first run, it will automatically install the required Node.js packages (node-pty and ws).

Expected output
Checking for Node.js...
Installing dependencies...
Terminal backend: node-pty (full PTY support)
Password loaded

========================================
   CLI Server (password protected)
========================================
  UI: http://localhost:3600
  Press Ctrl+C to stop
========================================
If node-pty fails to install, you may need Visual Studio Build Tools. Run: npm install --global windows-build-tools

Setup: Tunnel Manager

The Tunnel Manager creates secure public URLs using Cloudflare Tunnels, allowing you to access your CLI Server from anywhere on the internet. Skip this section if you only need local access.

1 Install Cloudflare Tunnel

Open a command prompt and run:

Command Prompt
winget install Cloudflare.cloudflared

This installs cloudflared which creates encrypted tunnels to your local services.

2 Extract the Tunnel Manager files

Create a folder (e.g. TunnelManager) and extract the downloaded files:

Folder structure
TunnelManager/
  ├── tunnel-manager.js
  ├── index.html
  └── Start Tunnel Manager.bat
3 Start the Tunnel Manager

Double-click Start Tunnel Manager.bat. The web UI will open at http://localhost:3500.

4 Create a tunnel for the CLI Server

In the Tunnel Manager UI:

  1. Click "+ New Tunnel"
  2. Enter name: CLI Server
  3. Enter port: 3600
  4. Click "Add", then click "Start"

After a few seconds, a public URL will appear (e.g. https://random-words.trycloudflare.com). Copy this URL — you will use it in the Terminal Client.

Cloudflare Tunnel URLs change each time you restart a tunnel. This is a free feature — no Cloudflare account required. For a persistent URL, you can set up a named tunnel with a Cloudflare account.

Connecting Everything

Here is the complete startup workflow, from scratch to coding:

1 Start the CLI Server

Double-click Start CLI Server.bat. Confirm you see "UI: http://localhost:3600" in the console.

2 Start a tunnel (for remote access)

Double-click Start Tunnel Manager.bat. Add a tunnel for port 3600 and start it. Copy the public URL when it appears.

3 Open the Terminal Client

Open the CLI Server Terminal tool. Enter the tunnel URL (or http://localhost:3600) and your password, then click Connect.

4 Browse and start coding

Use the directory browser to navigate to your project folder. Choose either Claude Code or Codex, then click "Start". The AI assistant will launch in a full terminal right in your browser.

Features

The Remote CLI Server includes everything you need for a productive remote coding experience:

Multiple Sessions

Run multiple Claude Code or Codex instances in parallel tabs on the same page.

Persistent Sessions

Sessions survive page refreshes and reconnections. Close your browser and come back later — your session is still running.

Tab Management

Rename tabs with a double-click and drag-and-drop to reorder them.

Directory Browser

Browse your server's filesystem with quick-access shortcuts to Desktop, Documents, and Downloads.

Batch Input Mode

Toggle batch mode to buffer keystrokes and send them every 500ms, ideal for slow connections.

Password Protected

Simple password authentication keeps your terminal sessions private and secure.

Full Terminal

Powered by xterm.js with 256-color support, cursor positioning, and all ANSI escape codes.

Mobile Friendly

Responsive design works on phones and tablets for monitoring on the go.

Troubleshooting

Common issues and their solutions:

This means the CLI tool (Claude Code or Codex) is not installed or not in your system PATH. Make sure you can run claude --version or codex --version in a regular command prompt. If the command is not found, reinstall the CLI tool and ensure it is added to your PATH.

Check that password.txt does not have trailing spaces or extra lines. The server reads only the first line and trims whitespace. Try restarting the CLI Server after editing the password file.

Verify that the CLI Server is running and the tunnel is active. Check the Tunnel Manager UI for the current URL — tunnel URLs change each time you restart. Also make sure you are using https:// for the tunnel URL (not http://).

node-pty requires native compilation tools on Windows. Install them with:

Command Prompt (Admin)
npm install --global windows-build-tools

Then delete the node_modules folder in the CLI Server directory and run Start CLI Server.bat again.

Try refreshing the page. The terminal will reconnect and replay the last 100KB of buffered output. If the issue persists, try a different browser. Chrome and Edge generally have the best xterm.js compatibility.

Make sure cloudflared is installed correctly. Try running it manually in a command prompt:

Command Prompt
cloudflared tunnel --url http://localhost:3600

If cloudflared is not found, check that it is in your PATH. The default install location on Windows is C:\Program Files (x86)\cloudflared\.