feat(amazonq): align mcp oauth client with mcp sdk auth patterns#2679
Merged
ashishrp-aws merged 3 commits intoaws:mainfrom Mar 30, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2679 +/- ##
==========================================
+ Coverage 60.30% 60.49% +0.19%
==========================================
Files 279 279
Lines 66177 66263 +86
Branches 4204 4251 +47
==========================================
+ Hits 39906 40086 +180
+ Misses 26188 26092 -96
- Partials 83 85 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aseemxs
reviewed
Mar 27, 2026
Will-ShaoHua
approved these changes
Mar 27, 2026
laileni-aws
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The MCP OAuth client did not align with the MCP SDK's authentication patterns. It lacked RFC 9728 Protected Resource Metadata discovery, hardcoded
noneas the token endpoint auth method during dynamic client registration, ignored scopes from discovery metadata, and used127.0.0.1redirect URIs instead oflocalhostwith the/oauth/callbackpath. The unusedchild_processimport was also still present.Solution
Aligned the OAuth client with the MCP SDK's auth flow. Added RFC 9728 Protected Resource Metadata discovery as the first step in the discovery chain, with proper fallback through WWW-Authenticate, RFC 8414/OIDC well-known endpoints, and static endpoint synthesis. Introduced
selectAuthMethodandapplyAuthto negotiate client authentication (client_secret_basic, client_secret_post, none) based on DCR response and server-supported methods. Scopes are now sourced from discovery metadata with OIDC defaults as fallback. Redirect URIs uselocalhostwith/oauth/callback. Added comprehensive test coverage for all new code paths.Screen.Recording.2026-03-26.at.6.05.08.PM.mov
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.