Claude Code MCP startup wait: Sume tools missing on the first -p turn

Headless Claude Code bounds how long turn one waits for MCP servers with CLAUDE_CODE_MCP_STARTUP_WAIT_MS. Name Sume tools and check mcp_health first.

5 min readSume
All posts

If the first headless Claude Code turn cannot see your Sume tools, the server may still have been connecting. Claude Code has an environment variable, CLAUDE_CODE_MCP_STARTUP_WAIT_MS, that bounds how long the first non-interactive turn waits for connecting MCP servers, and 0 means do not wait (Claude Code changelog, read 2026-10-04). Set it high enough for a remote server, and make the first prompt check mcp_health before it relies on a paid tool.

What the changelog says about the first turn

Three entries describe the behavior. Version 2.1.283 says the first turn still waits up to 2 seconds for connecting servers named by --allowedTools or an mcp_tool hook, even when the variable is 0. Version 2.1.286 says that in headless mode a remote server whose first connect fails transiently is retried without waiting for the slowest server. And a resumed-session fix from 2.1.284 waits up to 10 seconds for a connecting server instead of failing with "No such tool available".

So a remote server such as Sume connects over the network, and the first turn races it. Naming its tools in --allowedTools is how you tell Claude Code which server the turn needs.

Headless startup behavior for MCP servers. Source: Claude Code changelog entries 2.1.283, 2.1.284 and 2.1.286, read 2026-10-04.
Setting or behaviorEffect on the first non-interactive turn
CLAUDE_CODE_MCP_STARTUP_WAIT_MS=0Do not wait for connecting servers
Server named in --allowedTools or an mcp_tool hookStill waits up to 2 seconds, even at 0
Transient first-connect failureRetried without waiting for the slowest server
Resumed session, server still connectingA call waits up to 10 seconds

A command that names the Sume tools it needs

With a server added as sume, its tools are addressed as mcp__sume__<tool>. Give the startup variable a value in milliseconds, name the two read tools the first step uses, and tell the model to stop if the check fails.

export CLAUDE_CODE_MCP_STARTUP_WAIT_MS=15000
claude -p \
  --allowedTools "mcp__sume__mcp_health,mcp__sume__tools_list" \
  "Call mcp_health. If it does not report an authenticated session,
   stop and say so. Otherwise list the visible tools."

What to check in the answer

mcp_health reports endpoint readiness, the auth source and the safety posture. An OAuth session shows mcp_oauth. tools_list shows what the session can call, and a read-only OAuth session lists read tools only. If the health call itself is missing, the server did not connect inside the wait, so raise the value before blaming Sume.

Keep paid calls out of the first step

Treat the first turn as a connectivity probe. Do the paid work in a later step, with dry_run, an optional max_spend_usd, and a stable idempotency_key, so a retried headless run does not submit twice. A server that did not finish connecting should fail a read, not a charge.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume