feat: add _meta.mcpStartupAwaitTimeoutMs option to allow awaiting for requested MCP servers startup outcome on session start - #517
Merged
Conversation
Rizzen
requested changes
Sep 16, 2026
Comment on lines
+705
to
+723
| if (requestedMcpServers.length > 0 && mcpServerStartupVersion !== null) { | ||
| const pendingStartup = this.createPendingMcpStartupSession( | ||
| requestedMcpServers, | ||
| mcpServerStartupVersion, | ||
| ); | ||
| if (canPublishSessionUpdates) { | ||
| this.pendingMcpStartupSessions.set(sessionId, pendingStartup); | ||
| } | ||
| try { | ||
| await pendingStartup.startup; | ||
| } catch (err) { | ||
| if (this.pendingMcpStartupSessions.get(sessionId) === pendingStartup) { | ||
| this.pendingMcpStartupSessions.delete(sessionId); | ||
| } | ||
| throw err; | ||
| } | ||
| if (canPublishSessionUpdates) { | ||
| this.publishMcpStartupStatusAsync(sessionId); | ||
| } |
Collaborator
There was a problem hiding this comment.
As far as I understand - in case we have any MCP servers - we wait for their init always and for unbounded time. Two questions/concerns:
- Maybe we want to make that wait optional or opt-out?
- It might be better to introduce some waiting timeout here
What do you think?
EugeneTheDev
force-pushed
the
eugenethedev/wait-for-mcp
branch
from
September 25, 2026 12:57
c150a44 to
331a4e6
Compare
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.
Currently, session/new starts a new thread and processes incoming requests immediately, without waiting for the requested MCP servers to be ready. Introduce an optional
_meta.mcpStartupAwaitTimeoutMsproperty to allow await when starting/resuming/forking a session to make sure all MCPs are available before the first user request.Default behavior is unchaged.
See
docs/mcp-startup-await-timeout.mdfor details