Repository navigation
Conversation
Open
1 task done
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.
#40978 | #51788 | ACP port: #35457
Why the change
Right now an MCP server that ACP passes in for one session is registered for the whole directory, so other sessions can see its tools and headers, a server with the same name from another session replaces it, and nothing stops it when the session goes away; with this change a session owns its servers, they are visible only to that session and its subagents, and they stop when the session is closed, deleted, or moved.
Special things to note
Tool.Service.transformoverrides) don't apply to session-owned MCP tools, because those tools never enter the Location tool registry. They are layered onto each step's snapshot instead.view(sessionID)lives on the newMcpSessionservice, not onMcp. The LocationMcpinterface keeps its session-free signatures and doesn't depend onSessionStore, andcallTool.sessionIDis still only MCP request metadata.oauth: false), session-scoped MCP prompts andmcp.liststatus (both stay Location-only), and cleanup when the ACP process exits or when a re-attach drops servers from its list.Change outline
The new endpoints are nested under the session, like
experimental.session.instructions.entry.*.sessionLocationMiddlewareroutes each request to the session's Location and returnsSessionNotFoundErrorwhen the session doesn't exist.Each server entry has a typed owner. The Location registry and the session registry each build their own
Mcp.makeRuntime, which holds the shared connection code, and each supplies its own lock. Only Location entries publishmcp.*.changedevents.A step builds one view and passes it to both the tool snapshot and the MCP instructions.
Servers are released without the session calling into MCP.
McpSessionlistens on its Location bus.Responsibilities by file:
Tests use a real stdio MCP server, real sessions, and a real
Session.move(packages/core/test/mcp-session.test.ts), plus an HTTP test inpackages/serverand updated ACP tests inpackages/cli.Fixes #40978
Fixes #51788