PKCE verification: 2025-11-25 requires refusing when `code_challenge_methods_supported` is absent, which conflicts with the #832 / #992 resolution
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 28/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
startAuthorization、OAuthMetadataSchema、OpenIdProviderDiscoveryMetadataSchema、および issue に記載された auth() の再現から始めてください。まず、提案された4つのポリシーのうちどれが求められているかを明確にしてください。完了とは、存在しない code_challenge_methods_supported フィールドに対して選択した動作が実装され、その逸脱または厳格性が文書化されていることを意味します。
索引モデルが issue の本文から書いたものです。
説明
Summary
This is a follow-up to #832 and #992, not a report that the check is missing — it is deliberately
permissive, and this is about the spec moving underneath that decision.
#992 made startAuthorization treat an absent code_challenge_methods_supported as "assume PKCE is
supported", to unblock Azure AD and AWS Cognito, whose OIDC discovery documents omit the field while
the providers do support S256. The reasoning in #832 was explicitly "if the list isn't present,
assume it's there, and rely on the requests later failing if you send PKCE parameters that the AS
doesn't support."
The MCP specification has since taken the opposite position. The 2025-11-25 revision's
"Authorization Code Protection" section requires clients to verify PKCE support from
authorization-server metadata and to refuse when the field is absent — stated separately for RFC
8414 metadata and for OpenID Connect Discovery, the latter precisely because OIDC provider metadata
does not define the field. It also tells OIDC providers to publish it for MCP compatibility.
The 2025-06-18 revision does not mention code_challenge_methods_supported at all, so this
requirement post-dates #992. The SDK currently implements the #992 behavior and therefore does not
satisfy the 2025-11-25 requirement.
Current behavior
@modelcontextprotocol/client 2.0.0, startAuthorization:
if (metadata.code_challenge_methods_supported &&
!metadata.code_challenge_methods_supported.includes(AUTHORIZATION_CODE_CHALLENGE_METHOD)) {
throw new Error(`Incompatible auth server: does not support code challenge method ...`);
}
The leading truthiness check makes an absent field a no-op. At the schema level the field is
.optional() on OAuthMetadataSchema, and OpenIdProviderDiscoveryMetadataSchema picks that same
optional field, so an OIDC document without it parses clean and proceeds to authorization.
Reproduction
Serve authorization-server metadata with no code_challenge_methods_supported (issuer,
authorization_endpoint, token_endpoint, response_types_supported: ["code"]) and run the
auth() flow. It completes; nothing is raised or surfaced.
Why this is worth revisiting rather than closing
The #832 rationale holds for the common case and I am not arguing it should be reverted: PKCE
parameters are still sent, so a server that supports PKCE but omits the advertisement remains fully
protected. The gap is narrower than "no PKCE".
What the current behavior cannot do is distinguish that server from one that ignores code_challenge
outright, and it gives an embedder no signal that the distinction was unresolvable. "Rely on the
requests later failing" does not hold for this specific failure mode: an authorization server with
no PKCE support does not reject a request carrying code_challenge, it ignores the parameter, and
the flow succeeds with the protection silently absent.
Possible resolutions
- Surface the condition without changing the flow — a documented callback, a warning, or a field on
the returned discovery state — so embedders can apply their own policy. This preserves #992 and is
the smallest change. - An opt-in strict mode that refuses, defaulting to today's behavior.
- Refuse as the spec requires, with an opt-out for the OIDC case. Spec-correct, but reintroduces the
#832 breakage as the default. - Document the deviation from 2025-11-25 explicitly, so embedders know the check is theirs to make.
We implemented (1) plus (2) at the gateway layer and would be happy to send a PR for whichever
direction you prefer here.
Environment
@modelcontextprotocol/client 2.0.0 (latest at time of filing).
- 主要言語
- TypeScript
- スター
- 13.6k
- フォーク
- 2.3k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 51
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
Stateless 405 response omits the Allow header対応中かも @Hugo-DDT が今日担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/typescript-sdk#2970 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] @modelcontextprotocol/server inlines fast-uri 3.1.0, which has 9 published advisories対応中かも @Andiii208 が 3 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#2966 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#2946 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] URI template reserved expansions encode existing %HH sequences again対応中かも @takagibit18 が 9 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/typescript-sdk#2920 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[v2] URI template strict expansions leave !'()* unencoded対応中かも @takagibit18 が 9 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/typescript-sdk#2919 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
area:tui enhancement platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
anthropics/claude-code#101490 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
netlify/netlify-mcp#75 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
atlassian-labs/compiled#1960 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pnp/cli-microsoft365#7639 ·
メンテナーはふだん 2 日以内に返信
-
nextjs-tracking
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cloudflare/vinext#3887 ·
メンテナーはふだん 1 日以内に返信