Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui): forward OAuth issuer/authorization/token/registration URLs from the MCP server edit form (#38154)

Yassin Kortam5470c1bccbaa
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.test.tsx
index 438caa2f5e6..5aec78ba926 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.test.tsx
@@ -381,6 +381,44 @@ describe("MCPServerEdit (true passthrough warning)", () => {
});
});
+describe("MCPServerEdit (OAuth authorize temp payload)", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("forwards issuer/authorization_url/token_url/registration_url to the temp OAuth session payload", async () => {
+ // Without these fields the ephemeral server the temp OAuth session endpoint builds has no
+ // admin-configured OAuth endpoints on it, discovery falls back to (and fails against) the
+ // plain server url, and Authorize & Fetch Token 400s with "authorization url is not
+ // configured" even though the saved server (and the visible form) has all four fields filled in.
+ render(
+ <MCPServerEdit
+ mcpServer={{
+ ...interactiveOAuthServer,
+ issuer: "https://github.com/login/oauth",
+ authorization_url: "https://github.com/login/oauth/authorize",
+ token_url: "https://github.com/login/oauth/access_token",
+ registration_url: "https://github.com/login/oauth/register",
+ }}
+ accessToken="access-token"
+ onCancel={vi.fn()}
+ onSuccess={vi.fn()}
+ availableAccessGroups={[]}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(mockOauth.getTemporaryPayload).toBeTruthy();
+ });
+ const payload = mockOauth.getTemporaryPayload!();
+ expect(payload).toBeTruthy();
+ expect(payload?.issuer).toBe("https://github.com/login/oauth");
+ expect(payload?.authorization_url).toBe("https://github.com/login/oauth/authorize");
+ expect(payload?.token_url).toBe("https://github.com/login/oauth/access_token");
+ expect(payload?.registration_url).toBe("https://github.com/login/oauth/register");
+ });
+});
+
describe("MCPServerEdit (auth type switch)", () => {
beforeEach(() => {
vi.clearAllMocks();
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.tsx
index 5e79b20825c..8793c45371a 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/mcp_server_edit.tsx
@@ -282,6 +282,10 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({
credentials: isClientForwardedTokenMode(values.auth_type)
? preservedAdminCredentials(values.credentials)
: values.credentials,
+ issuer: values.issuer,
+ authorization_url: values.authorization_url,
+ token_url: values.token_url,
+ registration_url: values.registration_url,
mcp_access_groups: values.mcp_access_groups || mcpServer.mcp_access_groups,
static_headers: staticHeaders,
command: values.command,