Kamui
Use a remote machine's localhost from your laptop. If you ssh foo into a dev box, run
kamui foo instead. Kamui watches which ports are listening on the remote machine and opens the same ports
on your laptop, over the SSH you already use.
$ brew install narasaka/tap/kamui
Why
I do my development on an always-on remote machine, so agents keep working when I close my laptop or lose Wi-Fi.
The browser was the problem. An agent would start a dev server and print http://localhost:3000, which
meant the remote machine in its terminal and my laptop in my browser.
I kept a growing list of LocalForward lines to paper over it. Every new port meant editing that list and
reconnecting, on every laptop. MCP sign-ins broke it completely: the provider redirects to
http://localhost:<port>/callback, a random port the agent opened a moment ago. No list of forwards
can cover a port that changes every time.
Kamui finds the ports for me, including those short-lived callback ports. It uses the SSH setup I already have, keeps remote services bound to loopback, and installs nothing on the remote side.
How it works
-
Your SSH, as is
kamui foohandsfooto the system OpenSSH client. Aliases, jump hosts, keys, and Tailscale names all work, with normal host-key checks. -
Ports show up within a second
One discovery command lists the remote's listening TCP ports every second with
ss,lsof, ornetstat. Each one opens on your laptop's127.0.0.1and::1and goes away when the remote service stops. -
OAuth callbacks just work
A callback port is mirrored before you finish signing in, so the redirect to
localhostreaches the agent instead of your laptop. -
Polite about conflicts
A port already taken on your laptop stays with whoever has it. Ports under 1024 are opt-in. Nothing touches proxy settings, firewall rules, or network extensions.
Usage
$ kamui foo DESTINATION STATE foo ● connected MIRRORED: 3000, 5173, 5432 EXCLUDED: 22 CONFLICTS: - MIRROR ERROR: - To disconnect, run: kamui stop foo
# sessions, ports, conflicts $ kamui status # ports under 1024 are opt-in $ kamui foo --include-port 443 # check your setup $ kamui doctor foo # or: kamui stop --all $ kamui stop foo
The destination can be an alias from ~/.ssh/config, a hostname, or user@host. Start your
services the way you always do. All commands
Install
# CLI $ brew install narasaka/tap/kamui # menu bar app + CLI $ brew install --cask narasaka/tap/kamui-app # from source $ go install github.com/narasaka/kamui/cmd/kamui@latest
Runs on macOS and Linux, on either end. You need OpenSSH locally. The remote needs an SSH server with TCP forwarding
and one of ss, lsof, or netstat.
More
Menu bar app
On macOS 13 or later, the menu bar app lists your sessions and their ports, opens a port in your browser with one
click, and connects to hosts from your SSH config. It drives the kamui CLI, so sessions keep running if
you quit it. More
Dedicated browser
kamui browser foo opens an isolated browser profile whose localhost points at the remote
machine. It doesn't open ports for other programs on your laptop.
More
Every process on your laptop can reach mirrored services, and browsers treat them as localhost. Only use
Kamui with hosts you trust.