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§
Constants§
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-pathscache folder forclaude-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
initializeand 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(itsagentmuxentry, and the shell prefix it is started through).ruleis 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 (Nonewhen 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_pathwith 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-healthanswer.