When Absolute Uri passed as McpAuthenticationOptions.ResourceMetadataUri, /.well-known/oauth-protected-resource endpoint returns 404

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp

調査の方向性

samples\ProtectedMCPServer\Program.cs から始め、AddMcp で構成された絶対 ResourceMetadataUri を使用してリクエストを再現します。次に、リソースメタデータエンドポイントの照合ロジックと、issue で参照されている単体テストを見つけます。絶対 URI が有効な場合に 404 を返すのではなく /.well-known/oauth-protected-resource エンドポイントで処理され、関連するテストが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

area-auth bug help wanted needs confirmation P3

Describe the bug

When Absolute Uri passed as McpAuthenticationOptions.ResourceMetadataUri, /.well-known/oauth-protected-resource endpoint returns 404.

The logic for matching resource metadata endpoint is only limited to relative path, when an absolute path is passed in, the match fails and allows the resource metadata request to fall through the pipeline.

To Reproduce

  1. Provide an absolute Uri as as McpAuthenticationOptions.ResourceMetadataUri when configuring AddMcp
  2. Start the server
  3. Hit the resource metadata endpoint

Reproduced in sample server, added

AddMcp(options =>
{
  // ... resource metadata object
  options.ResourceMetadataUri = new Uri($"{serverUrl}.well-known/oauth-protected-resource", UriKind.Absolute);
}

in samples\ProtectedMCPServer\Program.cs

Expected behavior
Resource metadata request should be handled when provided a valid ResourceMetadataUri

Unit tests failure when configure the absolute uri

Image
主要言語
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 を短くまとめたダイジェスト。