modelcontextprotocol / modelcontextprotocol/typescript-sdk
InMemoryEventStore: standalone-stream resume broken by getStreamIdFromEventId split
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
InMemoryEventStore.getStreamIdFromEventId derives the stream id with eventId.split('_')[0], which returns the empty string for any event id belonging to the standalone GET stream (its stream id _GET_stream starts with an underscore, so generated ids look like _GET_stream_<uuid>).
As a result, resuming the standalone stream with a Last-Event-ID never works with the shipped example store: replayEventsAfter replays nothing and returns '', and the transport registers the successor stream under the key '' instead of _GET_stream. All stored and future standalone notifications are then silently dropped while the client sits on a healthy-looking keep-alive'd stream.
Pre-existing (the id format and the split predate the keep-alive work). Fix is to derive the stream id from the last separator instead of the first, or to keep an explicit eventId-to-streamId map in the store. Affects the example store on both main and v1.x; regression tests built on this store also exercise the wrong key.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating InMemoryEventStore and its getStreamIdFromEventId and replayEventsAfter methods. Run the regression tests built on this example store, then verify that resuming the standalone GET stream replays stored events, registers the successor under _GET_stream, and delivers future notifications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100