chandler
v1.1.0
Published
Remote shell tool - connect from your Mac to your PC and run commands
Downloads
79
Readme
chandler
A remote shell tool that lets you connect from your Mac to your PC and run commands like git, npm, etc.
Installation
npm install -g chandlerOr use with npx (no installation required):
npx chandlerRequirements
- mDNS support for auto-discovery:
- macOS: Built-in (Bonjour)
- Windows: Requires Bonjour Print Services or iTunes installed
- Linux: Requires Avahi daemon (
sudo apt-get install avahi-daemonon Ubuntu/Debian)
Usage
Start a host (on your PC or Mac)
npx chandler hostThis will start a WebSocket server, advertise it via mDNS, and display connection options:
✓ Chandler host started
Listening on: 0.0.0.0:4818
Local IP: 192.168.1.100
Hostname: my-computer
✓ Broadcasting via mDNS (auto-discovery enabled)
🔐 Connection PIN: 1234
Share this PIN with clients to allow connections
Connection options:
Auto-discover: npx chandler connect
Direct: npx chandler connect 192.168.1.100:4818
Waiting for connections...The host generates a random 4-digit PIN that clients must enter to connect. After 10 failed authentication attempts, the server automatically shuts down for security.
Connect to the host
Option 1: Auto-discovery (recommended)
Just run the connect command without an address, and Chandler will find available hosts:
npx chandler connectYou'll see a menu to select from discovered hosts:
🔍 Searching for Chandler hosts on the network...
✓ Found: my-computer at 192.168.1.100:4818
? Select a host to connect to: ›
❯ 🪟 my-computer (192.168.1.100:4818 - win32)
🍎 laptop (192.168.1.101:4818 - darwin)
Connecting to 192.168.1.100:4818...
✓ Connected to host
Waiting for authentication request...
🔐 Enter PIN to connect: ****
✓ Authentication successful!
Type your commands below. Press Ctrl+C to exit.Option 2: Direct connection
If you know the IP address and port:
npx chandler connect 192.168.1.100:4818Once connected, you can run any shell commands on the remote machine:
git status
npm install
ls -laForward a host port back to your local machine
While you are connected to a host, you can create a session-scoped TCP tunnel from the remote shell itself:
chandler forward 3000That command runs on the host, asks the active Chandler session to open a local listener on the client machine, and prints the actual local bind:
✓ 127.0.0.1:3000 -> host 127.0.0.1:3000If the same local port is already taken on the client, Chandler falls back to an ephemeral port:
chandler forward 3000
# ✓ 127.0.0.1:49152 -> host 127.0.0.1:3000You can also request a specific local port:
chandler forward 3000 8080List or close tunnels from the same remote shell session:
chandler tunnels
chandler unforward 8080Notes:
- Tunnels bind only to
127.0.0.1on the client machine. - Tunnels proxy TCP traffic to
127.0.0.1:<remotePort>on the host machine. - Tunnels exist only for the current
chandler connectsession and are removed when the session disconnects.
Options
Host command:
-p, --port <port>- Port to listen on (default: 4818)
npx chandler host --port 3000Session tunnel commands:
forward <remotePort> [localPort]- Forward host127.0.0.1:<remotePort>to a client-local porttunnels- List active tunnels for the current Chandler sessionunforward <localPort>- Close a tunnel by its client-local port
How it works
Chandler creates a WebSocket connection between two machines:
- The host machine starts a WebSocket server and spawns a shell
- The host advertises itself via mDNS/Bonjour for auto-discovery
- The client discovers available hosts or connects directly
- All input from the client is sent to the remote shell
- All output from the remote shell is sent back to the client
- It acts as a reverse proxy for shell commands
Features
- Auto-discovery: Hosts are automatically discovered on the local network using mDNS
- PIN Authentication: Secure connections with a randomly generated 4-digit PIN
- Cross-platform: Works on Windows, macOS, and Linux
- Interactive selection: Choose from multiple discovered hosts with a TUI
- Direct connection: Can connect directly if you know the IP and port
- Real-time: Streams shell output in real-time
- Security: Automatic shutdown after 10 failed authentication attempts
Development
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
npm run dev -- host
npm run dev -- connect 192.168.1.100:4818License
ISC
