Skip to content

Allow OAuth client provider to implement token endpoint authentication methods #531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jaredhanson
Copy link

Adds an optional authToTokenEndpoint function to the OAuthClientProvider interface. This allows client providers implement other token endpoint authentication methods such as private_key_jwt that are more secure than client_secret_post and none, which are implemented by default currently.

Motivation and Context

Allows implementation of other methods for authenticating to the token endpoint.

How Has This Been Tested?

This is being tested in a real agent that I'm currently developing, which is using key pairs for authentication.

Breaking Changes

This adds a required provider parameter to exchangeAuthorization and refreshAuthorization which are exported from @modelcontextprotocol/sdk/client/auth. In that sense it is a breaking change. However, these functions seem to be used only internally to this package, which limits the impact.

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

NOTE: This could be considered breaking, per description above, but it seems low probability at this point.

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

@ihrpr ihrpr added this to the HPR milestone May 22, 2025
Copy link
Contributor

@pcarleton pcarleton left a comment

Choose a reason for hiding this comment

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

Hey thanks for this, the direction overall looks good.

I'd like to know more about whether those functions are heavily used / how bad of a breaking change this would be before merging. I agree on appearance that they're only used there, but I know we at least use them in Inspector for the debugger (probably not a super common use case), so want to look into it a bit more.

Alternatively, sticking it in as optional seems like a fine option.

… refreshAuthorization to maintain compatibility.
@jaredhanson
Copy link
Author

Thanks @pcarleton - I modified the PR to make provider an optional final argument to both exchangeAuthorization and refreshAuthorization. This should make it a non-breaking change.

@jaredhanson jaredhanson requested a review from pcarleton May 22, 2025 22:26
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy