fix: pass new conformance auth scenarios, bump to 0.1.13#1999
Draft
fix: pass new conformance auth scenarios, bump to 0.1.13#1999
Conversation
…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.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Kludex
reviewed
Feb 5, 2026
| ) | ||
| ) | ||
| logger.debug(f"Pre-loaded client credentials: client_id={client_id}") | ||
| except json.JSONDecodeError: |
Member
There was a problem hiding this comment.
Dont you want to see the exception if the json is wrong?
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the conformance CI build which was broken by
@modelcontextprotocol/sdk@1.26.0being 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
resourcefield 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 raisesOAuthFlowErrorinstead of blindly continuing the auth flow.Conformance client — pre-registration support:
The conformance test client now pre-loads client credentials from
MCP_CONFORMANCE_CONTEXTinto 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.10to0.1.13which includes thetools_callscenario fix for SDK 1.26.0 compatibility.