Title: mcpx: a web frontend served by the daemon, without a second build system · Issue #1882 · developing-today/code · GitHub
Open Graph Title: mcpx: a web frontend served by the daemon, without a second build system · Issue #1882 · developing-today/code
X Title: mcpx: a web frontend served by the daemon, without a second build system · Issue #1882 · developing-today/code
Description: Relocated from dezren39/darwin-nix#86 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#86 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#86 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/1882
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: a web frontend served by the daemon, without a second build system","articleBody":"Relocated from dezren39/nix#86 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\nA browser view of a running daemon. The daemon is already a web server — HTTP over a unix socket and\nloopback TCP, `/v1/*`, SSE at `/v1/events`, an OpenAPI document at `/v1/openapi.json`, MCP at `/mcp` — so\n\"web server\" is done and \"web frontend\" is the whole of the work. The decision is not *whether* to serve\na UI but *how much build system* to accept for it, because mcpx is one `buildGoModule` derivation today and\na bundled SPA makes it two.\n\n## Original notes\n\n> - web frontend\n\n> - web server\n\n## Current state (what mcpx does today, with file refs)\n\n- **The listener exists.** The daemon serves HTTP on a unix socket and, with `daemon.port`, on TCP;\n `daemon.address` (default `127.0.0.1`) chooses the interface\n (`internal/settings/registry.go:343-375`). Nothing serves static content — every route is registered\n explicitly in `internal/daemon/ops.go`, `routes_proto.go`, `routes_settings.go`, `routes_consumer.go`,\n `routes_resolve.go`, `routes_exec.go`; there is no `http.FileServer` and no `/` handler.\n- **The data a UI needs is all there.** 60 operations across `internal/api/ops*.go`, one table that\n already generates routes, MCP tools and the OpenAPI document. Every view the TUI has —\n browse/log/stats/servers/sessions/storage (`internal/tui/tui.go:41-51`) — is a `/v1` call, and the\n read surface is captured as an eight-method interface (`internal/tui/data.go:19-28`).\n- **Live updates exist.** `GET /v1/events` is SSE (`internal/api/ops.go:156`), honours `Last-Event-ID` so a\n reconnecting `EventSource` resumes by itself, and says `event: gap` in-band when it cannot\n (`internal/daemon/server.go:797-842`).\n- **An open stream does not keep the daemon alive today.** The idle clock is stamped when a request starts\n (`server.go:344-353`), so an open tab holding `/v1/events` is not activity after it connects; see #87.\n- **`go:embed` is already in use** (`internal/defaults/defaults.go:24`), so embedding assets costs no new\n mechanism.\n- **The nix package is deliberately minimal**: `subPackages = [ \"cmd/mcpx\" ]`, one `vendorHash`, and a\n comment block that enumerates and justifies each of five direct Go dependencies\n (`pkgs/mcpx/package.nix:36-53`).\n\n### `.lootbox/ui` — assess before reusing\n\n36 tracked files under `.lootbox/ui`: React 18, Vite 6, Tailwind 3, a shadcn/radix component set\n(`components/ui/*`), `@tanstack/react-query`, zustand, monaco, and exactly **one page**,\n`src/pages/Dashboard.tsx` (193 lines) behind a 34-line `App.tsx`. A prebuilt bundle is committed\n(`assets/index-B2p0eWoj.css`, `assets/index-BkA-9JbN.js`); `dist/` is empty; `node_modules/` is 279 MB and\nuntracked. #49 already records that this copy is **not built by the flake** — the lootbox that actually\nruns is built from upstream (`flake.nix:388`) — so it has no build check and nothing depends on it.\n\nVerdict for this issue: it is *lootbox's* dashboard, not mcpx's, and its one page is not a starting point\nfor an mcpx UI. The reusable part is the shadcn component set, which is a copy of an upstream generator's\noutput and can be regenerated at any time. It should not be adopted as mcpx's frontend, and #49's other\noption — delete it — is not blocked by anything here.\n\n## Approaches\n\n### Approach A — vendor a React SPA into the repo and bundle it at build time, least recommended\n\n`ui/` with Vite + React + Tailwind, `npm run build` into `internal/web/dist`, `go:embed` the result, serve\nit at `/`.\n\nWhy not: it turns one derivation into two with two fixed-output hashes. `buildGoModule` grows a\n`buildNpmPackage` stage and an `npmDepsHash` that Renovate will break on a cadence — #49 is *already* about\nthe vendorHash/npmDepsHash repair step never having run on a real bot PR, and this doubles the surface it\nmust handle. It also means the committed tree contains generated bundles (as `.lootbox/ui` does) or that\n`nix build .#mcpx` requires network-free npm vendoring for a UI most users will never open. A 280 MB\n`node_modules` in a repo whose Go side is proud of five dependencies is a values mismatch, not just a size\none. And the maintenance is not the initial build: it is React majors, Tailwind majors and Vite majors\narriving on a project whose owner is writing Go.\n\n### Approach B — publish the contract and let the UI be someone else's repo\n\nDo no frontend work. Make `/v1/openapi.json` good enough that `openapi-typescript` or `oapi-codegen`\nproduces a usable client, document the SSE stream in the same document, and point at it from the README.\nAnyone who wants a dashboard generates a client and builds one outside this repo.\n\nThis is genuinely defensible and is most of the value at nearly no cost. The OpenAPI document is generated\nfrom the same ops table as the routes (`internal/api/openapi.go`), so it cannot drift, which is exactly the\nproperty a generated client needs. `docs/proposals.md:440` already gestures at this — \"a dashboard, a test\nharness, another language's client generator — use the same…\".\n\nWhere it falls short: a contract is not a UI. Nobody gets a browser view by default, \"open the dashboard\"\nstays a multi-step setup, and the honest outcome of \"someone will build it\" is that nobody does. It is also\nnot mutually exclusive with shipping something — the work below assumes the OpenAPI document is good, and\nany gaps found while building a UI against it are bugs in the contract worth fixing anyway.\n\nWorth checking cheaply as part of this: does `/v1/openapi.json` currently pass `openapi-typescript` and\n`spectral lint` clean? If it does not, that is a small, high-leverage fix regardless of which approach wins.\n\n### Approach C — recommended: a zero-build frontend embedded in the binary, plus a directory escape hatch\n\nRecommended. Ship a small, dependency-free frontend — plain HTML, CSS and ES modules, no bundler, no npm,\nno transpile — `go:embed`ed into the binary and served by the existing listener. Modern browsers run ES\nmodules and `import` directly; a five-file frontend that calls `fetch('/v1/...')` and subscribes to\n`EventSource('/v1/events')` needs no build step at all. `nix build .#mcpx` stays one derivation with one\nhash, and `mcpx daemon --ui` is a dashboard on a machine that has nothing installed but a browser.\n\nShape:\n\n| decision | choice | why |\n| --- | --- | --- |\n| where | the daemon's existing listener, at `/ui/` | a second listener is a second lifetime, a second address and a second thing to leak; the daemon's idle-exit and reload already work |\n| enabling | one setting, `daemon.ui` (bool, scope daemon, default off) | matches how every other capability is exposed (`internal/settings/`); off by default so a daemon on `daemon.address=0.0.0.0` does not silently gain a UI |\n| overriding | `daemon.uiDir` (string, default empty) serves a directory instead of the embedded assets | the escape hatch that makes A unnecessary: anyone who wants a React SPA builds it wherever they like and points the daemon at `dist/`. Also the dev loop — edit, reload, no rebuild |\n| data | `/v1` + `/v1/events` only, no UI-specific endpoints | the parity rule (`docs/parity.md`) is CLI = `/v1` = MCP = plugin; a `/ui/api` prefix would be a fifth surface that drifts |\n| scope v1 | the TUI's six views, read-only, plus answering elicitations | elicitation is the one thing a browser is *better* at than the terminal — a form with a schema beats a prompt — and `/v1/elicit/{id}/{action}` already exists |\n| idle | apply #87's lifetime rule (#181 collision 9): activity on any surface renews the daemon's idle deadline, and nothing else does | today an open `/v1/events` stream counts only when it connects, so `daemon.idleExit` can kill the daemon under an open tab. Whether a delivering stream counts as activity is decided once, in #87, for this surface and ssh (#85) together -- not here |\n\nWhy this beats A: the cost that kills A is the toolchain, not the UI, and a no-build frontend has no\ntoolchain. Why it beats B: B's contract work is a *prerequisite* of C, not an alternative — building the\nembedded UI against `/v1` is the thing that proves the OpenAPI document is usable, and C ends with B's\ndeliverable plus a working dashboard.\n\nThe real risk of C is scope creep: without a framework, view number seven is where hand-written DOM code\nstarts hurting. Mitigate by fixing the scope at \"the TUI's views, plus elicitation forms\" and treating\nanything beyond that as a reason to reach for `daemon.uiDir` and an external project. If the UI outgrows\nno-build, `daemon.uiDir` means moving it out is a configuration change rather than a rewrite.\n\nOne more reason to prefer the embedded route: it makes the remote story work end to end. With the ssh\nendpoint scheme in the sibling issue, `ssh -L 7777:...` plus `http://127.0.0.1:7777/ui/` is a remote\ndashboard with nothing installed locally — which is most of what the \"ssh tui\" want is actually asking for.\n\n## Open questions\n\n- `/ui/` or `/`? Serving at `/` risks a future `/v1`-adjacent path colliding and makes a 404 ambiguous\n between \"no such route\" and \"no such asset\". `/ui/` with a redirect from `/` is probably right.\n- Does the UI need write operations in v1, or is read-only + elicitation the correct first cut? Write\n operations (`restart`, `shutdown`, `servers_remove`) are marked `Admin`/`Destructive` in the ops table\n (`internal/api/ops.go:451-466`, `internal/api/ops_settings.go:111`), and a browser is exactly where a\n misclick happens.\n- Is `.lootbox/ui` deleted, kept as a reference, or given a CI build? #49 owns the decision; this issue's\n input is that it is not a useful base for mcpx.\n- Does `/v1/openapi.json` currently generate clean with `openapi-typescript`? Cheap to check, informs both\n B and C.\n- Browser support floor: ES modules and `EventSource` are universal, but import maps and `\u003ctemplate>`-based\n rendering vary. Writing the floor down avoids a debate later.\n\n## Ease · Impact · Related\n\n**Ease**: S to serve a directory and add the settings; **M** for the embedded read-only frontend covering\nthe TUI's six views; **L** if a bundled SPA (A) is chosen. **Impact**: med — high for demos, remote\nmachines and anyone who will not open a terminal; low for the existing CLI-first user.\n**Depends on / related**: #49 (`.lootbox/ui` has no build check and may be deleted; any new build stage\nneeds CI), #76 (CLI parity — a UI makes `/v1`-only operations visible to more people), #77 (protocol\nfollow-ups: inline answers and task status are what a live dashboard would want), #87 (owns the lifetime\nrule this issue applies, collision 9; also touch-on-read for the elicitations the UI answers), #85 (a\nforwarded port plus `/ui/` is the remote dashboard), #88 (the forwarded port needs a knowable socket path),\n#52 (closed, fixed in #182).\n\nSecurity/auth deferred; see tracker.\n\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:14:59Z","url":"https://github.com/developing-today/code/issues/1882"}
| 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:97f1d8d8-7832-9c7d-e33a-e549f65495a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BE0:3B6B85:34ACD8:456C6C:6B061792 |
| html-safe-nonce | 78eb9a5f5692cf07f50a121eaae64edb257fc89853cb15d6a4d8991ca1866a50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkUwOjNCNkI4NTozNEFDRDg6NDU2QzZDOjZCMDYxNzkyIiwidmlzaXRvcl9pZCI6IjY2NzM2Njk4NDg3NTA3NTc3NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d98c9a42429ef781032ae220269cd1a7072612b85b2a9f4cb6915c610ccc37cc |
| hovercard-subject-tag | issue:6088479603 |
| 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/1882/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc08b68c09a09726613d82b6d1594dafeae8ffefa78d4638fe55e7f999193d55/developing-today/code/issues/1882 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc08b68c09a09726613d82b6d1594dafeae8ffefa78d4638fe55e7f999193d55/developing-today/code/issues/1882 |
| og:image:alt | Relocated from dezren39/darwin-nix#86 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