Skip to content

fix: accept namespaced discovery server information - #1044

Merged
DaleSeo merged 2 commits into
modelcontextprotocol:mainfrom
tsarlandie-oai:codex/rmcp-1039-discovery-server-info
Jul 27, 2026
Merged

fix: accept namespaced discovery server information#1044
DaleSeo merged 2 commits 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
Contributor

Summary

  • accept discovery server identity from either top-level serverInfo or _meta["io.modelcontextprotocol/serverInfo"]
  • preserve unrelated result metadata
  • prefer top-level serverInfo when both representations are present
  • retain the existing public DiscoverResult.server_info field and top-level serialization shape
  • reject responses where neither representation supplies a valid server identity

Why

Discovery result deserialization only recognized server identity at the top level. Servers that place identity in the namespaced metadata field could therefore fail to deserialize as a discovery result.

The compatibility decoder accepts both representations without changing the existing Rust public API, generated schema, or server wire output.

Validation

  • generated server-message schema: 3 tests passed
  • discovery model suite: 8 tests passed
  • lifecycle and discovery client suites: 9 tests passed
  • draft server-stateless conformance scenario: 30/30 checks passed
  • 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
alexhancock
alexhancock previously approved these changes Jul 27, 2026
@alexhancock
alexhancock marked this pull request as ready for review July 27, 2026 14:34
@alexhancock
alexhancock requested a review from a team as a code owner July 27, 2026 14:34
@github-actions github-actions Bot removed T-examples Example code changes T-model Model/data structure changes T-service Service layer changes labels Jul 27, 2026
@DaleSeo
DaleSeo merged commit 2047ae4 into modelcontextprotocol:main Jul 27, 2026
22 checks passed
}

#[test]
fn discover_result_serializes_top_level_server_info() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? looking at the latest spec https://modelcontextprotocol.io/specification/draft/schema#discoverresult this is not even a field in the type anymore after a late spec change modelcontextprotocol/modelcontextprotocol#3002.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this. Thanks for connecting the dots.

howardjohn added a commit to howardjohn/rust-sdk that referenced this pull request Jul 27, 2026
howardjohn added a commit to howardjohn/rust-sdk that referenced this pull request Jul 28, 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-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

4 participants