Skip to content

Conversation

@felixweinberger
Copy link
Collaborator

@felixweinberger felixweinberger commented Nov 20, 2025

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

Summary

  • Client test (sse-retry): validates retry field timing (MUST), Last-Event-ID on reconnection (SHOULD)
  • Server test (server-sse-polling): validates priming event with id and empty data, retry field
  • Server test (server-sse-multiple-streams): validates multiple concurrent POST SSE streams

Changes since previous PR

  • Fixed server-sse-multiple-streams to test POST-initiated concurrent streams (not standalone GET)
  • The standalone GET stream is limited to 1 per session by design
  • Multiple concurrent streams are achieved via POST requests, each getting unique streamId

How Has This Been Tested?

  • All SEP-1699 conformance checks pass against TypeScript SDK implementation (via npm link)
  • Note: Requires TS SDK PR #1129 to be merged for CI to pass

Tested with modelcontextprotocol/typescript-sdk#1129

CleanShot 2025-11-21 at 18 08 14

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally (with linked SDK)
  • I have added appropriate error handling

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
The eventsource-parser library delivers retry through onRetry callback,
not as a property on EventSourceMessage objects.
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
New scenario tests that servers properly support multiple concurrent
GET SSE streams per SEP-1699 spec requirement.
The multiple-streams test was incorrectly testing standalone GET streams,
which are limited to one per session by SDK design. The spec's "multiple
concurrent streams" refers to POST-initiated SSE streams, where each POST
request gets its own unique streamId.

Changes:
- Rewrite server-sse-multiple-streams to use concurrent POST requests
- Each POST request may return SSE or JSON (both valid per spec)
- Update test expectations to allow INFO status for JSON responses
- Add documentation clarifying standalone GET vs POST stream behavior
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 20, 2025

Open in StackBlitz

npx https://pkg.pr.new/modelcontextprotocol/conformance/@modelcontextprotocol/conformance@47

commit: 085b9e0

@felixweinberger felixweinberger marked this pull request as ready for review November 21, 2025 18:08
@pcarleton pcarleton force-pushed the fweinberger/sep-1699-test branch from 4303ddf to e6898e7 Compare November 24, 2025 18:25
pcarleton and others added 2 commits November 24, 2025 18:27
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@felixweinberger felixweinberger enabled auto-merge (squash) November 24, 2025 18:34
@felixweinberger felixweinberger merged commit f0e9481 into main Nov 24, 2025
7 checks passed
@felixweinberger felixweinberger deleted the fweinberger/sep-1699-test branch November 24, 2025 18:34
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.

3 participants