Skip to main content

Module mcp_rewrite

Module mcp_rewrite 

Source
Expand description

Rungs 3 and 4 of the MCP self-heal ladder (mcp_health, docs/specs/SPEC_AGENT_MCP_SELF_HEAL_2026_10_10.md §5): put the agentmux entry of the agent’s workspace .mcp.json right, then reconnect. Rung 3 rewrites it the way a launch writes it (the bare agentmux-mcp command, this agent’s id and channel, and no signing value: the file holds references, not values), which mends a missing or stale entry or one the user edited. Rung 4 makes the command the absolute path of the agentmux-mcp that ships with this install, which mends a PATH that does not find it.

Only mcpServers.agentmux is touched. A launch’s merge (write_mcp_json_respecting_user_servers) would also drop the servers the agent had bound and unbound since, which a repair in the middle of a session must not do. The write is under the same directory lock the launch writes with.

Functions§

run
Rung 3 or 4 for the agent on block_id, whose pane runs in work_dir. A container agent starts its server inside the image, from a copy of the file the host does not own.