Repository navigation
feat(mcp): resume downstream MCP sessions on any replica - #1340
Draft
SantiagoDePolonia wants to merge 2 commits into
Draft
SantiagoDePolonia wants to merge 2 commits into
SantiagoDePolonia wants to merge 2 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This branch was successfully deployed
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.
Description
Mcp-Session-Idissued by one replica now works on every replica on the same PostgreSQL or MongoDB database, so MCP clients no longer need sticky sessions.initializewrites the session's binding to the core shared store (mcp.sessionsnamespace) before the response carries the ID: auth key ID, user path, endpoint,X-MCP-Serversscope, discovery mode, the client's initialize parameters, and the negotiated protocol version.Statelessdrops sessions altogether. It does exportStreamableServerTransportandServer.ConnectwithServerSessionOptions.State, so a replica that gets an unknown ID rebuilds the session from its record. It then serves that session's GET/POST/DELETE itself, with the SDK handler's request checks and idle timeout. Sessions a replica creates still go through the SDK handler unchanged.Last-Event-IDreplay was never supported. The gateway sends no sampling, elicitation, or roots requests, so none can be stranded.initialize, sessions stay local as before. When a store read fails, a session this replica already serves keeps working, and a session it would have to resume answers 404, so the client re-initializes.Tests: two
Serviceinstances share one store on SQLite, PostgreSQL, and MongoDB. Covered: resume with tools/list and tools/call, foreign key/user path/endpoint rejection, DELETE from either side, and virtual server deletion and recreation. Idle expiry and the bounded touch rate run against a clock-driven store. Plus the no-store fallback and the storage-type switch.