Skip to content

feat: add _meta.mcpStartupAwaitTimeoutMs option to allow awaiting for requested MCP servers startup outcome on session start - #517

Merged
EugeneTheDev merged 2 commits into
mainfrom
eugenethedev/wait-for-mcp
Sep 25, 2026
Merged

EugeneTheDev merged 2 commits into
mainfrom
eugenethedev/wait-for-mcp

Conversation

@EugeneTheDev

@EugeneTheDev EugeneTheDev commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.mcpStartupAwaitTimeoutMs property 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.md for details

@EugeneTheDev EugeneTheDev changed the title feat: await requested MCP servers startup outcome feat: await requested MCP servers startup outcome on new session start Sep 15, 2026
@EugeneTheDev
EugeneTheDev requested a review from Rizzen September 15, 2026 15:47
Comment thread src/CodexAcpServer.ts
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);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Maybe we want to make that wait optional or opt-out?
  2. It might be better to introduce some waiting timeout here

What do you think?

@EugeneTheDev
EugeneTheDev force-pushed the eugenethedev/wait-for-mcp branch from c150a44 to 331a4e6 Compare September 25, 2026 12:57
@EugeneTheDev EugeneTheDev changed the title feat: await requested MCP servers startup outcome on new session start feat: add _meta.mcpStartupAwaitTimeoutMs option to allow awaiting for requested MCP servers startup outcome on session start Sep 25, 2026
@EugeneTheDev
EugeneTheDev merged commit cf6609e into main Sep 25, 2026
9 checks passed
@EugeneTheDev
EugeneTheDev deleted the eugenethedev/wait-for-mcp branch September 25, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants