Skip to content

OAuth discovery treats any /.well-known/openid-configuration response as full OIDC ( rejecting plain OAuth 2.0 authorization ) #2172

Description

@justinhunt

Which version line?

v2 — current (@modelcontextprotocol/inspector@latest)

Which client?

CLI

Inspector version

2.4.0

Node version

v22.22.0

Operating system (and browser, for the web client)

Linux (WSL2), kernel 6.18.33.2-microsoft-standard-WSL2, x86_64

Transport

Streamable HTTP

MCP server under inspection

https://misc.poodll.com/mod/minilesson/mcp.php — a plain OAuth 2.0 authorization server (no OIDC: no ID tokens, no jwks_uri, no sub claims). Resource lives under a path, not the domain root.

Steps to reproduce

  1. Run:
    npx @modelcontextprotocol/inspector@2.4.0 --cli
    --server-url "https://misc.poodll.com/mod/minilesson/mcp.php"
    --transport http --method tools/list --connect-timeout 15000
  2. No TTY: set MCP_AUTO_OPEN_ENABLED=true and re-run.
  3. buildDiscoveryUrls() (client/dist/index.mjs:1016) builds three candidate URLs; the one that resolves is the append form ${pathname}/.well-known/openid-configuration, tagged type: "oidc" purely from its filename.
  4. discoverAuthorizationServerMetadata() (client/dist/index.mjs:1088) picks the validation schema from that tag alone: type === "oauth" ? OAuthMetadataSchema : OpenIdProviderDiscoveryMetadataSchema.
  5. Our plain-OAuth response gets validated against OpenIdProviderDiscoveryMetadataSchema, which requires jwks_uri, subject_types_supported, id_token_signing_alg_values_supported (core/dist/auth-CUe6YdwF.mjs:1541–1554).
  6. Zod parse throws, connection fails.

Expected behavior

Our plain OAuth 2.0 authorization server (no OIDC) publishes its metadata at /.well-known/openid-configuration. Discovery should accept that as valid RFC 8414 metadata.

Actual behavior

Discovery fails when the resolved metadata URL ends in "openid-configuration". Even though the response itself makes no OIDC claim. The schema is evaluated as OIDC. And since the actual schemea is OAuth, not OIDC, it fails

Logs, errors, or screenshots

{"error":{"code":"error","message":"[
{"expected":"string","code":"invalid_type","path":["jwks_uri"],"message":"Invalid input: expected string, received undefined"},
{"expected":"array","code":"invalid_type","path":["subject_types_supported"],"message":"Invalid input: expected array, received undefined"},
{"expected":"array","code":"invalid_type","path":["id_token_signing_alg_values_supported"],"message":"Invalid input: expected array, received undefined"}
]"}}

Already prototyped a fix?

Don't key the schema on which well-known filename resolved. Instead either:

  1. try OAuthMetadataSchema first and only fall back to OpenIdProviderDiscoveryMetadataSchema on failure, or
  2. make jwks_uri, subject_types_supported, id_token_signing_alg_values_supported optional in OpenIdProviderMetadataSchema (core/dist/auth-CUe6YdwF.mjs:1546,1553,1554), and just check for actual OIDC behavior (ID token requests, userinfo calls) if they are present

In our tests, we made the three fields optional in OpenIdProviderMetadataSchema. With that change, discovery completes, /authorize redirects correctly, and tools/list returns real results end to end against the same server.

Before you submit

  • I searched existing issues and this is not a duplicate.
  • This is not a security vulnerability report (those go through the private advisory process).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv2Issues and PRs for v2

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions