Skip to content

fix(everything): replay streamable HTTP events by stream#4099

Open
cyphercodes wants to merge 1 commit intomodelcontextprotocol:mainfrom
cyphercodes:fix/everything-streamable-event-store
Open

fix(everything): replay streamable HTTP events by stream#4099
cyphercodes wants to merge 1 commit intomodelcontextprotocol:mainfrom
cyphercodes:fix/everything-streamable-event-store

Conversation

@cyphercodes
Copy link
Copy Markdown

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 undefined without replaying unrelated events.

Fixes #4087

Publishing Your Server

Not applicable.

Server Details

  • Server: everything
  • Changes to: Streamable HTTP transport resumability / event store

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-everything
  • npm test --workspace @modelcontextprotocol/server-everything -- --run
  • npx prettier --check src/everything/__tests__/inMemoryEventStore.test.ts src/everything/transports/inMemoryEventStore.ts src/everything/transports/streamableHttp.ts
  • git diff --check HEAD~1..HEAD

I did not test this manually with an LLM client.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

The event store is split into its own module so its replay behavior can be tested without starting the HTTP server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with streamable http everying example:

1 participant