MobileCLI - Stream Any Terminal to Your Phone
A simple CLI tool that streams any terminal session to your phone. No separate app window needed - just run mobilecli and your terminal is instantly accessible from your mobile device.
Installation
# Build from source
# Install to your path
Quick Start
# First time setup (shows QR code for mobile pairing)
# Start your shell with mobile streaming
That's it! Your terminal is now accessible from your phone.
Usage
# Name your session (shows up in mobile app)
# Quiet mode (skip connection status)
# Show active sessions
# Show pairing QR code again
Commands
| Command | Description |
|---|---|
mobilecli |
Start your default shell with streaming |
mobilecli setup |
Run setup wizard and show pairing QR code (mobilecli --setup alias) |
mobilecli status |
Show daemon status and active sessions |
mobilecli pair |
Show QR code for mobile pairing |
mobilecli stop |
Stop the background daemon |
Options
| Option | Description |
|---|---|
--setup |
Run setup wizard and show pairing QR code |
-n, --name <NAME> |
Name for this session (shown in mobile app) |
-q, --quiet |
Don't show connection status on startup |
Connection mode (Local/Tailscale/Custom) is configured via mobilecli setup (or mobilecli --setup).
How It Works
- Setup: Run
mobilecli setup(ormobilecli --setup) to configure and optionally scan QR code with mobile app - Daemon: A background daemon starts automatically and manages all sessions
- Sessions: Each
mobilecliterminal registers with the daemon - Mobile: Connect once to see all active terminal sessions
- Streaming: Terminal output streams to mobile, input flows back
Terminal 1 ──┐
Terminal 2 ──┼──► Daemon (port 9847) ◄──► Mobile App
Terminal 3 ──┘
Mobile App
Scan the QR code with the MobileCLI mobile app during setup, or enter the daemon URL/IP manually in app settings. The app connects to the daemon and shows all active terminal sessions.
Session Management
Active sessions are managed by the daemon. Use mobilecli status to see them:
)
)
Security Model
MobileCLI uses network-level access control, with optional QR pairing metadata:
- Pairing Token (Optional):
mobilecli setup(ormobilecli --setup) generates anauth_tokenand embeds it in the QR code for convenience. - Local Network: Only devices on the same WiFi can connect
- Tailscale: Only authenticated Tailscale network members can connect
The daemon binds to all interfaces (0.0.0.0) intentionally so mobile devices can connect. For remote access, use Tailscale or terminate TLS (wss://) with a reverse proxy.
Protocol
The WebSocket server uses a JSON protocol compatible with the MobileCLI mobile app:
Client → Server
send_input- Send keyboard inputpty_resize- Resize terminal (cols, rows)get_sessions- List available sessionsrename_session- Rename a sessionspawn_session- Start a new terminal session from mobileping- Heartbeat
Server → Client
welcome- Connection establishedsession_info- Session detailspty_bytes- Terminal output (base64)sessions- List of sessionssession_ended- Session terminatedsession_renamed- Rename confirmationspawn_result- Result of spawn_session requestwaiting_for_input- Tool approval or input prompt detectedpong- Heartbeat response
Troubleshooting
If the daemon fails to start, check the log file:
If desktop drag-select copy is not working while tmux runtime is active:
- On Linux, tmux mouse is now off by default to preserve terminal clipboard selection.
- To explicitly enable tmux mouse behavior (scroll/click/copy-mode), launch with:
MOBILECLI_TMUX_MOUSE=on
- To force clipboard-first behavior on any OS, launch with:
MOBILECLI_TMUX_MOUSE=off
License
MIT