mcp: export Server.Discover for host introspection - #1129
Open
arimu1 wants to merge 1 commit into
Open
Conversation
Expose the SEP-2575 discover payload as Server.Discover so hosts can inspect capabilities/instructions/supportedVersions without synthesizing an inbound request. Inbound server/discover still establishes session identity; customization continues via receiving middleware. Fixes modelcontextprotocol#1092
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
Fixes #1092.
server/discoverwas only reachable as an inbound JSON-RPC method. Hosts that need the same advertisement for health/introspection (or multi-tenant gateways) had to synthesize an HTTP/JSON-RPC request against themselves.This exports
Server.Discover(ss *ServerSession) *DiscoverResult:ss == nil→ full SDK-supported version list + current capabilities/instructionsss != nil→ that session’s transport-filteredSupportedVersionsserver/discoverstill establishes session identity via the internal handler, which now builds its payload throughDiscoverServer.AddReceivingMiddleware(per maintainer guidance on the issue; noDiscoverHandleroption)Related but distinct from open #947 (
SupportedVersionsonServerOptions) — that PR configures which versions are supported; this PR only exposes the host-callable discover result builder.Test plan
go test ./mcp/ -run TestServerDiscover— nil-session defaults, session path, no state mutationgo test ./...greenTestInMemory_E2E_DiscoverSuccess,TestClientConnectDiscover)