raspberry-pi-connect-mcp
Provides shell access to Raspberry Pi devices through Raspberry Pi Connect's web remote shell, allowing agents to list devices, run commands and retrieve output/exit codes, maintain persistent sessions, send keystrokes, read terminal screens, and close sessions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@raspberry-pi-connect-mcp run df -h on lab-pi and show me the output"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
raspberry-pi-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.
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 useFleet-friendly: one agent can work across many devices in parallel
Related MCP server: mcp-ssh
Requirements
Node.js 18+
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-mcpSetup (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 loadsnpm run login 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.jsOther 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 |
| Devices on the account: id, name, client version, last seen, online, remote shell / screen sharing allowed |
| Run a bash command line; returns |
| Send raw keystrokes ( |
| Current terminal screen plus a little scrollback |
| Close the shell session for a device |
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 |
| Comma-separated name substrings. Only matching devices can be used |
| Show the browser window (debugging) |
| Path to a Chrome binary |
| Path to the saved session file |
| Chrome profile dir used by |
Tips
Commands that prompt for input (sudo password, editors,
[Y/n]) will time out inrun_command. Usesend_keys/read_screenfor those, or pass-ystyle 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,tailorgrepto 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_ALLOWto limit which devices the agent can use, and keep your MCP client's per-call approval prompts onKeep
session.jsonprivate; anyone holding it can use your Connect account until the session expiresThe 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
5 toolsclose_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.
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
Scored across 5 tools
Each tool has a distinct role, but run_command and send_keys both push input to a device shell, and the boundary between them is only clarified by description text rather than by the names alone. The descriptions do a good job of steering usage (non-interactive vs interactive), so misselection is unlikely but not impossible.
All five tools follow a clean verb_noun pattern: list_devices, run_command, send_keys, read_screen, close_session. No camelCase mixing or vague standalone verbs.
Five tools is a tight, well-scoped set for remote shell management, and every tool maps to a necessary step in the workflow (discover, execute, interact, inspect, tear down). Nothing feels padded or missing from a count perspective.
The interactive session lifecycle is well covered: discover devices, run commands, send keystrokes, read output, close session. Minor gaps exist—there is no explicit open/connect tool or session listing, and no file transfer—but sessions are opened implicitly and agents can work around this.
Maintenance
Related MCP Connectors
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely execute shell commands on local machines through an SSH interface with session management, command execution, and sudo support.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to run commands on remote SSH-accessible devices via persistent sessions, supporting both POSIX and CLI shells with safety filters.-
- FlicenseAqualityDmaintenanceEnables AI agents to start and manage pseudo-terminal sessions, run shell commands and interact with REPLs programmatically.7-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to have persistent, fully interactive SSH sessions into remote hosts, behaving like a local terminal.15 npm2MIT