Skip to main content
Glama
raspberry-pi-connect-mcp

raspberry-pi-connect-mcp

raspberry-pi-connect-mcp

Raspi Connect MCP · RPi Connect MCP — an MCP server that gives an AI agent (Claude Code, Claude Desktop, or any MCP client) shell access to your Raspberry Pi devices through the Raspberry Pi Connect web remote shell.

Looking for "raspi connect mcp", "rpi connect mcp", "raspberry pi connect mcp" or "raspi remote shell mcp"? This is that project. Search terms: raspi-connect-mcp, rpi-connect-mcp, raspberry-pi-connect-mcp.

Raspberry Pi Connect has no public API for its remote shell, so this server drives the web UI with a headless Chrome: it opens the device's remote-shell page, hooks the xterm.js terminal, types commands and reads the output back. No SSH, port forwarding, VPN or public IP is needed. If the Pi shows up in Connect, the agent can use it.

Unofficial project. Not affiliated with or endorsed by Raspberry Pi Ltd.

Features

  • Lists every device on your Connect account with online status and whether remote shell / screen sharing is allowed

  • Runs a command and returns its output and exit code, using unique begin/end markers per call

  • Persistent sessions per device: cwd, env vars and background jobs survive between calls

  • Interactive programs: send raw keys (Ctrl-C, arrows, Enter) and read the screen

  • Device allow-list (RPI_CONNECT_ALLOW) to limit which Pis the agent may use

  • Fleet-friendly: one agent can work across many devices in parallel

Related MCP server: mcp-ssh

Requirements

  • Node.js 18.13+ (on 19.x: 19.3+)

  • A Raspberry Pi Connect account, with remote shell enabled on the devices you want to use

  • Chrome for Testing (installed below; no sudo needed)

Quick start (npm)

npx @puppeteer/browsers install chrome@stable --path ~/.cache/rpi-connect-mcp
npx -p raspberry-pi-connect-mcp raspberry-pi-connect-mcp-login   # sign in by hand in the Chrome window
claude mcp add rpi-connect -- npx -y raspberry-pi-connect-mcp

Setup (from source)

git clone https://github.com/kritzerenkrieg/raspberry-pi-connect-mcp.git
cd raspberry-pi-connect-mcp
npm install
npx @puppeteer/browsers install chrome@stable --path ~/.cache/rpi-connect-mcp
npm run login        # a Chrome window opens: sign in by hand; it closes by itself once the device list loads

npm run login (or the login tool; npm run login -- --fresh / login(fresh=true) to switch account) saves the session cookies to ~/.config/rpi-connect-mcp/session.json (mode 600). Treat that file like a password. Connect cookies are session-only, so run npm run login again when the tools report that the session expired.

Register the server with your MCP client. For Claude Code:

claude mcp add rpi-connect -- node /absolute/path/to/raspberry-pi-connect-mcp/src/server.js

Other clients (Claude Desktop, etc.):

{
  "mcpServers": {
    "rpi-connect": {
      "command": "node",
      "args": ["/absolute/path/to/raspberry-pi-connect-mcp/src/server.js"],
      "env": { "RPI_CONNECT_ALLOW": "lab-pi,kiosk" }
    }
  }
}

Tools

Tool

What it does

list_devices

Devices on the account: id, name, client version, last seen, online, remote shell / screen sharing allowed

run_command(device, command, timeout_sec=60)

Run a bash command line; returns { device, exitCode, output }. If it is still running at the timeout, returns timedOut: true and the partial output

send_keys(device, keys)

