Skip to main content

Module doctor

Module doctor 

Source
Expand description

agentmux-mcp doctor [--heal]: why this agent’s AgentMux tools aren’t connected, run from its shell with no MCP session (docs/specs/SPEC_AGENT_MCP_SELF_HEAL_2026_10_10.md §7). It checks what a person would check by hand: that this binary starts and answers MCP, also through Claude Code’s shell prefix the way the CLI starts it; the agent’s .mcp.json; what srv saw and tried; and Claude Code’s own log for the server. Read-only, except --heal, which asks srv to run the repair for the caller’s own pane.

Structs§

Entry 🔒
The agentmux entry in the agent’s .mcp.json: its command and args.
Report 🔒
Srv 🔒

Constants§

HANDSHAKE_TIMEOUT 🔒
INITIALIZE 🔒

Functions§

check_cli_log 🔒
check_config 🔒
check_handshakes 🔒
Start the server the way the CLI does, and without the prefix too, so a failure says which part broke.
cli_cache_dir 🔒
Where Claude Code keeps its per-project caches (the env-paths cache folder for claude-cli). Its own layout, so a miss is reported, not an error.
config_path 🔒
The config this doctor reads: the workspace file in a folder AgentMux owns, the relocated one in a user’s project (#3680), and the bind-mounted one inside a container.
handshake 🔒
Send initialize and wait for the answer: the server’s version, or why not.
in_container 🔒
Whether this doctor runs inside a container, for deciding what it may start. The hint in the environment (self_keys::in_container) is a word, not a fact about this system, so it is not enough for that. It also takes the fact: a Linux system with the container runtime’s own marker at the root of the filesystem.
is_in_container 🔒
log_outcome 🔒
What the CLI’s log says happened: the last attempt’s error, with what the server printed on stderr (the useful half), or that it connected.
may_start_entry 🔒
Whether doctor may start a command read from config (its agentmux entry, and the shell prefix it is started through). rule is srv’s answer about the folder the file is in: whether a host agent there gets only the servers AgentMux writes, because a container agent can write the folder or has run in it (None when srv gave no answer). On this computer a command from the file is started only on a plain no, wherever the file is and whatever named it. Inside a container nothing here runs on the host.
prefix_line 🔒
The command line the CLI hands the shell prefix: the words joined by spaces, a word it finds unsafe (one with a backslash, a space or a quote) in single quotes, a quote inside it as '\''. A bare name is left as it is.
project_key 🔒
Claude Code’s folder name for a project: its path with every character that isn’t a letter or digit made -.
report_srv 🔒
request_heal 🔒
resolve_config_path 🔒
config_path with its inputs given, so a test can pin them.
run
Run the checks, print the report, and return the exit code: 1 when a check failed.
srv_health_line 🔒
One line on what srv saw and did, from its mcp-health answer.