Skip to content

feat: add SEP-2575 discovery and SEP-2322 MRTR models#946

Closed
erenatas wants to merge 1 commit into
modelcontextprotocol:mainfrom
erenatas:erenatas/rmcp-stateless-pr1-models
Closed

feat: add SEP-2575 discovery and SEP-2322 MRTR models#946
erenatas wants to merge 1 commit into
modelcontextprotocol:mainfrom
erenatas:erenatas/rmcp-stateless-pr1-models

Conversation

@erenatas

@erenatas erenatas commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Introduce the first scoped 2026-07-28 stateless MCP protocol surface in
rmcp without changing the default protocol version or existing stateful
flows.

Changes:

  • Add server/discover request and DiscoverResult models for SEP-2575.
  • Wire discover through ServerHandler with a default implementation derived from get_info().
  • Add 2026-07-28 protocol-version awareness while keeping LATEST at 2025-11-25.
  • Add Multi Round-Trip Request models for SEP-2322:
    • ResultType
    • InputRequest
    • InputRequiredResult
    • InputResponse
    • inputResponses/requestState on CallToolRequestParams
  • Allow CallToolResult to carry optional resultType for wire compatibility.
  • Route server/discover through CustomRequest and typed new results through CustomResult to avoid adding variants to public exhaustive enums.
  • Preserve PartialEq on existing task payload params.
  • Document why MRTR still exposes SEP-2577-deprecated sampling variants.
  • Add deserialization and round-trip coverage for discover, inputRequired, typed input responses, and protocol-version behavior.
  • Update schemars snapshots for MRTR request fields and CallToolResult.resultType

Motivation and Context

This adds the first scoped rmcp model-layer support for the MCP 2026-07-28 release candidate stateless protocol work.

The change is tied primarily to:

  • SEP-2575: server/discover as the stateless replacement path for handshake-time capability discovery.
  • SEP-2322: Multi Round-Trip Requests, including inputRequired, inputRequests, inputResponses, and requestState.
  • Partial SEP-2260 alignment: adds the wire/model foundation for stateless server-to-client request flows, without enforcing runtime lifecycle constraints yet.

This is needed so rmcp can begin supporting fully stateless MCP servers while preserving the current 2025-11-25 default behavior.

How Has This Been Tested?

Tested locally in rmcp with:

  • cargo fmt
  • cargo test -p rmcp --test test_deserialization -- --nocapture
  • cargo test -p rmcp
  • git diff --check

Also tested against a real remote MCP server locally by temporarily pointing its workspace rmcp dependency to this local SDK branch.

Breaking Changes

No intentional breaking changes.

Existing 2025 initialization/session flows remain available, and ProtocolVersion::LATEST remains 2025-11-25.

Validation against a server surfaced downstream compatibility concerns from rmcp 2.0 renames, so this PR also adds deprecated aliases for older names:

  • Content
  • PromptMessageContent
  • PromptMessageRole

Users should not need to update code for this PR, but they may see deprecation warnings if they still use those old names.

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

This PR is intentionally scoped to the model/handler foundation for SEP-2575 server/discover and SEP-2322 MRTR. It does not implement stateless HTTP transport mode, Mcp-Method/Mcp-Name validation, OAuth hardening, Tasks, Apps, or cache TTL
behavior.

MRTR includes sampling request/response variants because sampling is deprecated by SEP-2577 but still retained by the protocol lifecycle.

@erenatas erenatas requested a review from a team as a code owner June 30, 2026 21:17
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes T-model Model/data structure changes labels Jun 30, 2026
@erenatas erenatas force-pushed the erenatas/rmcp-stateless-pr1-models branch from ab274c9 to 23b3212 Compare June 30, 2026 21:39
@github-actions github-actions Bot added the T-config Configuration file changes label Jun 30, 2026
Introduce the first scoped 2026-07-28 stateless MCP protocol surface in rmcp.

Existing 2025 stateful flows and the default protocol version remain unchanged.

Changes:

- Add server/discover request and DiscoverResult models for SEP-2575.

- Wire discover through ServerHandler with a default get_info()-based implementation.

- Add 2026-07-28 protocol-version awareness while keeping LATEST at 2025-11-25.

- Add SEP-2322 MRTR models: ResultType, InputRequest, and InputRequiredResult.

- Add InputResponse for typed client-to-server MRTR input responses.

- Add inputResponses and requestState to CallToolRequestParams.

- Route server/discover through CustomRequest to preserve public enum semver.

- Serialize typed new results through CustomResult to preserve public enum semver.

- Allow CallToolResult to carry optional resultType for wire compatibility.

- Register new model types in serde, meta, and schema plumbing.

- Preserve PartialEq on existing task payload params.

- Document why MRTR still exposes SEP-2577-deprecated sampling variants.

- Add deserialization, schema, and round-trip coverage for the new wire shapes.

Signed-off-by: Eren Atas <eren_atas@hotmail.com>
@erenatas erenatas force-pushed the erenatas/rmcp-stateless-pr1-models branch from 23b3212 to 943a367 Compare June 30, 2026 21:41
@erenatas erenatas closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-config Configuration file changes T-core Core library changes T-handler Handler implementation changes T-model Model/data structure changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant