RemoHop

中文

Docs

Handing a machine to an AI agent

RemoHop lets an AI agent (Claude Code, Claude Desktop, Cursor, VS Code, or any other MCP client) operate a remote machine through remohop mcp. This page covers how to do that safely: how the machine's owner gives the agent limited, expiring access, how to watch and stop it, and how to register the MCP server with each client.

The short version

On the machine the agent should work on (the host), as the user that runs remohop host:

remohop host grant claude-session --for 2h \
    --allow shell:run-only,files:read:~/project,screenshot

It prints a code that starts with remohopg1-. On the machine where the agent runs:

remohop peers redeem 276941009 remohopg1-...
claude mcp add remohop -- remohop mcp --target 276941009

The agent can now run commands (no interactive terminal), read files below ~/project and take screenshots on that machine for two hours. Everything else is refused by the host. remohop host revoke claude-session ends it early; remohop host panic ends every agent session at once.

Grants

A grant is a credential with limits. The host stores it and enforces it on every stream and every command or file operation; nothing on the agent's side can widen it.

remohop host grant NAME --allow LIST [--for DURATION] [--cmd COMMAND]...
                    [--approve each|first|none] [--sessions N] [--record]
                    [--key "KEY-LINE"]
FlagMeaning
--allow LISTWhat the grant allows, comma-separated, repeatable. See the table below.
--for DURATIONHow long the grant is valid: 30m, 2h, 24h. Default 1h. Sessions end when it expires.
--cmd COMMANDAllow only commands that start with this program (and optional leading arguments). Repeatable. Implies shell:run-only.
--approve MODEeach: the owner approves every command and every file change. first: the first one of each session. none (default).
--sessions NConcurrent sessions allowed. Default 2.
--recordRecord the output of commands and terminals as asciicast v2 files.
--key "KEY-LINE"Bind the code to one client identity (the line remohop key export prints there). Without it, the first machine to log in with the code is bound to it, and the code is useless to anyone else from then on.

Allow-list items:

ItemAllows
shellCommands, background jobs and interactive terminals.
shell:run-onlyCommands and background jobs; no interactive terminal and no -t terminal for commands.
shell:cmd=PROGRAMOnly commands whose first words are PROGRAM, e.g. shell:cmd=git, "shell:cmd=go test". Same as --cmd.
filesRead and write any file the host's user can.
files:readRead any file.
files:read:PATHRead files below PATH only.
files:write:PATHRead and write files below PATH only.
screenshotScreenshots only.
screenScreenshots and desktop viewing, without keyboard and mouse.
desktopscreen plus keyboard and mouse.
inputKeyboard and mouse.
clipThe clipboard.
infoSystem information.
forward, vpn, serial, usbPort forwarding (and Wake-on-LAN), the VPN, serial ports, USB devices. Never included unless named.

Anything not listed is refused, including pairing: a granted session cannot mint itself an ordinary pairing that would outlive the grant. The host's own feature switches (remohop config feature NAME off) still apply on top of every grant.

File roots are checked after resolving symbolic links, both of the path and of its parent directory, so a link inside a root cannot lead out of it. Paths containing .. are refused. Directories above a root may be looked at (stat) so a client can find its way to the root, but not listed.

With a command allow-list, a command must be a single simple command: ;, &, |, <, >, parentheses and braces outside quotes, and $, backticks or line breaks anywhere, are refused, and custom environment variables are not accepted. Quotes group words as usual (git commit -m "fix: x" is fine).

Examples:

# Read-only code review of one repository, with screenshots
remohop host grant reviewer --for 4h --allow files:read:~/src/app,screenshot

# A CI-style agent that may only test and inspect git, writing to one directory
remohop host grant ci-bot --for 8h --cmd "go test" --cmd "git status" --cmd "git diff" \
    --allow files:write:~/src/app/out,files:read:~/src/app

# Full shell, but the owner approves every command and file change, and it is recorded
remohop host grant pairing-session --for 1h --allow shell,files --approve each --record

Managing grants:

remohop host grants             # state (active, expired, suspended), expiry, sessions, binding
remohop host grants --json
remohop host revoke NAME        # delete it; its live sessions end at once
remohop host grant NAME ...     # reissue: replaces the grant and its code; old sessions end

From the agent's machine, remohop <ID> limits shows what its credential allows.

Approving actions

With --approve each (or first), a command or file change waits until the owner answers. The request reaches the owner in three ways:

Requests that nobody answers within 30 seconds are refused, and the agent is told so. One approval of a file change covers further changes to the same path for a minute, so a single upload (create, write, set times, rename) is asked about once. With first, one approval covers the rest of the session. Reading files needs no approval. In an interactive terminal (grants with full shell), opening the terminal is approved, not each keystroke.

Audit log and recordings

