Skip to content

0003 — One daemon owns all upstreams; clients connect over local HTTP ​

Status: Accepted (2026-11-03). Amended:

  • 2026-11-04 (wayfindr-fth): wayfindr service install supports launchd and systemd only, and refuses elsewhere, Windows included.
  • 2026-11-04 (wayfindr-st1): an HTTP upstream that doesn't speak Streamable HTTP falls back to the legacy HTTP+SSE transport; transport = "sse" forces it.
  • 2026-11-05 (wayfindr-6hj): HTTP upstreams are re-polled for tool changes every index.refresh_interval.
  • 2026-11-06 (wayfindr-t08.11): a daemon lock allows one daemon per data directory.
  • 2026-11-07 (wayfindr-r609): wayfindr stop and wayfindr logs.
  • 2026-11-09 (wayfindr-7a8p): the daemon advertises elicitation and relays it to clients (0008); sampling and roots stay declined.
  • 2026-11-11 (wayfindr-5rbg): client auth has a default client token and scoped ones (0012).
  • 2026-11-12 (wayfindr-3e6f): the command is now wayfindr start, which runs the daemon in the background by default (--foreground runs it in place); wayfindr serve remains as a hidden alias.
  • 2026-11-21 (wayfindr-z5q8): a request through a tunnel can reach /mcp with a remote client token, for cloud agents (0021).

Context ​

If every harness spawned its own stdio gateway, N processes would each spawn duplicate stdio upstreams and race each other to refresh the same OAuth tokens. With rotating refresh tokens, that race logs users out (0004).

Decision ​

  • wayfindr serve runs one daemon that exposes Streamable HTTP on 127.0.0.1:7777 (configurable). wayfindr service install registers it as a launchd or systemd user unit. (Amended 2026-11-12, wayfindr-3e6f: the command is wayfindr start.) On other systems, Windows included, service install refuses and says to run the daemon under your own supervisor (amended 2026-11-04, wayfindr-fth).
  • The daemon holds an OS lock on a file in its data directory while it runs, so a second daemon on that directory refuses to start rather than share its store. The OS drops the lock when the process exits, so it is never stale (amended 2026-11-06, wayfindr-t08.11). wayfindr stop stops the daemon that holds it, and wayfindr logs prints the daemon's log (amended 2026-11-07, wayfindr-r609).
  • wayfindr stdio is a stateless shim that forwards stdio to the daemon and starts the daemon if needed.
  • Client auth: the daemon binds to loopback only, validates Origin, and requires a bearer client token generated by wayfindr init. Amended 2026-11-11: that is the default client token; scoped client tokens limit a client to named connectors and can't use the admin API (0012). The daemon still binds to loopback only, but a request through a tunnel the user runs can reach /mcp when it carries a remote client token (amended 2026-11-21, wayfindr-z5q8; 0021).
  • Protocol versions: the daemon serves 2025-06-18, 2025-11-25, and 2026-07-28 to clients. It negotiates the highest common version with each upstream independently, and holds stateful 2025-x upstream sessions itself, hidden from stateless clients.
  • Toward upstreams, the daemon advertises no sampling, elicitation, or roots capability. Server-to-client requests (2025-x) and input_required results (2026-07-28) are declined, and the originating call_tool returns an error. (Amended 2026-11-09, wayfindr-7a8p: the daemon advertises elicitation and relays it; see 0008.)
  • Upstream lifecycle: on startup, every connector is connected and synced. After that, stdio upstreams are spawned on demand and stopped after 10 minutes idle. HTTP upstreams reconnect lazily. They are also re-polled for tool changes every index.refresh_interval, or at the interval a tools/list cache hint gives (amended 2026-11-05, wayfindr-6hj). An HTTP upstream whose initialize POST gets a 4xx other than 401 or 403, as a legacy server answers, is retried over HTTP+SSE; transport = "sse" uses it from the start (amended 2026-11-04, wayfindr-st1).

Consequences ​

  • Single-flight token refresh only needs in-process locking.
  • HTTP-only clients need the daemon running, so the service unit matters.
  • The data model carries a user dimension (a single default user in local mode), so a later multi-user server mode doesn't need a schema rewrite. Team mode, and refresh coordination across replicas, are deferred.

Released under the Apache 2.0 License.