`mcp.http.enable` is the fourth unit and the first that listens on a
port. The comment on the `mcp` block said anything that started a daemon
here "would be inventing a second thing to supervise", so it is rewritten
rather than deleted: what changed is not the cost of supervising it but
what it buys -- a port is reachable by a caller who never touched this
filesystem, which is the first time a token on this surface means
anything. The two options stay independent and neither implies the
other.
`mcp.stateDir` defaults to /var/lib/hhstream-mcp and is deliberately NOT
`sessions.stateDir`. That directory is 0700 owned by the broker's user
and holds `events.jsonl`; parking a token file in it would grant this
shim write access to the audit trail's directory for no reason, and the
two have different lifetimes besides. A tmpfiles entry rather than
`StateDirectory=`, for the reason the broker's state dir is one --
`StateDirectory=` can only name a path under /var/lib and would stop
applying the moment the option is pointed elsewhere.
The unit runs as sessions.user with sessions.group, because its tools are
the CLI's handlers called in process and that CLI opens a 0660 control
socket owned by that user and a compositor runtime directory owned by
that group. `Wants`/`After` the broker and not `BindsTo`: the frame
verbs answer with the broker down and the rest answer exit 5, which is a
true answer, whereas a listener that vanished with the broker would turn
that into a connection refused and tell a client nothing. The systemd
default KillMode is right here and `KillMode=process` -- which the broker
and the driver both need -- would be wrong, because every process this
unit starts is part of answering one request.
Two assertions and two warnings, each for a failure that is otherwise
discovered from the far side of an HTTP client:
* http.enable without sessions.enable is an assertion, not the warning
`mcp.enable` gets against the same condition, because there the frame
tools still work and here `User=` names an account that does not exist.
* a wildcard bind with no allowedHosts is an assertion, because the
SDK's rebinding allowlist has no implicit localhost and the unit would
come up refusing everything with a 421.
* a non-loopback address warns that the token crosses the wire in clear
text, since the option reads like a bind address and not like a
decision about what is on it.
* openFirewall warns and is not implied by http.enable, the same way
sessions.stream.openFirewall is not implied by the stream.
`mcp.http.enable` also puts the binary on PATH, because `token mint` is
how the credential that unit demands gets issued.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchcvnbfhhZhUHy83YL3Ya