Connection Lifecycle
Idle Timeout
Every active connection has a per-server idle timer. When no mux_call_tool targets that server for the configured duration, the connection is terminated.
mux_call_tool("gitlab", ...) → timer reset (5 min)
│
... 3 min pass ...
│
mux_call_tool("gitlab", ...) → timer reset (5 min)
│
... 5 min pass (no calls) ...
│
gitlab KILLED ✂️
│
mux_call_tool("gitlab", ...) → respawned fresh (with cached auth)
Graceful Shutdown
On SIGTERM or SIGINT, Mux:
- Stops accepting new connections
- Sends disconnect to all active downstream clients
- Kills all spawned child processes
- Exits cleanly
Hot-Reload
The registry file is watched with a 2-second poll interval:
- Add a server → available immediately on next
mux_list_servers - Remove a server → active connection stays until idle timeout, then not reconnectable
- Modify a server → next connection uses updated config