Send raw keystrokes (\n, \t, \x03 Ctrl-C, \x04 Ctrl-D, \x1b[A Up…); returns the screen

read_screen(device, lines=0)

Current terminal screen plus a little scrollback

close_session(device)

Close the shell session for a device

account

Which account is signed in (email when readable), session age, device names, login in progress

login(fresh=false, wait_sec=180)

Opens a Chrome window on this computer for the user to sign in; the new session is used right away. fresh=true signs out first (switch account)

logout(delete=false)

Signs out: session and Chrome profile move to ~/.config/rpi-connect-mcp/old-account_<time>/ (restorable), or are deleted

device can be the exact name, a unique substring of the name, or the device UUID. The first call to a device takes about 10 to 30 s while Connect sets up the WebRTC relay. Later calls reuse the session.

Configuration

Env var

Purpose

RPI_CONNECT_ALLOW

Comma-separated name substrings. Only matching devices can be used

RPI_CONNECT_HEADED=1

Show the browser window (debugging)

RPI_CONNECT_CHROME

Path to a Chrome binary

RPI_CONNECT_SESSION

Path to the saved session file

RPI_CONNECT_PROFILE

Chrome profile dir used by login

Tips

  • Commands that prompt for input (sudo password, editors, [Y/n]) will time out in run_command. Use send_keys / read_screen for those, or pass -y style flags.

  • For long jobs, start them with nohup … & and poll a log file instead of holding the call open.

  • Large outputs go through the terminal. Pipe them through head, tail or grep to keep them small.

Security

This hands an AI agent a real shell on your devices, with the privileges of the Connect user (often passwordless sudo).

  • Use RPI_CONNECT_ALLOW to limit which devices the agent can use, and keep your MCP client's per-call approval prompts on

  • Keep session.json private; anyone holding it can use your Connect account until the session expires

  • The server does not try to evade bot detection. If Cloudflare challenges the session, sign in again by hand

Development

scripts/probe.js [url] dumps the structure of a Connect page. scripts/probe-shell.js <device> inspects how the remote shell renders without typing anything. Both are useful when Connect's UI changes and the selectors in src/connect.js need updating.

License

MIT

Available Tools

8 tools
accountA

Show which Raspberry Pi Connect account is signed in (email when it can be read), when the session was saved, its device names, and whether a login is in progress.

Inputs: no named parameters.

close_sessionC

Close the remote shell session to a device.

Inputs: device (required).

list_devicesA

List devices on the Raspberry Pi Connect account with online status and whether remote shell is allowed.

Inputs: no named parameters.

loginA

Sign in to Raspberry Pi Connect: opens a Chrome window on this computer where the USER signs in by hand (tell them to do so). Waits up to wait_sec for it; if still in progress, call account later. fresh=true signs out the current account first (switch account). The new session is used right away.

Inputs: fresh, wait_sec.

logoutA

Sign out of Raspberry Pi Connect. The session and Chrome profile are moved to a backup folder (old-account_) so the account can be restored, or deleted with delete=true.

Inputs: delete.

read_screenA

Read the current terminal screen (plus a little scrollback) of a device shell.

Inputs: device (required), lines.

run_commandA

Run a shell command on a device through its Connect remote shell and return output + exit code. The shell session persists between calls (cwd, env vars). First call to a device takes ~30s to connect. Commands that wait for input (sudo password, editors, confirmations) will time out; use send_keys/read_screen for those.

Inputs: device (required), command (required), timeout_sec.

send_keysA

Send raw keystrokes to a device shell (for interactive programs). Supports escapes: "\n" Enter, "\x03" Ctrl-C, "\x04" Ctrl-D, "\t" Tab, "\x1b" Esc, "\x1b[A" Up. Returns the current screen.

Inputs: keys (required), device (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool targets a fairly distinct concern: account lifecycle (login/logout/account), device inventory (list_devices), and remote shell control (run_command/send_keys/read_screen/close_session). The only mild overlaps are send_keys vs run_command (both drive the shell, though the description explains when to use each) and send_keys returning the screen, which partially duplicates read_screen. An agent can pick correctly with the given descriptions.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern (read_screen, list_devices, close_session, run_command, send_keys), but 'account' is a bare noun getter while 'login'/'logout' are verb-only with no object. The mix is still readable, but the stray noun getter breaks the otherwise predictable convention.

    Tool Count5/5

    Eight tools is well-scoped for a server covering account auth plus remote shell access. Every tool maps to a necessary operation (status, sign in/out, list devices, execute, interact, read output, close) with no filler.

    Completeness4/5

    Auth lifecycle (login/logout/account), device discovery, and the shell loop (run/send_keys/read_screen/close_session) are all covered, so core workflows have no dead ends. Gaps are minor-to-moderate: no file transfer to/from devices, no scrollback paging despite read_screen mentioning scrollback, and no explicit session-open or long-running-command polling mechanism.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to securely execute shell commands on local machines through an SSH interface with session management, command execution, and sudo support.
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to run commands on remote SSH-accessible devices via persistent sessions, supporting both POSIX and CLI shells with safety filters.
      -
    • F
      license
      A
      quality
      D
      maintenance
      Enables AI agents to start and manage pseudo-terminal sessions, run shell commands and interact with REPLs programmatically.
      7
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to have persistent, fully interactive SSH sessions into remote hosts, behaving like a local terminal.
      9 npm
      2
      MIT