rex-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
rex-mcp
A pure-Python FastMCP server for controlling Rex terminal multiplexer sessions, windows, and split panes over Tailscale.
Local Desktop MCP (
stdio): Connect Gemini Desktop, Claude Desktop, or local IDEs directly viascripts/stdio.sh— no OAuth or Tailscale Funnel required.Remote Web Connectors (
http+ Google OAuth 2.1): Exposerex-mcpviatailscale funneland connect ChatGPT, Claude.ai, or Gemini web connectors directly over HTTPS.Fail-Closed Security: Requires OAuth 2.1 (or static Bearer token) on HTTP transport, verifies every caller's Google email against
REX_MCP_ALLOWED_USERS, and restrictsserveroverrides to configuredREX_HOSTS/ your Tailscale tailnet (REX_ALLOWED_TAILNET).Native Rex Wire Protocol: Speaks
rex.control.v1directly overwss://<host>/api/controlwith automaticsession.attach_all— no localrexCLI binary needed.
┌──────────────────────────────────────────────┐
│ Local Desktop App (Gemini / IDE) │
│ └─ stdio ──► scripts/stdio.sh │
│ │
│ Web Connector (ChatGPT / Gemini / Claude) │
│ └─ HTTPS + Google OAuth 2.1 │
│ └─► tailscale funnel (:443) │
│ └─► localhost:8765/mcp │
└──────────────────────┬───────────────────────┘
▼
┌──────────────────────────────────────────────┐
│ rex-mcp (FastMCP · Your Mac on Tailscale) │
│ • GoogleProvider + Email Allowlist (HTTP) │
│ • Tailnet Host Allowlist (REX_SERVER_URL) │
│ • rex.control.v1 WebSocket Client │
└──────────────────────┬───────────────────────┘
│ wss://.../api/control
│ (Tailscale Identity Auth)
▼
┌──────────────────────────────────────────────┐
│ Rex Server(s) on Tailnet │
│ • my-mac-rex.my-tailnet.ts.net │
│ • other hosts via REX_HOSTS (optional) │
└──────────────────────────────────────────────┘Install & Configure Target
uv sync --extra dev
cp .env.example .envSet REX_SERVER_URL in .env to your Rex server's Tailscale address (e.g., https://my-mac-rex.my-tailnet.ts.net).
Related MCP server: rex-mcp
Option A: Local Desktop MCP (stdio) — Fastest Setup
Best for Gemini Desktop, Claude Desktop, or local IDEs running on the same Mac. stdio automatically skips HTTP/OAuth checks while still reading REX_SERVER_URL / REX_HOSTS from .env.
Gemini Desktop (Local MCP)
Open Connect to an MCP server → Local MCP and enter:
Name:
RexDescription:
Control Rex terminal sessions, windows, and panes over TailscaleCommand:
/path/to/rex-mcp/scripts/stdio.shAllow full file access: Checked (required so Gemini's sandbox can execute the Python
.venvunder your checkout and Homebrew Python).
Other stdio MCP Clients
Point the client's command directly to /path/to/rex-mcp/scripts/stdio.sh (no extra args or env vars needed).
Option B: Remote / Web Connectors (Tailscale Funnel + Google OAuth 2.1)
Use this to connect web apps (ChatGPT, Claude.ai, Gemini Web) from anywhere over HTTPS.
1. Create a Google Cloud OAuth 2.0 Web Client
Open Google Cloud Console and select or create a project (no billing required).
Open Google Auth Platform → Branding / Audience (formerly OAuth consent screen):
Set Audience to External (so any personal Gmail can sign in).
Under Audience → Test users, add the Google email(s) you plan to sign in with. (Keeping the app in Testing mode avoids Google app verification.)
Open Google Auth Platform → Clients → + Create Client:
Application type:
Web applicationName:
rex-mcpAuthorized redirect URIs:
https://my-mac.my-tailnet.ts.net/auth/callback(Replace with your machine's Tailscale MagicDNS hostname.)
Use this client for an AI-powered agent: Leave unchecked (only needed when calling Google's own APIs/MCP tools;
rex-mcponly uses Google for sign-in identity).
Click Create and copy the Client ID and Client Secret.
2. Configure .env
Fill in the OAuth fields in .env:
REX_SERVER_URL=https://my-mac-rex.my-tailnet.ts.net
REX_MCP_AUTH_MODE=google
REX_MCP_BASE_URL=https://my-mac.my-tailnet.ts.net
REX_MCP_GOOGLE_CLIENT_ID=<your-client-id>.apps.googleusercontent.com
REX_MCP_GOOGLE_CLIENT_SECRET=GOCSPX-<your-client-secret>
REX_MCP_ALLOWED_USERS=you@gmail.com3. Start rex-mcp + Tailscale Funnel
Run the all-in-one startup script (validates .env, enables Tailscale Funnel on HTTPS :443, prints all relevant URLs, and runs rex-mcp in the foreground; turns Funnel off automatically on Ctrl+C unless --keep-funnel is passed):
./scripts/start.shOr run persistently on macOS with launchd:
cp deploy/com.example.rex-mcp.plist.example ~/Library/LaunchAgents/com.example.rex-mcp.plist
# Edit paths inside ~/Library/LaunchAgents/com.example.rex-mcp.plist
launchctl load -w ~/Library/LaunchAgents/com.example.rex-mcp.plist
tailscale funnel --bg --https=443 http://127.0.0.1:8765Logs are written to ~/Library/Logs/rex-mcp.stdout.log and ~/Library/Logs/rex-mcp.stderr.log.
4. Connect from Web Apps
Add a Custom MCP Connector:
Server URL:
https://my-mac.my-tailnet.ts.net/mcpAuthentication:
OAuth
Sign in with a Google account listed in REX_MCP_ALLOWED_USERS, then test with rex_server_status and rex_list_sessions.
Multi-Host & Optional Modes
Targeting Multiple Rex Servers on Your Tailnet
Set REX_HOSTS in .env to map short aliases to Rex servers:
REX_HOSTS={"mac":"https://my-mac-rex.my-tailnet.ts.net","linux":"https://my-linux-rex.my-tailnet.ts.net"}Every tool accepts an optional server argument (e.g. server="linux" or any *.<REX_ALLOWED_TAILNET> hostname). External hosts outside REX_HOSTS and REX_ALLOWED_TAILNET are blocked to prevent SSRF.
Static Bearer Token / Prefect Horizon Gateway
To authenticate with a static Bearer token (e.g. behind https://horizon.prefect.io/ or a service client):
REX_MCP_AUTH_MODE=bearer
REX_MCP_BEARER_TOKEN=<long-random-secret>Configuration Reference
Variable | Default | Purpose |
| (required) | Default Rex server URL or Tailscale hostname |
|
| JSON map of short aliases to Rex server URLs |
| (auto-inferred) | Allowed |
|
| Disable host allowlist (not recommended) |
|
| Per-RPC timeout in seconds |
| (unset) | Optional SOCKS5/HTTP proxy URL |
|
| HTTP auth mode: |
| (required in | Public HTTPS base URL for OAuth metadata & callbacks |
| (unset) | Google OAuth 2.0 Web Client ID |
| (unset) | Google OAuth 2.0 Web Client Secret |
| (empty) | Comma-separated or JSON list of allowed Google emails (required in |
| (unset) | Static Bearer token (required in |
|
| Default CLI transport ( |
|
| HTTP bind host and port |
|
| Must be |
Available Tools
Tool | Safety | Purpose |
| Read-only | Server status, Rex version, Tailscale identity |
| Read-only | List all Rex sessions |
| Read-only | View windows, layouts, active window, and blocks |
| Read-only | Capture screen and scrollback ( |
| Read-only | Get cwd, title, running processes, exit status, listening ports |
| Read-only | List directory entries relative to terminal cwd |
| Read-only | Discover Rex server API methods ( |
| Mutating | Create a new session with an initial shell block |
| Mutating | Open a new window/tab in a session |
| Mutating | Split a pane ( |
| Mutating | Write text to a terminal (optional Enter) |
| Mutating | Send keystrokes ( |
| Mutating | Run a command in a block or new window and return output |
| Idempotent | Clear screen & scrollback without killing the process |
| Destructive | Close a pane/block and stop its process |
| Destructive | Close a window/tab and all its blocks |
| Destructive | Destroy an entire session |
| Destructive | Raw escape hatch for any Rex control API method |
Development & Testing
uv run pytest -v
uv run ruff check src tests
REX_MCP_TRANSPORT=stdio uv run fastmcp inspect src/rex_mcp/server.py:mcpLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Tailscale device, route, DNS, key, user, and ACL management over MCP and CLI.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server that lets AI agents list sessions, read terminal screens, type commands, and run commands (with optional waiting for exit status) in Rex terminal blocks on the local machine through the rex CLI. It exposes a single allowlisted passthrough CLI tool plus a guide tool, deliberately excluding destructive or cross-host operations.2MIT

rex-mcpofficial
AlicenseNot gradedqualityCmaintenanceEnables an AI agent to monitor and control Superlogical Rex terminal servers over Tailscale, reading pane output, spotting agents that are blocked on prompts, and sending text or keystrokes to unblock them. Also lets the agent open and close sessions, tabs, and panes and launch new agents inside them.MIT- AlicenseBqualityBmaintenanceEnables AI assistants to inspect and manage a Rex server through the rex CLI, with read access to any session and writes restricted to created or allowlisted sessions.18MIT
- AlicenseNot gradedqualityBmaintenanceEnables web-based AI clients such as ChatGPT, Claude, and Gemini to connect over Tailscale Funnel/Serve to a Windows machine and operate it through 50+ tools — browsing drives, reading and safely patching files, grepping, archiving, running CLI commands, managing background processes, running pytest, using local Git, and driving Chrome via DevTools Protocol. Access is protected by OAuth 2.1 with PKCE, dynamic client registration, a host PIN consent page, and JSONL audit logging.MIT