Title: mcpx: remote access over ssh -- TUI, RPC, reverse tunnels, and why not a built-in ssh server · Issue #1880 · developing-today/code · GitHub
Open Graph Title: mcpx: remote access over ssh -- TUI, RPC, reverse tunnels, and why not a built-in ssh server · Issue #1880 · developing-today/code
X Title: mcpx: remote access over ssh -- TUI, RPC, reverse tunnels, and why not a built-in ssh server · Issue #1880 · developing-today/code
Description: Relocated from dezren39/darwin-nix#85 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix...
Open Graph Description: Relocated from dezren39/darwin-nix#85 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference...
X Description: Relocated from dezren39/darwin-nix#85 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refer...
Opengraph URL: https://github.com/developing-today/code/issues/1880
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: remote access over ssh -- TUI, RPC, reverse tunnels, and why not a built-in ssh server","articleBody":"Relocated from dezren39/nix#85 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #174\n\n## Summary\n\nReach a daemon, and the TUI, from another machine. Three separate wants get conflated under \"ssh\": a\n**terminal UI over ssh**, **RPC over ssh** (the `/v1` API and MCP tunnelled through an ssh connection), and\n**inbound access to a daemon behind NAT** (a reverse tunnel, or a built-in reverse shell). They have very\ndifferent costs, and two of the three are already mostly solved by transports mcpx has.\n\n## Original notes\n\n> - ssh rpc, ssh server, ssh tui\n\n> - reverse-shell/shell/ssh/tui\n\n## Current state (what mcpx does today, with file refs)\n\n| capability | today | file |\n| --- | --- | --- |\n| full-screen TUI, six views | `mcpx tui` (browse/log/stats/servers/sessions/storage) | `internal/tui/tui.go:41-51` |\n| the TUI reads through an interface, not the client | `tui.Source` — eight methods, a fake drives it in tests | `internal/tui/data.go:19-28` |\n| talk to a daemon elsewhere | `daemon.endpoint`, scope client, accepts a URL or `unix:///path` | `internal/settings/registry.go:350-363`, `internal/cli/client.go:130-160` |\n| listen wider than loopback | `daemon.address` (default `127.0.0.1`), `daemon.port` | `internal/settings/registry.go:343-375` |\n| MCP over a spawned process | `mcpx serve --transport stdio`; every other transport is explicitly refused and redirected to the daemon's `/mcp` | `internal/cli/serve.go:358-383` |\n| MCP over HTTP | the daemon serves it at `/mcp` | `internal/daemon/routes_proto.go` |\n| events | `GET /v1/events` (SSE) | `internal/api/ops.go` |\n| ssh is already an acknowledged transport | \"A unix socket can be ssh-forwarded\" | `docs/exec.md:189` |\n\nTwo facts that shape every option below:\n\n1. **`ssh host mcpx \u003canything>` already works.** `ssh host mcpx tui` is an SSH TUI. `ssh host mcpx serve\n --transport stdio` is MCP-over-SSH and is a valid `command` for any MCP client's stdio transport, today,\n with no mcpx change. What does *not* work is talking to a remote daemon from a local `mcpx` when the\n remote is only reachable over ssh: `daemon.endpoint` understands `http(s)://` and `unix://` and nothing\n else.\n2. **mcpx has five direct Go dependencies and the package file treats that as a design property**\n (`pkgs/mcpx/package.nix:36-53` enumerates and justifies each one). `charmbracelet/wish` v1.4.7 adds\n ~15 modules to the graph including `go-git/go-git/v5`, `ProtonMail/go-crypto` and `cloudflare/circl`\n (verified from `https://proxy.golang.org/.../wish/@v/v1.4.7.mod`). Unused packages are dropped by the\n linker, but `go.sum` and the nix `vendorHash` are not, and mcpx currently has no `golang.org/x/crypto`\n at all. wish v1.4.7 requires bubbletea v1.3.4; mcpx is on v1.3.10, so the bubbletea major line does match.\n\n## Approaches\n\n### Approach A — a built-in SSH server (`mcpx ssh` / `daemon.ssh.*`), least recommended\n\nImport `charmbracelet/wish` and serve the existing bubbletea program over SSH with\n`wish/bubbletea.Middleware`. Because `tui.Source` is already an interface and the model already takes its\nsize from the terminal, the TUI part genuinely is nearly free — an afternoon.\n\nEverything around it is not. An SSH server needs a host key (generate where? rotate how? what does a client\ndo when it changes?), an authorised-keys policy, a per-connection identity that the `/v1` API has no concept\nof, PTY allocation, window-change handling, and a listener whose lifetime is tied to a daemon that may\nidle-exit under the connection. It is a second implementation of something every target machine already\nruns, with worse defaults, and it makes mcpx a network daemon that accepts credentials — a category it is\nnot in today. `daemon.address` is currently documented as \"the network it is reachable from is the access\ncontrol\"; a built-in sshd is a promise that mcpx cannot keep at that level of care. The dependency cost\nabove is real but is the smaller objection.\n\nIf it is built anyway, it should be a *separate binary or a build tag*, not linked into the default `mcpx`,\nand it should refuse to start without an explicit `authorizedKeys` path rather than defaulting to anything.\n\n### Approach B — teach `daemon.endpoint` an `ssh://` scheme, tunnelled through the system `ssh`\n\nNo server, no keys, no crypto dependency: mcpx becomes an SSH *client*, and only by exec'ing the `ssh` the\nuser already has configured. `daemon.endpoint = ssh://user@host` makes `NewClientAt` install an\n`http.Transport.DialContext` that spawns `ssh -q user@host mcpx \u003cstdio-proxy-subcommand>` and returns the\nprocess's stdin/stdout pipes as a `net.Conn`. The subcommand is a ~40-line pipe between stdio and the local\ndaemon socket. Everything downstream — `/v1`, SSE, `/mcp`, the generated client — is unchanged, because it\nis all HTTP over a byte stream and the byte stream is the only thing that moved.\n\nWhat this buys, in one setting:\n\n- `mcpx tui --daemon-endpoint ssh://build-box` is a remote TUI, rendered locally, with local colours and\n local terminal handling. Better than a wish-served TUI, not worse: no PTY negotiation, no resize\n forwarding, works over a flaky link because only the HTTP stream is on the wire.\n- `mcpx call`, `mcpx exec`, `mcpx status`, `mcpx ls` all point at the remote daemon for free — they already\n honour `daemon.endpoint` (`internal/settings/registry.go:361-362` lists the commands).\n- Auth, host-key verification, `~/.ssh/config`, jump hosts, agent forwarding, `ProxyCommand`, Match blocks:\n all inherited, none implemented.\n\nCosts and open edges. The remote needs `mcpx` on `PATH` (`ssh://host?bin=/opt/mcpx/bin/mcpx` covers the\nrest). One ssh process per connection unless `ControlMaster` is set up — worth documenting, possibly worth\npassing `-o ControlMaster=auto -o ControlPersist=60s` by default. Lifetime follows #87's rule (#181\ncollision 9, owned there): requests over the tunnel renew the remote daemon's idle deadline, a persisting\nssh master with no requests on it does not, and `ControlPersist` bounds only the ssh process. `mcpx` must not be started remotely with\nautostart semantics that surprise (`daemon.endpoint` today deliberately refuses to autostart a remote\ndaemon; the ssh case is ambiguous and should follow the same rule: fail rather than start). Artifact\n`sharedFs` must be false over ssh, which `docs/exec.md:189-193` already anticipates — remoteness is declared\nby the caller, so this is a caller-side default, not an inference.\n\nThe pure-documentation variant of the same idea costs nothing and should ship regardless: OpenSSH has\nforwarded unix sockets since 6.7, so `ssh -N -L 7777:/path/to/daemon-\u003ckey>.sock host` plus\n`daemon.endpoint=http://127.0.0.1:7777` works today with no code. Put it in `docs/` as the zero-change\nrecipe. It is clunky enough (you must know the remote socket path — see the socket-path issue) that it is\nnot a substitute for the scheme.\n\n### Approach C — recommended: B, plus name the three cases and close the reverse-access one with a tunnel, not a shell\n\nRecommended. Ship the `ssh://` endpoint scheme from B, and alongside it settle the other two questions\nexplicitly rather than leaving \"ssh\" as one word:\n\n**1. \"ssh tui\" — solved by B.** Document `ssh host mcpx tui` as the zero-config answer and\n`--daemon-endpoint ssh://host` as the better one. Do not build a server for it. Reassess only if someone\nwants a TUI on a machine that has no `mcpx` and cannot get one — a real but narrow case that a static\nbinary answers more cheaply than an SSH server does.\n\n**2. \"ssh rpc\" — B is the whole of it.** Note that MCP-over-ssh needs no work at all: any MCP host can be\nconfigured with `command: ssh, args: [host, mcpx, serve, --transport, stdio]`. This deserves a section in\n`docs/protocol.md` because it is free and nobody will guess it. A `mcpx client --ssh host` generator that\nemits that snippet for a given host is the useful sliver.\n\n**3. \"reverse shell\" — use a tunnel, do not write one.** The underlying need is a daemon behind NAT that\nsomething outside must reach. `ssh -R` already does this, and so does tailscale/wireguard, and both are\nbetter at it than anything mcpx would grow: they reconnect, they authenticate, they are audited. mcpx's job\nis to be *easy to put behind one*, which means (a) `daemon.address` already exists, (b) the daemon should be\nable to bind an additional listener given as an address so a tunnel has a stable target, and (c) a\ndocumented `ssh -R` recipe. An actual reverse shell — the daemon dialling out to a rendezvous and accepting\ncommands — is a backdoor with a friendly name, and the first thing an enterprise security review will\nreject; it should not be built.\n\n**4. \"shell\" — a separate, orthogonal feature worth one line.** The notes list `shell` beside the remote\nitems but it is a *local* gap: there is no `mcpx shell` REPL, only `mcpx tui` (full-screen, mouse-driven)\nand `mcpx prompt` (one-shot, `internal/cli/consumer.go:399`). A line-oriented REPL that keeps one daemon\nconnection and accepts `call`, `ls`, `exec` lines would be cheaper than either and is what people reach for\nover a slow link where a full-screen redraw hurts. It composes with B: `mcpx shell --daemon-endpoint\nssh://host`. Tracked here so it is not lost, but it is the smallest item in the issue.\n\n## Open questions\n\n- Does `mcpx \u003cstdio-proxy>` want to be a public subcommand (discoverable, documented) or hidden (an\n implementation detail of the ssh scheme)? Hidden risks people reimplementing it; public risks it being\n treated as a supported protocol.\n- Should `ssh://` reuse `daemon.endpoint`, or is a separate `daemon.transport` setting cleaner once there\n are three schemes? Current opinion: one setting, the scheme carries it, because every command that already\n lists `daemon.endpoint` then gets ssh for free.\n- Over ssh, does SSE (`/v1/events`) behave? It is a long-lived HTTP response over a pipe; it should, but it\n is the one thing in B worth prototyping before committing.\n- If a wish-based server is ever built, does it go behind a build tag, a separate `cmd/`, or a separate\n flake package? (#49 is relevant: every package needs a CI build.)\n- `ControlMaster` by default: convenience, or a surprising process left behind? (The daemon side is\n settled by #87: an idle master does not hold the daemon. What remains is whether mcpx should leave an ssh\n process on the *local* machine for `ControlPersist` seconds.)\n\n## Ease · Impact · Related\n\n**Ease**: S for the documentation and the `ssh host mcpx serve` recipe; **M** for the `ssh://` endpoint\nscheme and stdio proxy; **L** for a wish-based SSH server (A), mostly in policy rather than code.\n**Impact**: med — high for anyone with a remote or containerised daemon, nil for a single-laptop user.\n**Depends on / related**: #88 (an `ssh -L` recipe needs a knowable remote socket path; #88 also owns\n`MCPX_SOCKET` precedence, collision 8, which matters once a second machine is asking), #87 (owns the\nlifetime rule this issue applies, collision 9), #76 (CLI parity for `/v1`-only ops — a remote TUI makes the\ngaps more visible), #49 (any new package or build tag needs CI), #86 (`ssh -L` plus `/ui/` is the remote\ndashboard), #52 (closed, fixed in #182). A Containerfile now exists (#182, `pkgs/mcpx/Containerfile`), so\nthe \"containerised daemon\" in the Impact line is a shipped shape, not a hypothetical.\n\nSecurity/auth deferred; see tracker.\n\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:14:25Z","url":"https://github.com/developing-today/code/issues/1880"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:242c5103-12c7-1af7-7c28-c05c40f82e86 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E506:2A9AB5:313A61:40567E:6B06169A |
| html-safe-nonce | 65ec0d9dd82d6c1e2fee8a59a836a70a32ba40227851f25bf115beadce918540 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTA2OjJBOUFCNTozMTNBNjE6NDA1NjdFOjZCMDYxNjlBIiwidmlzaXRvcl9pZCI6IjMwODQ4MzkxMzUyMDM0MzIwOTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4913089b5f20e4cea908274299766a267edba4bc24f90a86c998ab2a4d7832be |
| hovercard-subject-tag | issue:6088471922 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1880/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2909843bea9a98c0b5485431b4db67b1e70973503aaf2a7795ce37018acb7d99/developing-today/code/issues/1880 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2909843bea9a98c0b5485431b4db67b1e70973503aaf2a7795ce37018acb7d99/developing-today/code/issues/1880 |
| og:image:alt | Relocated from dezren39/darwin-nix#85 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width