fix: bump SDK to 1.26.0, fix tools_call scenario#134
Merged
Conversation
SDK 1.26.0 made Protocol.connect() throw if already connected to a transport. The tools_call scenario was calling server.connect(transport) on every request with the same Server instance, which now throws. Fixed by adding proper session management: each initialize request creates a new Server + Transport pair, and subsequent requests are routed to the correct transport via the mcp-session-id header.
commit: |
The else branch was returning 400 for both missing-session and invalid/stale-session cases. The MCP spec requires 404 for invalid session IDs and 400 only for non-initialization requests without any session ID.
Instead of adding session management, simply create a new Server instance per request. This preserves the original stateless design while fixing the SDK 1.26.0 Protocol.connect() restriction.
felixweinberger
approved these changes
Feb 5, 2026
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.
SDK 1.26.0 made
Protocol.connect()throw if already connected to a transport. Thetools_callscenario was callingserver.connect(transport)on every request with the sameServerinstance, which now throws.Fixed by adding proper protocol management: each initialize request creates a new Server + Transport pair.