Skip to content

Conversation

@felixweinberger
Copy link
Collaborator

Adds conformance tests for SEP-1699 which introduces SSE polling via server-side disconnect.

Summary

  • Client test: validates retry field timing respect (MUST requirement)
  • Client test: validates Last-Event-ID sent on reconnection (SHOULD requirement)
  • Server test: validates priming event with id and empty data (SHOULD requirement)
  • Server test: validates retry field sent before disconnect (SHOULD requirement)
  • Fixed timing validation to only track GET requests (not POST)
  • Added "very late" threshold (>2x retry) as FAILURE vs "slightly late" as WARNING

Motivation and Context

SEP-1699 introduces SSE polling behavior. These conformance tests ensure SDK implementations correctly handle retry field timing, priming events, and graceful disconnection.

How Has This Been Tested?

  • All conformance checks pass against TypeScript SDK implementation
  • Verified timing tolerances work correctly (2000ms retry, ~50ms early tolerance, ~200ms late tolerance)

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 Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Adds conformance tests for SEP-1699 (SSE Polling via Server-Side
Disconnect) which allows servers to close connections while maintaining
SSE streams for long-polling behavior.

New scenarios:
- server-sse-polling: Tests server sends priming event (id + empty data)
  and retry field before closing connection (SHOULD requirements)
- sse-retry: Tests client respects SSE retry field timing when
  reconnecting (MUST requirement)

These tests will initially fail for TypeScript SDK as it doesn't
currently respect the retry field from SSE events.
The test was incorrectly measuring timing between all requests (POST and GET),
but the retry field only applies to GET SSE stream reconnections.

Changes:
- Only track timestamps and Last-Event-ID for GET requests
- Return 202 Accepted for notifications to trigger client GET stream
- Add eventsource-parser dependency
Enhance timing validation and event ordering checks:

Client test (sse-retry):
- Add "very late" threshold (>2x retry value) as FAILURE
- Distinguish between slightly late (WARNING) and very late (FAILURE)

Server test (sse-polling):
- Check that priming event is sent immediately (first event)
- Warn if server disconnects without sending event ID first
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/conformance/@modelcontextprotocol/conformance@35

commit: bc7c649

The eventsource-parser library delivers retry through onRetry callback,
not as a property on EventSourceMessage objects.
Copy link
Contributor

@paoloricciuti paoloricciuti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a draft but I tested it locally and I had some comments

Server may return 400 when GET request is missing session context
(mcp-session-id header). Treat as INFO similar to 405.
- Rewrite server tests to validate priming events on POST SSE streams
- Update client tests for POST→GET reconnection flow with retry timing
- Add eventStore and retryInterval to example server
- All 3 server conformance checks now pass
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.

4 participants