Repository navigation
Align Streamable HTTP transport with the 2025-06-18/2025-11-25 spec - #34
Merged
dbernheisel merged 1 commit intoOct 5, 2026
Merged
Conversation
For the protocol versions before 2026-07-28: - Add `validate_session: true` to answer 404 to session ids the server did not issue or that were terminated. Off by default, since apps that persist sessions answer 404 from connect/2. - Reject an unsupported MCP-Protocol-Version header with 400. - Open GET SSE streams with 200 instead of 202. - Answer 406 to a GET whose Accept header excludes text/event-stream. - Accept a client's JSON-RPC error response with 202 and fail the waiting elicitation with :error (HTTP and stdio). - Answer 400 to an invalid JSON-RPC response instead of 202. - Allow DELETE in CORS allow-methods. - Stop using JSON-RPC ids as SSE event ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satoren
force-pushed
the
fix/streamable-http-compliance
branch
from
October 5, 2026 00:36
f9d3fc3 to
81ee0a3
Compare
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.
Summary
Rebased onto 0.6.0. Fixes places where
Phantom.Plugdeviates from the Streamable HTTP transport for the protocol versions before 2026-07-28. 2026-07-28 requests keep their own validation and are not affected.Phantom.Plugoptionvalidate_session: true: answer404to amcp-session-idthe server did not issue in aninitializeresponse, or that was terminated withDELETEMCP-Protocol-Versionheader with400. The error lists thesupportedandrequestedversions.200instead of202when a GET opens an SSE stream406to a GET whoseAcceptexcludestext/event-stream. A missingAccept,text/*, or*/*is still allowed.text/event-streaminAccept.elicitation/create) with202; the waitingSession.elicit/3returns:error. Also over stdio.-32600and the elicitation waited until it timed out.400to an invalid JSON-RPC response instead of202DELETEtoaccess-control-allow-methodsid:fieldWhy
validate_sessionis opt-inPhantom only records sessions in memory (
Phantom.SessionMeta), so a restart forgets them. The test app'sTest.SessionStoreshows apps persisting sessions and answering{:not_found, _}fromconnect/2; checking by default would break that. With the option on:initializeand requests without a session id are not checked.SessionMetatable (an escript), sessions are not checked.Behavior changes
These used to succeed and now return errors (conforming clients are not affected):
MCP-Protocol-Versionapplication/jsonNot addressed here
mcp-session-idon a non-initializerequest is still accepted (the spec's 400 is a SHOULD for servers that require sessions).initialize,logging/setLevelvalidation,listChanged, and tool input validation errors are outside the transport and left for separate PRs.Testing
test/phantom/plug_test.exs,test/phantom/sse_headers_test.exs, andtest/phantom/stdio_test.exs, written first and confirmed failing before the fix. The GET status and SSE body are checked over a real HTTP connection.mix test: 495 passed.mix test --only conformance: 10 passed (2025-11-25 and 2026-07-28, single and distributed).mix format --check-formattedandmix compile --warnings-as-errorsare clean.🤖 Generated with Claude Code