Skip to main content

Module mcp_launch

Module mcp_launch 

Source
Expand description

The MCP servers an agent launches with, put into its .mcp.json: the same rows on both launch paths, agent.open (agent_config::build_mcp_config_from_refs) and the picker’s writeagentconfig (overlay_mcp_servers). SPEC_CONNECTORS_MCP_WHAT_AGENTS_RUN_2026_10_10.md §2.2.

Functions§

add_to_files
The picker path’s MCP step (writeagentconfig): lay the agent’s effective servers over the .mcp.json among the frontend’s files, which has only the agentmux entry and the agent’s legacy blob. Nothing to do without one, or without an agent id (an older frontend sends none).
insert_server_rows 🔒
Put server rows into an mcpServers map, each under its name. A row named agentmux is skipped: the built-in entry always wins.
is_launched 🔒
Whether a row is written into .mcp.json at all: not the reserved agentmux name, and a config that is JSON. insert_server_rows skips the others, so a server that is never launched is never “missing”.
missing_for_agent
missing_servers for agent_id: what AgentMux would launch it with now (Store::effective_mcp_servers, which gives a container agent only what is switched on for containers) against what its CLI reported.
missing_for_pane
What a pane needs a restart for: missing_for_agent for a pane running an agent definition. definition_type is that definition’s kind, None when agent_id names no definition: a quick-launch pane’s “agent id” is its provider’s name, and no .mcp.json is written for it, so there is nothing to restart for. pane_mode is the pane’s own agentMode, which writeagentconfig launched it by and the picker’s runtime override can set differently from the definition’s.
missing_servers
The catalog (global) servers AgentMux launches an agent with that its CLI doesn’t report (reported, from backend::mcp_observed), by name. That is a server bound or switched on after the agent started: .mcp.json is written at launch, so the agent needs a restart to get it. A server the CLI reports as failed is reported, so not missing. The agent’s own private servers are left out: the pane matches by name against catalog rows, and a private server can share a name with a catalog one.
overlay_for_agent
overlay_mcp_servers with agent_id’s effective servers (Store::effective_mcp_servers): refs holds the agent binds, catalog the catalog and its reach switches. The picker path’s whole MCP step.
overlay_mcp_servers
Lay an agent’s effective MCP servers (Store::effective_mcp_servers) over a .mcp.json the frontend built (the agentmux entry and the agent’s legacy blob), so a picker launch gets the same catalog servers as agent.open. Rows win over the blob on a name collision, as in agent_config::build_mcp_config_from_refs; the agentmux entry is never replaced. None when mcp_json isn’t a JSON object with an mcpServers object: the caller writes it unchanged. SPEC_CONNECTORS_MCP_WHAT_AGENTS_RUN_2026_10_10.md §2.2.