Skip to content

fix: accept namespaced discovery server information#1044

Draft
tsarlandie-oai wants to merge 1 commit into
modelcontextprotocol:mainfrom
tsarlandie-oai:codex/rmcp-1039-discovery-server-info
Draft

fix: accept namespaced discovery server information#1044
tsarlandie-oai wants to merge 1 commit into
modelcontextprotocol:mainfrom
tsarlandie-oai:codex/rmcp-1039-discovery-server-info

Conversation

@tsarlandie-oai

@tsarlandie-oai tsarlandie-oai commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • move discovery server identity to the canonical _meta["io.modelcontextprotocol/serverInfo"] key
  • treat server identity as optional, display-only data and expose an anonymous-result constructor
  • accept legacy top-level serverInfo during deserialization, then normalize it to canonical metadata
  • prefer the canonical metadata key when both representations are present
  • preserve malformed identity metadata without rejecting an otherwise valid discovery response
  • represent client peer information with ServerPeerInfo, where server_info is optional across discovery and legacy initialization

Why

The discovery schema carries server implementation identity as optional result metadata. Requiring a top-level serverInfo made conforming anonymous responses fail and made the client peer-info type unable to represent discovery accurately.

The compatibility decoder keeps accepting the earlier top-level shape, while serialization now emits only the canonical metadata representation.

Compatibility

This changes RoleClient::PeerInfo from ServerInfo to ServerPeerInfo. Legacy initialization converts losslessly and always supplies Some(server_info); discovery clients must handle an absent identity.

Validation

  • discovery and lifecycle integration suites: 18 tests passed
  • canonical, legacy, precedence, malformed, and anonymous identity cases covered
  • cargo +1.95.0 clippy -p rmcp --all-features --all-targets -- -D warnings
  • formatting and whitespace checks passed

Fixes #1039

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes labels Jul 24, 2026
@tsarlandie-oai
tsarlandie-oai force-pushed the codex/rmcp-1039-discovery-server-info branch from 2ef853e to a08dd9a Compare July 25, 2026 00:47
@github-actions github-actions Bot added T-examples Example code changes T-model Model/data structure changes T-service Service layer changes labels Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-examples Example code changes T-model Model/data structure changes T-service Service layer changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DiscoverResult rejects valid discovery responses with server identity in _meta

1 participant