Static resources whose URIs differ only in the fragment or user info collapse into one
メンテナーはふだん 1 日以内に返信
@halter73 がすでに取り組んでいます。
2026年11月11日 から。
評価
調査の方向性
UriTemplateComparer を UriTemplate.cs の 502-519 行付近と既存の host-case テストから始めてください。提案された変更は fragment と user-info の比較を追加します。次に McpServerOptionsSetup.cs:63 の resource 登録パスと、AIFunctionMcpServerResource.cs:325 および McpClient.Methods.cs:832 での comparer の下流での使用を確認してください。McpServerResourceTests に、fragment だけが異なる 2 つのリソースと 2 つ目の読み取りを使った回帰テストを追加してください。両方が一覧に表示され、各読み取りがそれぞれ自身の body を返したら完了です。
索引モデルが issue の本文から書いたものです。
説明
Two static resources whose URIs differ only in the fragment collapse into one. WithResources silently drops the second, and reading it returns the first.
Repro at 5221939, in-process over two Pipes:
services.AddMcpServer().WithResources([
McpServerResource.Create(() => "intro text", new() { UriTemplate = "docs://guide#intro", Name = "intro" }),
McpServerResource.Create(() => "setup text", new() { UriTemplate = "docs://guide#setup", Name = "setup" }),
]);
// ...McpServer.Create over StreamServerTransport, McpClient.CreateAsync over StreamClientTransport
foreach (var r in await client.ListResourcesAsync()) Console.WriteLine($"listed: {r.Uri}");
var read = await client.ReadResourceAsync("docs://guide#setup");
$ dotnet run -c Release # net10.0, SDK 10.0.403, ProjectReference to src/ModelContextProtocol at 5221939
listed: docs://guide#intro
read docs://guide#setup -> intro text
Expected: both listed, and the read returns setup text. A server exposing one resource per heading anchor loses every section after the first, with no error. The spec says each resource "is uniquely identified by a URI" (server/resources), and RFC 3986 section 3 puts the fragment in it. Section 3.5 strips it for dereference, not for two entries a server registered.
UriTemplateComparer (UriTemplate.cs:502) says it uses "regular System.Uri equality comparison (host name is case insensitive)", and its tests cover host case only. Uri.Equals also ignores UserInfo and Fragment, so docs://alice@host/x and docs://bob@host/x collide too. McpServerOptionsSetup.cs:63 uses TryAdd, so nothing throws.
I'd keep System.Uri and add && uri1.UserInfo == uri2.UserInfo && uri1.Fragment == uri2.Fragment at line 519:
$ dotnet run -c Release # same app, with that change at UriTemplate.cs:519
listed: docs://guide#intro
listed: docs://guide#setup
read docs://guide#setup -> setup text
# not run: test suite with the change
The comparer also backs IsMatch (AIFunctionMcpServerResource.cs:325) and the SubscribeToResourceAsync filter (McpClient.Methods.cs:832), so a read or update for docs://guide#x would stop matching a static docs://guide. That fits the spec but changes behavior for clients sending fragments today. Shall I open that pull request with a test in McpServerResourceTests?
- 主要言語
- C#
- スター
- 4.6k
- フォーク
- 849
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 24
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/csharp-sdk のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modelcontextprotocol/csharp-sdk#2031 ·
メンテナーはふだん 1 日以内に返信
-
POST /mcp with a missing or unparseable Content-Type returns HTTP 500 instead of a 4xx対応中かも @halter73 が 9 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/csharp-sdk#1966 · コメント 5 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Reserved URI-template expansion throws for supplementary Unicode characters対応中かも @tarekgh が 2 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/csharp-sdk#1913 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
ClaimsPrincipal parameter injection sample request対応中かも @utsavjain2809 が 48 日前に担当しました。 オープンhelp wanted P3
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/csharp-sdk#1899 ·
メンテナーはふだん 1 日以内に返信
-
Document ClientOAuthOptions.ScopeSelector usage対応中かも @z0rimo が 71 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/csharp-sdk#1867 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/csharp-sdk の issue をすべて見る
似ている issue
-
account bug effort:S P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nightscout/nocturne#3745 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jsboige/CoursIA#27768 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
martin-stromberg/FinanceManager#562 ·
メンテナーはふだん 1 日以内に返信
-
:eyeglasses: status: needs review needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
gitextensions/gitextensions#13469 ·
メンテナーはふだん 2 日以内に返信