{"version":"2.1.284","anchor":"headless-mcp-pre-wait-now-tracks-servers-named-by-allow-rule","canonical_anchor":"headless-mcp-pre-wait-now-tracks-servers-named-by-allow-rule","heading":"Headless runs wait for MCP servers that allow rules and hooks depend on","tier":"notice","area":"MCP","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.284\/e\/headless-mcp-pre-wait-now-tracks-servers-named-by-allow-rule","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.284","markdown":"### Headless runs wait for MCP servers that allow rules and hooks depend on\n\nIn -p and SDK runs, the first turn now waits for MCP servers named in allow rules or mcp_tool hooks before starting\n\n**Unclear.** It is not confirmed that the servers collected from allow rules and hooks are the same list the headless wait uses.\n\n**What**\n\nMCP servers are add-ons that give Claude extra tools. In headless runs, meaning `-p` or the SDK with no interactive screen, Claude Code may start the first turn before every server has connected. It now works out which servers are required and waits for those.\n\n- Required servers are collected from always-allow permission rules set by `cliArg`, `flagSettings`, `session` and `command`, and from servers used by `mcp_tool` hooks on events such as `PreToolUse`, `PostToolUse`, `UserPromptSubmit` and `PermissionRequest`.\n\n- When loading is deferred, these `requiredServerNames` are not deferred. If any are still pending, Claude Code waits for them up to a separate time limit.\n\n- At the first command the decision is recalculated, and servers that became required since startup cause a fresh wait.\n\n- The wait records a reason, `firstTurnHold`, with values such as relay, host_wait, host_no_wait, single_shot, ccr_worker, coordinator, no_tool_search, explicit_mcp_config or lifted.\n\n- The wait is timed under a new startup measure, `mcp_prewait_ms`, and also records `pendingRequiredBefore` and `requiredWaitedMs`.\n\nThe gates named `tengu_headless_mcp_first_turn_join` and `tengu_headless_mcp_prewait` are involved. Nothing has been read about either.\n\n**Why**\n\nIf a script or SDK program relies on a particular MCP server from its first prompt, its first turn is less likely to start before that server's tools exist.\n\n- Area: MCP\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5"}