Skip to content

feat(core): add SEP-2575 request metadata and discovery types#893

Open
Yusufihsangorgel wants to merge 2 commits into
modelcontextprotocol:mainfrom
Yusufihsangorgel:feat/sep-2575-core-types
Open

feat(core): add SEP-2575 request metadata and discovery types#893
Yusufihsangorgel wants to merge 2 commits into
modelcontextprotocol:mainfrom
Yusufihsangorgel:feat/sep-2575-core-types

Conversation

@Yusufihsangorgel

@Yusufihsangorgel Yusufihsangorgel commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Part of #815.

Adds the core types and codecs needed for SEP-2575:

  • experimental accessors for request-scoped metadata while preserving legacy request shapes and unknown _meta entries;
  • server/discover request/result types, cache fields, and unsupported-version error data; and
  • polymorphic request/result decoding with wire-format and malformed-input coverage.

The discovery types match the merged draft schema in modelcontextprotocol/modelcontextprotocol#3002: protocolVersion and clientCapabilities are required, clientInfo is optional, and optional server information remains in result _meta.

Motivation and Context

SEP-2575 moves protocol and client context onto individual requests and introduces server/discover. The shared RequestMeta accessors remain nullable so legacy requests stay representable; DiscoverRequestParams enforces the fields required by the new discovery request.

This PR stops at the core type and codec boundary. It does not add server admission, request-scoped dispatch, Streamable HTTP, authentication, subscriptions, MRTR, lifecycle hooks, or a discovery DSL.

How Has This Been Tested?

  • JVM: 597/597 tests
  • JS Node and Chrome: 528/528 tests per target
  • WasmJS Node and Chrome: 528/528 tests per target
  • iOS Simulator arm64 and macOS arm64: 528/528 tests per target
  • API dump/check, ktlint, detekt, and diff checks

Coverage includes required discovery metadata, optional clientInfo, required cache fields, unknown metadata round-trips, the legacy resultType fallback, unsupported-version data, and polymorphic result classification.

Breaking Changes

This adds DiscoverRequest as a new ClientRequest subtype. Consumers recompiling exhaustive when expressions over ClientRequest may need to add a branch. Existing request types and wire representations are unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

ttlMs and cacheScope have Kotlin construction defaults but remain required when decoding. An absent resultType decodes as "complete" for compatibility with legacy results. Discovery result selection requires the complete required shape so unrelated result extensions are not misclassified.

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.

1 participant