Expand description
The MCP servers each agent’s CLI says it has, per pane: what Connectors
shows, as opposed to what AgentMux wrote into the agent’s .mcp.json
(SPEC_CONNECTORS_MCP_WHAT_AGENTS_RUN_2026_10_10.md §3).
Claude Code’s system/init frame lists every MCP server it loaded, from
every source, with a status and the CLI’s own source label:
{"name":"stub","status":"connected","source":"project"}. The label is
project (.mcp.json, which is where AgentMux’s servers go), user
(the account’s config), local, dynamic (--mcp-config, plugins),
managed, enterprise or claudeai (claude.ai connectors). Its tool
list names each server’s tools mcp__<server>__<tool>, the server name
with everything but letters, digits, _ and - made _. Checked
against the real CLI by scripts/cli-contract/mcp-servers-contract.mjs.
Only names, statuses and counts: the frame carries no server config, so
nothing secret passes through here. The health of the agentmux entry
and its repair are mcp_health’s; this only records.
Each report belongs to the spawn that sent it, by the spawn’s
process-wide registration nonce (persistent::next_registration_nonce),
which only grows. A report is kept only over one from an older or the
same spawn, and a spawn’s exit clears only its own: so a replaced process,
even one of a replaced controller whose spawn_generation restarted,
never writes over or clears a newer process’s servers. A spawn that has
exited records nothing more: its reader can still be running after the
exit is handled (an abort doesn’t stop it mid-poll), and a late report
would stay with nothing left to clear it.
Structs§
- Observation
- The servers one pane’s CLI last reported, and when.
- Observed
Server - One MCP server as the agent’s CLI reported it.
- State 🔒
Constants§
- MAX_
ENDED 🔒 - At most this many panes’ exit markers (
State::ended) are kept, the oldest spawns going first: a marker matters only while its reader may still be finishing, seconds after the exit.
Statics§
- OBSERVED 🔒
Functions§
- all
- Every pane’s last report, by block id.
- forget_
owned - Spawn
ownerexited: drop its report, or an older spawn’s still shown (a replacement that exits before reporting leaves its predecessor’s), never a newer spawn’s; and keep none it sends later. True when there was one to drop. - observed 🔒
- parse_
init - The servers in an init frame, or
Nonewhen it has nomcp_servers(not an init frame, or another provider’s). - prune
- Drop everything kept for panes whose block is gone (
existssays which still are): their reports, and their exit markers. - publish
- Tell the panes a report changed or went (
mcp:observed). - record
- Keep what spawn
ownerof a pane reported, unless a newer spawn already reported or this one has exited. True when it changed, so the caller tells the panes (mcp:observed); a resumed turn’s init repeats it. - record_
init - Record an init frame’s servers for spawn
owner. True when they changed: the caller then publishes (publish). - tool_
prefix 🔒 - The prefix of a server’s tool names in the CLI’s tool list.