Every action under a grant is written to the host's audit log (audit.jsonl in the config directory, readable by its user only) with the grant's name: logins, each command, each file opened or changed, each other service used, refusals with their reason, approval decisions, recordings started and the session's end.

remohop host audit --grant claude-session        # the last 100 entries of that grant, and its recordings
remohop host audit --grant claude-session 1000 --json

With --record, the output of every command and interactive terminal under the grant is saved as an asciicast v2 file in recordings/NAME/ inside the config directory (files mode 0600). Play one back with asciinema play FILE, or read it as text: it is JSON lines. A recording stops at 64 MiB. Background jobs (remohop_spawn) are not recorded this way; their output is kept in the host's job logs (jobs/ in the config directory) as for any job. The audit log is rotated at 1 MB (one old file is kept), so a busy grant can push older entries out; copy the log away if you need to keep it.

Stopping everything

remohop host panic          # suspend every grant and end every granted session now
remohop host panic --all    # ... and every other session too
remohop host resume         # lift the suspension of all grants (or: remohop host resume NAME)

panic suspends first and then ends the sessions, so nothing slips in between. It needs no running GUI and no hotkey; it works from any terminal of the host's user, including over SSH. If the host is not reachable on its control socket, the suspension still applies within five seconds.

On the agent's machine

Redeem the code once:

remohop peers redeem 276941009 remohopg1-...   # or HOST:PORT, or --alias office
remohop 276941009 limits                       # check what it allows

The code is stored like a pairing (in peers.json, mode 0600) and replaces any pairing saved for that host. The first login binds it to this machine's identity key.

If the same computer also has full access to that host (a pairing of yours), give the agent its own configuration directory, so it holds only the grant:

export REMOHOP_CONFIG_DIR=~/.config/remohop-agent   # %APPDATA%\remohop-agent on Windows
remohop config set signal rendezvous.example.net    # if you use a rendezvous server
remohop peers redeem 276941009 remohopg1-...

and pass the same REMOHOP_CONFIG_DIR to the MCP server in the client configuration below (env).

remohop mcp --read-only additionally hides every tool that changes something (commands, writes, input, clipboard changes, forwards). That is a convenience on the agent's side; the grant is what the host enforces.

Client setup

remohop must be on the client's PATH, or give its absolute path (which remohop, or where remohop on Windows). Replace 276941009 with the host's ID, alias or HOST:PORT; omit --target to let the agent pass a target on every call.

Claude Code

claude mcp add remohop -- remohop mcp --target 276941009
# available in every project:
claude mcp add --scope user remohop -- remohop mcp --target 276941009
# with a separate configuration directory and read-only tools:
claude mcp add remohop -e REMOHOP_CONFIG_DIR=$HOME/.config/remohop-agent -- remohop mcp --target 276941009 --read-only

Check it with claude mcp list, or /mcp inside a session.

Claude Desktop

Edit claude_desktop_config.json (Settings, Developer, Edit Config). It is in ~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows. Claude Desktop does not read your shell's PATH, so use the absolute path:

{
  "mcpServers": {
    "remohop": {
      "command": "/usr/local/bin/remohop",
      "args": ["mcp", "--target", "276941009"],
      "env": { "REMOHOP_CONFIG_DIR": "/Users/me/.config/remohop-agent" }
    }
  }
}

On Windows use "command": "C:\\Program Files\\RemoHop\\remohop.exe" (or wherever remohop.exe is) and a Windows path in env. Leave out env when the agent uses your normal configuration. Restart Claude Desktop after editing.

Cursor

~/.cursor/mcp.json for all projects, or .cursor/mcp.json in one project:

{
  "mcpServers": {
    "remohop": {
      "command": "remohop",
      "args": ["mcp", "--target", "276941009"],
      "env": { "REMOHOP_CONFIG_DIR": "/home/me/.config/remohop-agent" }
    }
  }
}

VS Code

.vscode/mcp.json in the workspace (or run "MCP: Add Server" from the command palette for a user-wide server):

{
  "servers": {
    "remohop": {
      "type": "stdio",
      "command": "remohop",
      "args": ["mcp", "--target", "276941009"],
      "env": { "REMOHOP_CONFIG_DIR": "/home/me/.config/remohop-agent" }
    }
  }
}

Or from a terminal:

code --add-mcp '{"name":"remohop","command":"remohop","args":["mcp","--target","276941009"]}'

Use the tools in Copilot Chat's agent mode.

Other MCP clients

Any client that starts stdio servers works: the command is remohop, the arguments mcp plus optional --target ID, --read-only and --idle-timeout DURATION. Nothing but protocol messages is written to stdout; diagnostics go to stderr (-v for debug logs).

What the agent sees

Limits of the protection

Grants narrow what an authenticated client may do; they are enforced by the host process, which runs with its user's privileges. Know what they do not do:

See security.md for the rest of RemoHop's security model.