Add prior-knowledge connection path for modern protocol clients
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- csharp
調査の方向性
まず McpClientOptions.cs、McpClientImpl.cs、DiscoverResult.cs を読み、現在の modern discovery、exact-version、legacy fallback の動作を追跡します。次に、参照されている TypeScript と Python の prior-knowledge パスを比較し、default auto-negotiation、exact modern pinning、cached prior discovery、invalid または incompatible な prior discovery のテストを追加します。信頼できる modern connection が server/discover をスキップし、既存の動作とリクエストごとのメタデータが引き続き正しい状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Add a C# client API for 2026-07-28+ connections that lets callers skip the server/discover round trip when they already have trusted prior knowledge about the server. This should be distinct from McpClientOptions.ProtocolVersion, so exact version pinning can continue to mean "require this version / disable fallback" rather than "skip discovery."
Motivation
Today, setting McpClientOptions.ProtocolVersion = "2026-07-28" disables legacy fallback, but the client still sends server/discover before adopting the modern protocol. That is safe, but it leaves no zero-round-trip path for known modern servers or for clients that have cached a previous DiscoverResult.
A separate prior-knowledge API would improve startup latency and align C# with the stronger ergonomics in the other Tier 1 SDKs while preserving C#'s current safe defaults.
Current C# behavior
ProtocolVersion = null: default modern auto path; sendsserver/discoverand falls back to legacyinitializewhen appropriate.ProtocolVersion = "2026-07-28": sendsserver/discoverand requires a modern result; does not fall back to legacy.- Legacy exact versions such as
"2025-11-25": skipserver/discoverand use legacyinitialize. - No public API was found for providing a cached
DiscoverResultor directly adopting a known modern protocol version.
Relevant C# files:
src/ModelContextProtocol.Core/Client/McpClientOptions.cssrc/ModelContextProtocol.Core/Client/McpClientImpl.cssrc/ModelContextProtocol.Core/Protocol/DiscoverResult.cs
Tier 1 SDK references
TypeScript SDK
TypeScript exposes the strongest explicit prior-knowledge shape:
ConnectOptions.prior?: DiscoverResultlets callers provide a previously obtained discovery result._connectFromPrior(...)bypasses version negotiation andserver/discover, adopts capabilities/server info/instructions, and sets the negotiated protocol version.getDiscoverResult()returns a reusableDiscoverResult.
References:
- https://github.com/modelcontextprotocol/typescript-sdk/blob/main/packages/client/src/client/client.ts
- Look for
ConnectOptions.prior,_connectFromPrior, andgetDiscoverResult.
Python SDK
Python supports both an explicit cached-discovery path and a simple direct-modern mode:
Client(mode="auto")probes withserver/discoverand falls back.Client(mode="2026-07-28")adopts the modern protocol directly without sendingserver/discover.prior_discovercan provide a cachedDiscoverResult.ClientSession.adopt()installs anInitializeResultorDiscoverResultwithout wire traffic.ClientSession.discover_resultexposes the round-trippable discovery result for reuse.
References:
- https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/client.py
- https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/session.py
- Look for
ConnectMode,prior_discover,adopt, anddiscover_result.
Go SDK
Go has solid 2026-07-28 plumbing but does not appear to expose a public prior-knowledge client API:
Client.Connectdefaults to latest2026-07-28, sendsserver/discover, negotiates, and falls back to legacyinitializewhen needed.ClientSessionOptions.protocolVersionis unexported and documented as a testing override.- Server
discoveradvertises transport-filtered supported versions. - Go also implements modern per-request
_meta, standard HTTP headers,subscriptions/listen, multi-round-trip helpers, and TTL caches for modern list/read results.
References:
- https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/client.go
- https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/server.go
- https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/cache.go
- https://github.com/modelcontextprotocol/go-sdk/blob/main/docs/protocol.md
Proposed C# API direction
Add a distinct opt-in prior-knowledge path, for example:
McpClientOptions.KnownDiscoverResultorMcpClientOptions.PriorDiscoverResult: adopt a trusted discovery result and skipserver/discover.- Optionally, a direct-modern option such as
AssumeProtocolVersion = "2026-07-28"for callers that only know the protocol version but do not have server info/capabilities yet. - Keep
ProtocolVersionsemantics unchanged: exact modern version should still probe and require a compatible result unless the new prior-knowledge option is used.
Acceptance criteria
- A caller can connect to a known 2026-07-28+ server without sending
server/discover. - A caller can retrieve or construct the prior-knowledge payload needed for a later zero-round-trip connection.
- Existing default auto-negotiation and exact
ProtocolVersionbehavior remain backward compatible. - Per-request
_metaand HTTP headers continue to be populated correctly after prior-knowledge adoption. - Tests cover default auto, exact modern pin, cached prior discovery, and invalid/incompatible prior discovery.
- 主要言語
- C#
- スター
- 4.5k
- フォーク
- 814
- 平均マージ
- 9日 19時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/csharp-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modelcontextprotocol/csharp-sdk#1840 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
modelcontextprotocol/csharp-sdk#678 · コメント 1 件 ·
-
enhancement needs confirmation P3 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/csharp-sdk#515 · コメント 6 件 · リアクション 3 件 ·
modelcontextprotocol/csharp-sdk の issue をすべて見る
似ている issue
-
untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
type/automation type/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
newrelic/newrelic-dotnet-agent#3850 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
LuckyPennySoftware/AutoMapper#4660 ·