Skip to content

fix: continue OAuth discovery after non-JSON metadata#2127

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/oauth-discovery-non-json-fallback
Open

fix: continue OAuth discovery after non-JSON metadata#2127
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/oauth-discovery-non-json-fallback

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • continue authorization server discovery when a 200 OK metadata response is not JSON
  • keep the existing 4xx/502 fallback behavior and non-502 5xx failure behavior
  • add a regression test for falling through from the OAuth metadata URL to the OIDC metadata URL

Fixes #2126

To verify

  • pnpm --filter @modelcontextprotocol/client test -- test/client/auth.test.ts
  • pnpm --filter @modelcontextprotocol/client typecheck
  • pnpm --filter @modelcontextprotocol/client lint

@he-yufeng he-yufeng requested a review from a team as a code owner May 20, 2026 16:35
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

⚠️ No Changeset found

Latest commit: e333dd7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 20, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2127

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2127

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2127

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2127

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2127

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2127

commit: e333dd7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth AS metadata discovery crashes on 200 OK + non-JSON response instead of falling back to OIDC

1 participant