[v2] Client accepts a parent-path protected resource metadata, is this intended given RFC 9728?
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #3169 @bbdu3 による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 43/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with packages/core-internal/src/shared/authUtils.ts, especially selectResourceURL and checkResourceAllowed, then compare the current behavior with RFC 9728 §3.3 and the linked issues #638, #2751, and #3041. The issue asks whether parent-path resources should be accepted and whether any change should allow an opt-in for lenient matching; the expected resolution is a maintainer decision on that behavior and its compatibility implications.
索引モデルが issue の本文から書いたものです。
説明
What happened?
Question
Is it intended that the client accepts Protected Resource Metadata (PRM) whose resource is a parent path of the server URL? And if so, how should that be reconciled with RFC 9728 §3.3?
Current behaviour
selectResourceURL validates resourceMetadata.resource with checkResourceAllowed, which accepts any same-origin resource whose path is a prefix of the server URL's path (authUtils.ts). The less specific URL is then returned and sent as the RFC 8707 resource parameter.
Example:
- Server URL:
https://host/mcp/gateway/bundle/my-bundle 401withWWW-Authenticate: Bearer resource_metadata="https://host/mcp/gateway/.well-known/oauth-protected-resource/bundle/my-bundle"- PRM:
{"resource": "https://host/mcp/gateway", ...}
The SDK accepts this and requests a token for https://host/mcp/gateway. VS Code rejects the same metadata (oauth.ts: "Per RFC 9728, these MUST match"), so a server that works with SDK-based clients fails in VS Code.
Why I'm asking
RFC 9728 §3.3:
If the protected resource metadata was retrieved from a URL returned by the protected resource via the WWW-Authenticate resource_metadata parameter, then the resource value returned MUST be identical to the URL that the client used to make the request to the resource server. If these values are not identical, the data contained in the response MUST NOT be used.
§7.3 gives impersonation as the reason for the identical-match rule. The MCP spec adopts RFC 9728 and asks clients to "provide the most specific URI that they can" (2025-11-25, Canonical Server URI).
The prefix matching was introduced in #638. Its description says resource URIs are used as-is "to allow having different MCP servers under different subpaths … w/o spilling their resource authorization to each other". It also warns that a non-specific resource lets a "bad apple" server benefit from resource confusion with its siblings. Accepting a parent-path resource from the PRM seems to allow exactly that: a server at /a/b can get the client to request a token for /a. I couldn't find a rationale for the prefix rule in the PR or its review.
#2751 already notes in passing that this leniency hides non-compliant server setups.
#3041 covers the trailing-slash asymmetry in the same function. Neither asks whether the prefix rule itself is intended.
Questions
- Is accepting a parent-path
resourceon the client side intentional? - If yes, is it meant to apply to metadata discovered via
WWW-Authenticate, where §3.3 requires identity? Or only to the root well-known fallback? - If no, would you accept a change that makes
selectResourceURLrequire equality? This would be normalized equality, tolerant of a trailing slash as in #3041, possibly with an opt-in for lenient matching to avoid breaking existing servers.
Note: downstream clients reuse checkResourceAllowed in their own validateResourceURL hooks (e.g. OpenCode), so the answer also determines what they should do.
What did you expect?
No response
Code to reproduce
SDK version
No response
Area
Auth
- 主要言語
- TypeScript
- スター
- 13.8k
- フォーク
- 2.5k
- 平均マージ
- 6日 23時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
v2
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#3270 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`対応中かも @mgoldsborough が 6 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/typescript-sdk#3249 ·
メンテナーはふだん 1 日以内に返信
-
v2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/typescript-sdk#3243 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` reply対応中かも @Tidehyc が 7 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#3235 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
UriTemplate.match() throws a TypeError on an empty expression it accepts対応中かも @yunusemrejs が 12 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
modelcontextprotocol/typescript-sdk#3221 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Vessel9817/onion-site-template#512 ·
メンテナーはふだん 1 日以内に返信
-
nightly-tests
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
メンテナーはふだん 1 日以内に返信
-
approved
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
fritzprix/libr-agent#3266 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
better-auth/better-auth#13101 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信