Skip to content

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

Open
Yusufihsangorgel wants to merge 1 commit 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 1 commit into
modelcontextprotocol:mainfrom
Yusufihsangorgel:feat/sep-2575-core-types

Conversation

@Yusufihsangorgel

Copy link
Copy Markdown

Summary

Part of #815.

Adds the core wire surface needed before request-scoped runtime behavior can be implemented:

  • typed, experimental accessors for the 2026 request metadata while preserving unknown extensions and the legacy request shape;
  • server/discover, its required cache fields, and unsupported-version error data; and
  • polymorphic request/result decoding with exact wire-format and malformed-input coverage.

Motivation and Context

SEP-2575 moves protocol and client context onto individual requests. The SDK needs a dual-era representation before admission and dispatch can enforce the modern contract without breaking legacy requests.

This PR deliberately stops at the schema/codec boundary. It does not add server dispatch, modern request admission, Streamable HTTP, authentication, subscriptions, MRTR, or the general cache contract.

How Has This Been Tested?

  • JVM: 590 tests
  • JS and WasmJS: 521 tests per target on Node and Chrome
  • iOS Simulator arm64 and macOS arm64: 521 tests per target
  • API check and configured KMP API compilation
  • ktlint and detekt

A full :kotlin-sdk-core:build was also attempted. It stops locally at tvosSimulatorArm64Test because the Kotlin/Xcode environment cannot run that simulator target. The same task fails with the same device-property error on an exact clean main worktree.

Breaking Changes

This adds DiscoverRequest as a new ClientRequest subtype. Consumers recompiling exhaustive when expressions over ClientRequest may need to handle it. Existing request wire shapes and runtime behavior 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

The discovery defaults are always encoded because the draft schema requires them even when a caller uses a Json instance with defaults disabled. New API is marked experimental while the 2026-07-28 specification remains a draft.

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