Skip to content

mcp: export Server.Discover for host introspection - #1129

Open
arimu1 wants to merge 1 commit into
modelcontextprotocol:mainfrom
arimu1:feat/1092-server-discover
Open

mcp: export Server.Discover for host introspection#1129
arimu1 wants to merge 1 commit into
modelcontextprotocol:mainfrom
arimu1:feat/1092-server-discover

Conversation

@arimu1

@arimu1 arimu1 commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Fixes #1092.

server/discover was 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/instructions
  • ss != nil → that session’s transport-filtered SupportedVersions
  • Does not mutate session identity (unlike the inbound RPC path)
  • Inbound server/discover still establishes session identity via the internal handler, which now builds its payload through Discover
  • Customization of inbound discover remains via Server.AddReceivingMiddleware (per maintainer guidance on the issue; no DiscoverHandler option)

Related but distinct from open #947 (SupportedVersions on ServerOptions) — 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 mutation
  • go test ./... green
  • Existing discover client/E2E tests still pass (TestInMemory_E2E_DiscoverSuccess, TestClientConnectDiscover)

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
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.

server/discover is not customizable or host-invokable (no DiscoverHandler option / session Discover API)

1 participant