fix(everything): replay streamable HTTP events by stream#4099
Open
cyphercodes wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
fix(everything): replay streamable HTTP events by stream#4099cyphercodes wants to merge 1 commit intomodelcontextprotocol:mainfrom
cyphercodes wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
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
Fixes the Everything server Streamable HTTP example's in-memory event store so resumable SSE replay uses the stream associated with the last event ID and only replays later events from that same stream. Unknown event IDs now return
undefinedwithout replaying unrelated events.Fixes #4087
Publishing Your Server
Not applicable.
Server Details
Motivation and Context
The previous example returned the last event ID where the SDK expects a stream ID for replay mapping, and replayed every later event regardless of stream. This could send events from unrelated streams when a client resumed from
Last-Event-ID.How Has This Been Tested?
npm run build --workspace @modelcontextprotocol/server-everythingnpm test --workspace @modelcontextprotocol/server-everything -- --runnpx prettier --check src/everything/__tests__/inMemoryEventStore.test.ts src/everything/transports/inMemoryEventStore.ts src/everything/transports/streamableHttp.tsgit diff --check HEAD~1..HEADI did not test this manually with an LLM client.
Breaking Changes
None.
Types of changes
Checklist
Additional context
The event store is split into its own module so its replay behavior can be tested without starting the HTTP server.