fix: MCP server OAuth form quick wins (read-only redirect URI, drop password grant) UI part - #15
Open
marekdano wants to merge 3 commits into
Open
fix: MCP server OAuth form quick wins (read-only redirect URI, drop password grant) UI part#15marekdano wants to merge 3 commits into
marekdano wants to merge 3 commits into
Conversation
…assword grant) UI part Signed-off-by: Marek Dano <mk.dano@gmail.com>
14 tasks
Signed-off-by: Marek Dano <mk.dano@gmail.com>
gcgoncalves
requested changes
Aug 13, 2026
gcgoncalves
left a comment
Contributor
There was a problem hiding this comment.
The PR is in great shape, I'd just requested a minor performance update and a little more testing for:
- Copy button interaction test
- localhost warning tests
| if (grantType === "authorization_code" && !redirectUri) { | ||
| onRedirectUriChange(derivedRedirectUri); | ||
| } | ||
| }, [grantType, redirectUri, derivedRedirectUri, onRedirectUriChange]); |
Contributor
There was a problem hiding this comment.
The useEffect includes onRedirectUriChange in dependencies, which could cause unnecessary re-runs if the parent doesn't memoize the callback:
useEffect(() => {
if (grantType === "authorization_code" && !redirectUri) {
onRedirectUriChange(derivedRedirectUri);
}
}, [grantType, redirectUri, derivedRedirectUri, onRedirectUriChange]);Risk: Parent component re-renders could trigger unnecessary effect runs
Recommendation:
// In parent component (MCPServerForm), wrap the callback:
const handleRedirectUriChange = useCallback((uri: string) => {
setFormData(prev => ({ ...prev, redirectUri: uri }));
}, []);Or use useCallback ref pattern:
const onRedirectUriChangeRef = useRef(onRedirectUriChange);
useEffect(() => {
onRedirectUriChangeRef.current = onRedirectUriChange;
});
useEffect(() => {
if (grantType === "authorization_code" && !redirectUri) {
onRedirectUriChangeRef.current(derivedRedirectUri);
}
}, [grantType, redirectUri, derivedRedirectUri]);Signed-off-by: Marek Dano <mk.dano@gmail.com>
gcgoncalves
approved these changes
Aug 13, 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.
Depends IBM/mcp-context-forge#5786
Summary
UI-side counterpart of IBM/mcp-context-forge#5786, split into this repo now that the client lives here. Delivers User Stories 1 and 4 of IBM/mcp-context-forge#5721 (Story 3 — pre-fill from the MCP
initializeresponse — is deferred pending IBM/mcp-context-forge#5719; Story 2 was already satisfied server-side, no UI change needed).authorization_code, the redirect URI field is now read-only and derived from the running app's own origin ({origin}/oauth/callback), with a copy-to-clipboard buttonand a warning when the derived/stored value is
localhost/127.0.0.1— a real misconfiguration if registered with an external IdP. The displayed value is lifted into form state viaonRedirectUriChangeso what's shown isexactly what gets submitted; a server response that already carries a
redirect_uriis shown verbatim and never overwritten. This removes the copy-paste transcription error that used to silently break OAuth callbacks. (Thecorresponding backend default —
initiate_oauth_flow/oauth_callbackfilling in a missingredirect_uri— already shipped in feat(python): MCP server OAuth form quick wins (read-only redirect URI, drop password grant) IBM/mcp-context-forge#5786.)shown with a deprecation notice so a loaded config isn't silently changed out from under the user. Actual rejection for new registrations is enforced server-side in
GatewayCreate(already merged in feat(python): MCP server OAuth form quick wins (read-only redirect URI, drop password grant) IBM/mcp-context-forge#5786)— this is the matching UI-side removal, not the enforcement boundary.
OAuth2Auth.tsxis routed throughreact-intl(mcpServer.oauth2.*keys added toen-US,es-ES,pt-BR), matching this repo's localization convention — the original component predatedit and used inline strings.
Test plan
OAuth2Auth.test.tsx: read-only redirect URI renders the derived origin and is lifted into form state; a storedredirect_uriis shown verbatim and not overwritten; no redirect URI is set for non-authorization_codegrants;the password grant option only appears (with the deprecation copy) when already selected.
MCPServerForm.test.tsx: updated to match the new OAuth2Auth behavior.