Skip to content

Conversation

@LucaButBoring
Copy link
Contributor

@LucaButBoring LucaButBoring commented Aug 7, 2025

Implements support for the RFC 7523 authentication flows. This PR is a trimmed-down version of #1020, but will likely be superceded by a future authlib-based implementation (see #1240).

Compared to #1020, this implements the flow via a separate httpx.Auth subclass, which is in-line with prior maintainer feedback on how to grow these auth implementations.

Motivation and Context

Implementation example for modelcontextprotocol/modelcontextprotocol#1046.

How Has This Been Tested?

Unit tests (TBD: unit tests for section 2.2 flow). Planning to spot test with Keycloak setup once that gets published.

Breaking Changes

None.

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

LucaButBoring and others added 30 commits June 23, 2025 10:52
No longer doing external integration examples as of modelcontextprotocol#1011. Will likely bring this back later as a standalone example.
Python default parameters reuse their references, so we can't use a collection like a dict as a default parameter value or we'll dirty our state.
@LucaButBoring LucaButBoring requested review from a team and ochafik August 12, 2025 19:10
@LucaButBoring
Copy link
Contributor Author

Now sep 1046 was approved do you want to move forward?

Updated the PR and opened.

@felixweinberger felixweinberger added pending SEP approval When a PR is attached as an implementation detail to a SEP, we mark it as such for triage. needs sync Needs sync with latest main branch to ensure CI passes labels Sep 23, 2025
@felixweinberger
Copy link
Contributor

@felixweinberger felixweinberger added the auth Issues and PRs related to Authentication / OAuth label Oct 3, 2025
@felixweinberger felixweinberger marked this pull request as draft October 13, 2025 15:36
@felixweinberger
Copy link
Contributor

Marking this as a draft for now to remove from our review queue while we wait for the SEP approval - modelcontextprotocol/modelcontextprotocol#1047

Please reopen once the SEP has been accepted or if you specifically need input beforehand!

@LucaButBoring
Copy link
Contributor Author

SEP-1046 is accepted; reopening this (will fix merge conflicts).

@LucaButBoring LucaButBoring marked this pull request as ready for review October 20, 2025 18:00
@felixweinberger felixweinberger added needs maintainer action Potentially serious issue - needs proactive fix and maintainer attention and removed pending SEP approval When a PR is attached as an implementation detail to a SEP, we mark it as such for triage. needs sync Needs sync with latest main branch to ensure CI passes labels Oct 21, 2025
@LucaButBoring
Copy link
Contributor Author

Per discussion on Discord, RFC7523OAuthClientProvider has been moved into a new mcp.client.auth.extensions.client_credentials module. Doing this required also renaming src/mcp/client/auth.py to src/mcp/client/auth/oauth2.py and re-exporting it from a new src/mcp/client/auth/__init__.py.

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

Labels

auth Issues and PRs related to Authentication / OAuth needs maintainer action Potentially serious issue - needs proactive fix and maintainer attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-1046: Support OAuth client credentials flow in authorization

3 participants