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.

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.
| Setting or behavior | Effect on the first non-interactive turn |
|---|---|
| CLAUDE_CODE_MCP_STARTUP_WAIT_MS=0 | Do not wait for connecting servers |
| Server named in --allowedTools or an mcp_tool hook | Still waits up to 2 seconds, even at 0 |
| Transient first-connect failure | Retried without waiting for the slowest server |
| Resumed session, server still connecting | A 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
- Claude Files API is GA: review Sume outputs by job id and media URL
The Claude Files API left beta on Aug 19. When Claude reviews generated media, store the Sume job id and media.sume.com URL, not raw provider links.
- Claude batch scripts into a Sume bulk run: holiday video pipeline
Write 100 holiday product scripts with Anthropic Message Batches, then render each as a video with one Sume bulk run. Includes the JSONL-to-items conversion.
- claude -p says Sume needs authentication after one refused write call
Claude Code 2.1.286 stopped headless runs flagging a server as unauthenticated after one refused call. Sume's scope refusal is a tool result, not a 401.
- claude -p killed by timeout or systemd: the Sume job keeps running
A supervisor that kills claude -p does not cancel the Sume job it started. List jobs, then wait or cancel before retrying, or you pay twice.
Written by Sume