Skip to content

Conversation

@pcarleton
Copy link
Member

Overview

Adds conformance tests for OAuth Resource Indicators (RFC 8707) implementation per issue #33.

Changes

1. Resource parameter checks added to token-endpoint-auth-basic scenario

The following checks are now run as part of the existing token endpoint auth scenarios:

  • resource-parameter-in-authorization: Verifies resource parameter is present in authorization request
  • resource-parameter-in-token: Verifies resource parameter is present in token request
  • resource-parameter-valid-uri: Verifies resource is a valid canonical URI (has scheme, no fragment per RFC 8707)
  • resource-parameter-consistency: Verifies same resource is used in both authorization and token requests

2. New auth/resource-mismatch scenario

Tests that client correctly rejects when Protected Resource Metadata returns a resource field that doesn't match the server URL being accessed.

  • Server returns PRM with resource: "https://evil.example.com/mcp" (different origin)
  • Test passes if client does NOT proceed with authorization (correctly detecting the mismatch)

3. Helper updates

  • Added resource parameter to onAuthorizationRequest callback in createAuthServer
  • Added prmResourceOverride option to createServer for testing resource mismatch scenarios

4. Spec references

Added references for:

  • RFC 8707 - Resource Indicators for OAuth 2.0
  • MCP spec section on Resource Parameter Implementation

Testing

All existing tests pass. New scenarios tested against TypeScript SDK's everything-client.

Closes #33

Adds conformance tests for OAuth Resource Indicators (RFC 8707) implementation:

1. Resource parameter checks added to token-endpoint-auth-basic scenario:
   - resource-parameter-in-authorization: Verify resource in auth request
   - resource-parameter-in-token: Verify resource in token request
   - resource-parameter-valid-uri: Verify valid canonical URI
   - resource-parameter-consistency: Verify consistency between requests

2. New auth/resource-mismatch scenario:
   - Tests that client rejects when PRM resource doesn't match server URL
   - Server returns mismatched resource in PRM
   - Test passes if client does NOT proceed with authorization

Also adds spec references for RFC 8707 and MCP resource parameter spec.

Closes #33
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

Open in StackBlitz

npx https://pkg.pr.new/modelcontextprotocol/conformance/@modelcontextprotocol/conformance@118

commit: 60ddd9e

- Change resource parameter consistency from WARNING to FAILURE
- Remove unreachable protocol check in validateCanonicalUri
  (URL constructor already validates scheme presence)
@pcarleton pcarleton marked this pull request as ready for review January 23, 2026 12:49
Copy link
Collaborator

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

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

Could consider having a "negative" case as well - a bad client that has expected failures for these tests.

@pcarleton
Copy link
Member Author

it's a little annoying to yank it out of the request flow, but I'll see if I can add one in a follow up

@pcarleton pcarleton merged commit 67ad358 into main Jan 23, 2026
8 checks passed
@pcarleton pcarleton deleted the feat/resource-parameter-tests branch January 23, 2026 18:21
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.

Client Auth: Resource Parameter Validation

3 participants