Skip to content

Add prior discovery client connections#1697

Open
halter73 wants to merge 2 commits into
mainfrom
halter73-sdk-protocol-support-eval
Open

Add prior discovery client connections#1697
halter73 wants to merge 2 commits into
mainfrom
halter73-sdk-protocol-support-eval

Conversation

@halter73

@halter73 halter73 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add McpClientOptions.PriorDiscoverResult so trusted modern discovery snapshots can skip the server/discover probe.
  • Add McpClient.GetDiscoverResult() for reusable discovery snapshots, including cache hints.
  • Validate prior discovery compatibility, preserve pinned-version semantics, and keep 2026-07-28 request metadata emission intact.
  • Document the prior-knowledge reconnect path.

Closes #1696

Copilot AI left a comment

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.

Pull request overview

Adds an opt-in “prior knowledge” connection path for modern (2026-07-28+) MCP clients, allowing callers to skip the server/discover probe when they already have a trusted discovery snapshot, while preserving existing protocol pinning and fallback semantics.

Changes:

  • Introduces McpClientOptions.PriorDiscoverResult to adopt a trusted DiscoverResult and bypass server/discover.
  • Adds McpClient.GetDiscoverResult() (and an override in McpClientImpl) to provide reusable discovery snapshots including cache hints.
  • Updates stateless protocol documentation and adds tests for the new connection + required _meta emission behavior.
Show a summary per file
File Description
tests/ModelContextProtocol.Tests/Client/July2026ProtocolListMetaEmissionTests.cs Adds coverage to ensure required _meta is emitted when connecting via prior discovery.
tests/ModelContextProtocol.Tests/Client/July2026ProtocolConnectionTests.cs Adds prior-discovery connection tests (skip discover, pin semantics, invalid prior cases, snapshot cloning).
src/ModelContextProtocol.Core/Client/McpClientOptions.cs Adds PriorDiscoverResult option with XML docs describing behavior and constraints.
src/ModelContextProtocol.Core/Client/McpClientImpl.cs Implements adopting prior discovery, cloning/storing discover results, and overriding GetDiscoverResult().
src/ModelContextProtocol.Core/Client/McpClient.cs Adds public virtual GetDiscoverResult() API and documentation.
docs/concepts/stateless/stateless.md Documents the prior-knowledge reconnect path and example usage.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/ModelContextProtocol.Core/Client/McpClient.cs Outdated
halter73 and others added 2 commits July 14, 2026 09:12
Adds an opt-in PriorDiscoverResult client option for trusted modern discovery snapshots, exposes McpClient.GetDiscoverResult(), and reuses the discovery adoption path so clients can skip server/discover when reconnecting with prior knowledge.

Adds tests for zero-probe prior discovery, pinned-version validation, invalid legacy combinations, reusable snapshots, and 2026-07-28 per-request metadata emission.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@halter73 halter73 force-pushed the halter73-sdk-protocol-support-eval branch from 5a85e15 to ec7d0d5 Compare July 14, 2026 16:52
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.

Add prior-knowledge connection path for modern protocol clients

3 participants