fix(mcp): keep Claude imports pending until connect#1269
Open
onlyfeng wants to merge 1 commit into
Open
Conversation
Keep Claude-origin MCP imports pending until explicit connect and restore the lifecycle regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep MCP servers imported from Claude config in
pendingstatus during MCP service initialization. They should not eagerly connect until the user explicitly callsconnect().Root Cause
The MCP initialization path iterates every configured MCP server and immediately calls
create(). Claude-origin servers are imported into config with origin metadata, but that metadata was not used to preserve the expected lazy connection behavior.Changes
cfg.mcp_origins?.[key]?.type === "claude"during MCP state initialization.{ status: "pending" }and skip eagercreate().connect()behavior remains unchanged.Validation
bun typecheckbun test --timeout 60000 test/mcp/lifecycle.test.tsCI Status Note
lintandtypecheckpass on this PR.unitcurrently fails, butupstream/main@ee4ddd2already has a failingtestworkflow (run28071223407).Claude Code local MCP server is pending until explicitly connectedis absent from this PR unit failure list.failed subtask preserves metadata on error tool statefailure is covered by companion PR fix(session): preserve failed subtask metadata #1268, not this MCP change.CheckpointContext producer,parentSessionID end-to-end, andsession.llm.streamfailures are also present on currentupstream/mainand are outside this diff.