fix(core): refresh MCP OAuth with stored client ID#27752
Conversation
|
📊 PR Size: size/M
|
|
You already have 7 pull requests open. Please work on getting existing PRs merged before opening more. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where MCP OAuth token refreshes would fail if the client ID was not explicitly defined in the static configuration, despite being available in the stored credentials. By dynamically resolving the client ID from the stored credentials when necessary, the system can now successfully refresh tokens for auto-discovered OAuth servers. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the MCPOAuthProvider to fall back to the stored clientId from credentials when the configuration does not provide one during token refresh. It also adds corresponding unit tests to verify this behavior in both getValidToken and getValidTokenWithMetadata. I have no feedback to provide as there are no review comments.
Summary
Refresh HTTP MCP OAuth tokens with the client ID persisted during dynamic client registration.
Details
Auto-discovered OAuth servers can store a dynamically registered client ID without adding it to the static MCP server config. Both token lookup paths could find that stored client ID, but the refresh call still received the original config and failed with
Missing required clientId for token refresh.This passes the effective client ID into token refresh and preserves it when saving the refreshed token. Regression tests cover both the plain access-token path and the metadata path used by the dynamic stored OAuth provider.
Related Issues
Fixes #27745
How to Validate
Expected: the OAuth provider tests pass, including refresh with a stored client ID when the static config omits it.
Pre-Merge Checklist