MCP server headroom connection timeout blocks first model call on every startup (30s delay)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Describe the bug
On every Jcode startup, the first model call is delayed by ~30 seconds because the MCP server headroom connection times out. The login message "MCP: advertised 14 cached tool(s) from 1 server(s) at spawn" appears, followed 30 seconds later by "Failed to connect to MCP server headroom: Request timeout: deadline has elapsed".
Steps to reproduce
- Start Jcode
- Observe that the first LLM call hangs for ~30 seconds
- Check logs: the MCP server headroom connection consistently times out
Expected behavior
Jcode should gracefully handle MCP server connection failures without blocking the first model call.
Actual behavior
Every startup shows this pattern:
[INFO] MCP: advertised 14 cached tool(s) from 1 server(s) at spawn
... 30 seconds later ...
[ERROR] Failed to connect to MCP server headroom: Request timeout
Occurrences today (7/7 restarts)
All 7 Jcode restarts today exhibited this 30s delay (timestamps from logs).
Environment
- Jcode version: v0.60.0 (4f147a0c)
- OS: Linux (Red Hat KVM, x86_64)
- Provider: OpenRouter
- MCP servers: headroom only
Suggested fix
- Non-blocking MCP init: first model call should not be blocked by MCP init
- Shorter default timeout: consider 5-10s with background retry
- Graceful degradation: log warning, don\t block user interaction
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing MCP initialization and the first model-call path, then reproduce startup with the headroom server while checking the logged timeout. Done means an MCP connection failure no longer delays the first model call, while the failure is logged and can be retried in the background.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100