Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add prior-knowledge connection path for modern protocol clients

オープン
#1,696 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 の本文から書いたものです。

説明

enhancement needs confirmation P2

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; sends server/discover and falls back to legacy initialize when appropriate.
  • ProtocolVersion = "2026-07-28": sends server/discover and requires a modern result; does not fall back to legacy.
  • Legacy exact versions such as "2025-11-25": skip server/discover and use legacy initialize.
  • No public API was found for providing a cached DiscoverResult or directly adopting a known modern protocol version.

Relevant C# files:

  • src/ModelContextProtocol.Core/Client/McpClientOptions.cs
  • src/ModelContextProtocol.Core/Client/McpClientImpl.cs
  • src/ModelContextProtocol.Core/Protocol/DiscoverResult.cs

Tier 1 SDK references

TypeScript SDK

TypeScript exposes the strongest explicit prior-knowledge shape:

  • ConnectOptions.prior?: DiscoverResult lets callers provide a previously obtained discovery result.
  • _connectFromPrior(...) bypasses version negotiation and server/discover, adopts capabilities/server info/instructions, and sets the negotiated protocol version.
  • getDiscoverResult() returns a reusable DiscoverResult.

References:

Python SDK

Python supports both an explicit cached-discovery path and a simple direct-modern mode:

  • Client(mode="auto") probes with server/discover and falls back.
  • Client(mode="2026-07-28") adopts the modern protocol directly without sending server/discover.
  • prior_discover can provide a cached DiscoverResult.
  • ClientSession.adopt() installs an InitializeResult or DiscoverResult without wire traffic.
  • ClientSession.discover_result exposes the round-trippable discovery result for reuse.

References:

Go SDK

Go has solid 2026-07-28 plumbing but does not appear to expose a public prior-knowledge client API:

  • Client.Connect defaults to latest 2026-07-28, sends server/discover, negotiates, and falls back to legacy initialize when needed.
  • ClientSessionOptions.protocolVersion is unexported and documented as a testing override.
  • Server discover advertises 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:

Proposed C# API direction

Add a distinct opt-in prior-knowledge path, for example:

  • McpClientOptions.KnownDiscoverResult or McpClientOptions.PriorDiscoverResult: adopt a trusted discovery result and skip server/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 ProtocolVersion semantics 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 ProtocolVersion behavior remain backward compatible.
  • Per-request _meta and 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/csharp-sdk のほかの issue

modelcontextprotocol/csharp-sdk の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。