mcp: Implement server-side support for discover method (SEP-2575)#987
Open
guglielmo-san wants to merge 42 commits into
Open
mcp: Implement server-side support for discover method (SEP-2575)#987guglielmo-san wants to merge 42 commits into
guglielmo-san wants to merge 42 commits into
Conversation
…lidation and accessors
…est rejections and update associated tests
…ed regression tests
…t stateless protocol to stateless HTTP servers
…n the new protocol session
…t initialization and version negotiation
…protocol version checking in server and tests
… protocol version validation logic
…ata into requests
…/SEP-2575_Stateless_MCP_part2
… test metadata injection logic
…y in server request handling
…per for InitializeParams
…ready initialized
…rt headers and conditional SSE stream initialization
…ization, and correct session metadata mapping
…k triggers in MCP client
…acks and clarify KeepAlive constraints
…version propagation in client and transport layers
…discover implementation
…/SEP-2575_Stateless_MCP_part2
Resolved conflicts with these strategies: - Took main's version for SEP-2575 client-side bits already merged via PR #975 (the cleaner, reviewed version supersedes the part2/part3 in-progress code). - Kept part3-unique additions: * Real server-side server/discover handler (replaces main's stub). * UnsupportedProtocolVersionData type per SEP-2575. * Server allows server/discover on stateful HTTP transport (stateless-only rejection exempts methodDiscover). * Rejection of methodSubscribe/methodUnsubscribe in the new protocol. * TestStreamableStateful_AcceptsDiscover regression test. - Removed duplicate injectMeta in shared.go (main moved injection to per-method injectRequestMeta in client.go; the centralized helper was redundant). - Removed duplicate Server.discover stub left behind by the merge. Known failures (pre-existing test expectations, not regressions from the merge): - TestMiddleware, ExampleLoggingTransport: written assuming Connect always triggers server/discover, but main's logic requires explicit opt-in via ClientSessionOptions{protocolVersion: protocolVersion20260630}. - TestStreamableClientUnsupportedVersionFallback: requires a "Bad Request" substring fallback that part3 had but main removed. The structural fix is to parse the JSON-RPC error body in checkResponse and match by error.code.
…ing errors.Is for wrapped errors
…over and add end-to-end smoke tests
…or client and server tests
…N-RPC error responses.
…ate documentation for methodDiscover initialization logic
…rror handling, and enable stateless HTTP conformance server
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
Part 3 of the SEP-2575 ("Make MCP Stateless") implementation. Builds on PR #975 which landed the client-side discover/fallback flow and the per-request
_metaplumbing. This PR adds the server-side counterparts:server/discoverhandler (replaces the stub),ProtocolVersionSupporter`ServerSession.handle,internal/jsonrpc2,processResultwith anMCPGODEBUGopt-out for backward compatibility.