Skip to main content

Module mcp_json_identity

Module mcp_json_identity 

Source
Expand description

The agent id in a workspace .mcp.json (docs/specs/SPEC_FORK_SLUG_MIGRATION_2026_10_22.md P0.3).

mcpServers.agentmux.env.AGENTMUX_AGENT_ID is the name the agent’s agentmux-mcp process routes and signs as, beside the signing keys filed under that name. The file is written at launch and then reused by every respawn, so after a rename it names the old id until something rewrites it. Both writers of that entry correct it from the definition: the launch’s writeagentconfig before it injects the keys, and each host spawn ([realign_workspace_mcp_json]).

Functions§

finish_launch
A launch’s generated .mcp.json (writeagentconfig): named for the definition’s agent id, holding no signing value, and, when hands_out_keys, with that agent’s keys ensured in the store.
keys_for_agent_open
agent_open’s generated .mcp.json: no signing value for any agent (the file holds references, not values), the keys ensured in the store for a host agent, and any value an earlier launch wrote taken out.
strip_known_agents_signing_keys
At srv start: the signing keys an older launch wrote are taken out of the .mcp.json of every agent’s working folder that holds them, not only of the folders a container agent starts in. Launches no longer write them (the agent’s MCP server asks srv for its keys), so a file that still has them belongs to an agent that has not launched since. Only the keys in the file go: nothing is re-keyed, and no trust pin changes. Best effort; returns how many files changed.
strip_signing_keys_in_folders
strip_workspace_signing_keys for each of folders, each folder once: how many files lost keys. A blank folder is skipped, and so is one with no .mcp.json or none that holds a key, which are left exactly as they are.
strip_workspace_signing_keys
A container agent’s workspace .mcp.json, with the signing keys an earlier launch wrote taken out. Run at each container start, under the lock the launch writes the file with. Only those keys are removed, and only when the file has them, so a file with none is left byte-for-byte as it was. This also covers a user’s project: keys an older launch wrote there must not ride the workspace mount into the container (a launch no longer writes any, #3680). Best-effort: a failure is logged and the start goes on.