inspector icon indicating copy to clipboard operation
inspector copied to clipboard

HTTP 405 trying to load well-known OAuth metadata

Open jpmcb opened this issue 5 months ago • 3 comments

Describe the bug

When attempting to walk through the auth flow for my server, I get the following:

Image
HTTP 405 trying to load well-known OAuth metadata

This seems to be directly related to: https://github.com/modelcontextprotocol/typescript-sdk/issues/744

To Reproduce

Steps to reproduce the behavior:

  1. Have an OAuth server in the protected metadata at a trailing path like so: my-org.okta.com/oauth/abc123
  2. Attempt to walk through OAuth
  3. Notice error
  4. Open console and see the following:
OAuth flow error: Error: HTTP 405 trying to load well-known OAuth metadata
    discoverOAuthMetadata http://localhost:6274/assets/index-CPgI0-gs.js:16611

Expected behavior

OAuth flow to work with any auth server provider

jpmcb avatar Jul 21 '25 19:07 jpmcb

Hmm, it looks like https://github.com/modelcontextprotocol/typescript-sdk/pull/652 added OIDC Discovery support and version 0.16.2 pulled in that update, but this bug still exists in inspector.

tomekchime avatar Aug 09 '25 18:08 tomekchime

I see the PR is already up to fix it.

Faced this issue when using okta as authorization server, for temporary fix,

  • I cloned the inspector repo
  • Opened the node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
  • Updated the order of urlsToTry in buildDiscoveryUrls function, updated last one to first
  • ran npm run dev from the repo instead of inspector command

Adding this, just in case someone is facing this issue

sbbeez avatar Oct 04 '25 12:10 sbbeez

Hi @sbbeez, I see you mentioned a PR here, could you link to which PR you're referring to related to resolving this issue? Thanks!

olaservo avatar Oct 13 '25 14:10 olaservo