Skip to content

fix: pass new conformance auth scenarios, bump to 0.1.13#1999

Draft
pcarleton wants to merge 7 commits intomainfrom
paulc/fix-conformance-auth-scenarios
Draft

fix: pass new conformance auth scenarios, bump to 0.1.13#1999
pcarleton wants to merge 7 commits intomainfrom
paulc/fix-conformance-auth-scenarios

Conversation

@pcarleton
Copy link
Member

Fixes the conformance CI build which was broken by @modelcontextprotocol/sdk@1.26.0 being resolved as a transitive dependency of the conformance package.

Changes

SDK fix — PRM resource validation (RFC 8707):
After discovering Protected Resource Metadata, the OAuth client now validates that the resource field matches the server URL before proceeding with authorization. If the PRM returns a resource from a different origin (e.g. https://evil.example.com/mcp), the client raises OAuthFlowError instead of blindly continuing the auth flow.

Conformance client — pre-registration support:
The conformance test client now pre-loads client credentials from MCP_CONFORMANCE_CONTEXT into token storage when available. This allows the existing _initialize() flow to skip DCR when pre-registered credentials are present, which is the correct behavior per the MCP spec's pre-registration approach.

CI — bump conformance to 0.1.13:
Updates from @modelcontextprotocol/conformance@0.1.10 to 0.1.13 which includes the tools_call scenario fix for SDK 1.26.0 compatibility.

…stered credentials

Two conformance auth scenario fixes:

1. Resource mismatch validation (RFC 8707): After discovering Protected
   Resource Metadata, validate that the resource field matches the
   server URL before proceeding with authorization. If the PRM returns
   a resource from a different origin, raise OAuthFlowError.

2. Pre-registration fallback: When Dynamic Client Registration fails
   (e.g. server returns 404), fall back to pre-registered client
   credentials from storage instead of crashing. The conformance
   client now pre-loads client credentials from MCP_CONFORMANCE_CONTEXT
   when available.
The _initialize() method already loads client_info from storage before
the OAuth flow runs. When pre-registered credentials are in storage,
the 'if not self.context.client_info' guard skips DCR entirely —
no fallback needed.
Pydantic AnyHttpUrl adds a trailing slash to root URLs (e.g.
"https://example.com/") while resource_url_from_server_url may
return without one. This caused check_resource_allowed to reject
valid root-URL servers due to path length mismatch.
@claude
Copy link

claude bot commented Feb 5, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

)
)
logger.debug(f"Pre-loaded client credentials: client_id={client_id}")
except json.JSONDecodeError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont you want to see the exception if the json is wrong?

@pcarleton pcarleton marked this pull request as draft February 5, 2026 16:45
Allows clients to override or disable PRM resource validation.
Called with (server_url, prm_resource) and can raise to reject,
return to accept, or implement custom logic. When not provided,
default behavior validates per RFC 8707 and rejects mismatches.
The tests used a PRM resource (https://api.example.com/mcp) that
didn't match the server URL (https://api.example.com/v1/mcp). This
was silently ignored before resource validation was added.
Tests for resource mismatch rejection, matching resources,
custom callback override, and root URL trailing slash normalization.
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.

2 participants