feat(ui): add token endpoint auth method selector to MCP OAuth forms - #31739
Conversation
Merging this PR will improve performance by 38.7%
Performance Changes
Tip Curious why this is faster? Comment Comparing |
Greptile SummaryThis PR completes the dashboard side of the per-server
Confidence Score: 5/5Dashboard-only change with no backend logic; the new field writes directly to the credentials blob the backend already reads, and all prior review gaps are closed. The change is well-scoped: a small new UI component inserted in two existing forms, backed by comprehensive tests that cover both the select-a-value and leave-blank-omits-key paths for every affected form. All three items flagged in the previous review round are addressed. No API surface, auth logic, or critical request path is touched. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/mcp_tools/TokenEndpointAuthMethodField.tsx | New shared component rendering the token endpoint auth method selector; uses options array directly without redundant .map(), placeholder adapts correctly to create vs. edit context. |
| ui/litellm-dashboard/src/components/mcp_tools/testUtils.ts | Shared selectAntOption test helper extracted from create_mcp_server.test.tsx; retains full fallback selector chain, simplifies the intermediate variable, and is re-exported cleanly for both test files. |
| ui/litellm-dashboard/src/components/mcp_tools/OAuthFormFields.tsx | TokenEndpointAuthMethodField inserted after the Token URL field in both M2M and interactive flows; isEditing prop forwarded correctly. |
| ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx | TokenEndpointAuthMethodField added after the Token URL Override field with isEditing=true; no logic changes. |
| ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.test.tsx | Local selectAntOption removed and replaced with the shared import; two new tests cover the "select client_secret_basic" and "leave blank omits key" cases for the create form. |
| ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx | Imports shared selectAntOption; adds both "select a value" and "leave blank omits key" tests for the edit form, addressing the gap noted in the prior review. |
| ui/litellm-dashboard/src/components/mcp_tools/OAuthFormFields.test.tsx | Three new tests verify the selector renders below Token URL in both M2M and interactive modes and that both option values are present in the dropdown. |
Reviews (5): Last reviewed commit: "feat(ui): add token endpoint auth method..." | Re-trigger Greptile
Greptile SummaryThis PR completes dashboard support for the
Confidence Score: 5/5Dashboard-only UI change with no backend modifications; integrates cleanly with existing credentials filtering. The only finding is a redundant .map() on an already correctly shaped options array — purely cosmetic, no behavioral impact. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/mcp_tools/TokenEndpointAuthMethodField.tsx | New shared component that renders the token_endpoint_auth_method Select; form name correctly maps to credentials.token_endpoint_auth_method, allowClear ensures undefined is omitted from payload when blank, and isEditing controls the placeholder text. Minor: redundant .map() on options array. |
| ui/litellm-dashboard/src/components/mcp_tools/OAuthFormFields.tsx | Adds TokenEndpointAuthMethodField directly below the Token URL field in both M2M and interactive OAuth flows, passing isEditing through correctly. |
| ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx | Inserts TokenEndpointAuthMethodField with isEditing after Token URL Override in the inline OAuth section; field is gated by isOAuthAuthType and omitted-when-blank handling is already present in the credentialsPayload reducer. |
| ui/litellm-dashboard/src/components/mcp_tools/OAuthFormFields.test.tsx | Adds three tests: DOM ordering in both M2M and interactive modes, and options availability. Coverage is appropriate for a new UI field. |
| ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.test.tsx | Two new tests verify that selecting client_secret_basic includes the field in the create payload, and leaving it blank omits it. Both cases exercise the credentialsPayload reducer path. |
| ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx | Adds a local selectAntOption helper and one test verifying client_secret_basic is included in the update payload. The local helper is a simpler but functionally adequate version of the one in create_mcp_server.test.tsx. |
Reviews (2): Last reviewed commit: "feat(ui): add token endpoint auth method..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
0077f13 to
fdf0fb8
Compare
|
Applied the suggestion. The |
|
Added a complementary edit-form test: when the server has no |
fdf0fb8 to
67325c6
Compare
PR #31635 added a per-server token_endpoint_auth_method (client_secret_basic or client_secret_post) for upstream OAuth token endpoints, but it could only be set by editing the stored credentials JSON. This surfaces it in the dashboard as an optional selector directly under the Token URL field, in both the create form (OAuthFormFields, M2M and interactive flows) and the edit form. The field binds to credentials.token_endpoint_auth_method, which the backend already reads; the value is sent only when chosen, so leaving it blank keeps the existing setting and preserves the client_secret_post default.
|
Extracted the duplicated |
67325c6 to
0c2b078
Compare
Relevant issues
Follow-up to #31635, which added the backend support
Linear ticket
Relates to LIT-4091 (resolved by #31635 on the backend); this completes it in the dashboard
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
This is a dashboard-only change with no backend behavior change, so the proof is the new field in the create and edit forms. Run the proxy and open the dashboard, then:
To confirm the value round-trips into the credentials the gateway reads, after step 5 check the stored row:
then exercise the upstream token exchange against an IdP registered for
client_secret_basic(same setup as #31635) and confirm the gateway sendsAuthorization: Basic ...instead of credentials in the bodyType
🆕 New Feature
Changes
PR #31635 added a per-server
token_endpoint_auth_method(client_secret_basicorclient_secret_post) that controls how the gateway authenticates to an upstream OAuth token endpoint, but the only way to set it was hand-editing the stored credentials JSON; the dashboard had no control for itThis adds an optional "Token Endpoint Auth Method" selector directly under the Token URL field in both MCP server forms: the create form (
OAuthFormFields, in both the M2M and interactive flows) and the edit form (mcp_server_edit). A small sharedTokenEndpointAuthMethodFieldcomponent renders the field in all three spots so the markup stays in one placeThe field binds to
credentials.token_endpoint_auth_method, which is exactly what the backend already reads, so no API change is needed. It is write-only by design: the credentials blob is redacted before servers are returned to the dashboard (same reason client id/secret cannot be pre-filled today), so the dropdown opens blank. Leaving it blank omits the key from the request, which preserves whatever is already stored and keeps theclient_secret_postdefault; choosing a value overrides it. Because nothing is sent when blank, an edit that does not touch the field never disturbs the existing settingTests cover the create form (selecting
client_secret_basicputs it in the create payload undercredentials; leaving it blank omits it), the edit form (selecting it puts it in the update payload), andOAuthFormFields(the selector renders directly below Token URL in both M2M and interactive flows and offers both options). The selector tests fail on the pre-change code