Skip to content

RFC 9728 resource is used instead of base url when possible - #962

Merged
alexhancock merged 2 commits into
modelcontextprotocol:mainfrom
fkonecny:feat/rfc-9728-utilize-declared-oauth-resource
Jul 28, 2026
Merged

RFC 9728 resource is used instead of base url when possible#962
alexhancock merged 2 commits into
modelcontextprotocol:mainfrom
fkonecny:feat/rfc-9728-utilize-declared-oauth-resource

Conversation

@fkonecny

Copy link
Copy Markdown
Contributor

Motivation and Context

Library initiates OAuth2 workflow with predefined resource as the base url to abide RFC 8707. This violates a possibility where MCP belongs under umbrella of exposed functionalities. RFC 8707 permits it in its second paragraph.

There was already implemented resource discovery from OAuth2 resource metadata document defined by RFC 9728 in PR 937 which can access the exposed resource.

Use resource defined by OAuth2 resource metadata document so the creator of MCP and its provider can control what resource are tokens requested for.

How Has This Been Tested?

2 tests were added:

  • OAuth2 resource metadata document is missing,
  • OAuth2 resource metadata document declares resources.

PR 937 already handles situations where document has missing resource.

Breaking Changes

Breaking change: changes default behavior where base url is utilized always for resource and use defined resource by provider when available.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@fkonecny
fkonecny requested a review from a team as a code ownerJuly 7, 2026 09:03
@github-actionsgithub-actionsBot added T-core Core library changes T-transport Transport layer changes labels Jul 7, 2026
@fkonecnyfkonecny changed the title RFC 9728 resource is used when present over base url when possibleRFC 9728 resource is used over base url when possibleJul 7, 2026
@fkonecnyfkonecny changed the title RFC 9728 resource is used over base url when possibleRFC 9728 resource is used instead of base url when possibleJul 7, 2026
Comment threadcrates/rmcp/src/transport/auth.rs
@github-actionsgithub-actionsBot added the T-test Testing related changes label Jul 14, 2026
@fkonecny
fkonecny requested a review from DaleSeoJuly 14, 2026 07:45
Comment threadcrates/rmcp/tests/test_sampling.rs Outdated
@github-actionsgithub-actionsBot removed the T-test Testing related changes label Jul 17, 2026
alexhancock
alexhancock previously approved these changes Jul 17, 2026
@alexhancock

Copy link
Copy Markdown
Contributor

@filip-konecny-tfs Can you take a look at the red checks? Once resolved we can move forward

@fkonecny
fkonecnyforce-pushed the feat/rfc-9728-utilize-declared-oauth-resource branch from 0ad8259 to 1e3ae88CompareJuly 20, 2026 08:36
@fkonecny
fkonecnyforce-pushed the feat/rfc-9728-utilize-declared-oauth-resource branch from 1e3ae88 to 8b48170CompareJuly 20, 2026 08:49
@fkonecny

Copy link
Copy Markdown
ContributorAuthor

@alexhancock I did squash the commits and shortened the message so I can pass the lint message checks. Which erased the history of checks (sorry).

The public API check is confusing me as it refers things which I did not initiate, at least I think.

The semver check is confusing me, should I be the one bumping it? I can if you wish to do so.

P.S. @filip-konecny-tfs is my work account which I should not use for this type of activities :-).

Comment threadcrates/rmcp/src/transport/auth.rs
Comment threadcrates/rmcp/src/transport/auth.rs Outdated
@alexhancock

Copy link
Copy Markdown
Contributor

If you fix up the commit messages including a ! to denote the breaking changes it will pass the red checks

@DaleSeo
DaleSeoforce-pushed the feat/rfc-9728-utilize-declared-oauth-resource branch from e121d58 to a71717aCompareJuly 28, 2026 15:24
@DaleSeo

Copy link
Copy Markdown
Member

@alexhancock I updated the commit messages and forced pushed them. We should be able to merge this.

@alexhancock
alexhancock merged commit b429fc1 into modelcontextprotocol:mainJul 28, 2026
22 checks passed
@fkonecny

Copy link
Copy Markdown
ContributorAuthor

@DaleSeo and @alexhancock, thank you for your patience and help

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-coreCore library changesT-transportTransport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@fkonecny@alexhancock@DaleSeo@filip-konecny-tfs