diff --git a/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx b/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx index 3da3cb867ea..79cf775454a 100644 --- a/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx +++ b/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx @@ -508,6 +508,13 @@ const CreateMCPServer: React.FC = ({ restValues.transport = "http"; } + // Translate synthetic "byok" auth_type to actual type + is_byok flag + if (restValues.auth_type === "byok") { + restValues.auth_type = restValues.byok_key_format || "bearer_token"; + restValues.is_byok = true; + } + delete restValues.byok_key_format; + // Prepare the payload with cost configuration and allowed tools const payload: Record = { ...restValues, @@ -576,7 +583,7 @@ const CreateMCPServer: React.FC = ({ if (value === "stdio") { form.setFieldsValue({ url: undefined, spec_path: undefined, auth_type: undefined, credentials: undefined }); } else if (value === TRANSPORT.OPENAPI) { - form.setFieldsValue({ url: undefined, command: undefined, args: undefined, env: undefined }); + form.setFieldsValue({ url: undefined, command: undefined, args: undefined, env: undefined, auth_type: "none" }); } else { form.setFieldsValue({ spec_path: undefined, command: undefined, args: undefined, env: undefined }); } @@ -889,106 +896,101 @@ const CreateMCPServer: React.FC = ({ )} - {/* BYOK toggle - only for OpenAPI */} - {transportType === TRANSPORT.OPENAPI && ( - <> - - BYOK (Bring Your Own Key) - - - - - } - name="is_byok" - valuePropName="checked" - > - - - - prev.is_byok !== cur.is_byok || prev.auth_type !== cur.auth_type}> - {({ getFieldValue }) => - getFieldValue("is_byok") ? ( - <> - {/* Auth format hint */} - {getFieldValue("auth_type") && getFieldValue("auth_type") !== "none" && ( -
- - - User keys will be sent as:{" "} - - {getFieldValue("auth_type") === "bearer_token" && "Authorization: Bearer {key}"} - {getFieldValue("auth_type") === "api_key" && "x-api-key: {key}"} - {getFieldValue("auth_type") === "basic" && "Authorization: Basic {key}"} - {getFieldValue("auth_type") === "authorization" && "Authorization: {key}"} - - {!getFieldValue("auth_type") && "Set Authentication Type below to specify the format."} - -
- )} - {!getFieldValue("auth_type") && ( -
- - Set the Authentication Type below to specify how user keys are sent (e.g., Bearer Token, API Key header). -
- )} - - Access Description - - - - - } - name="byok_description" - > - - - - ) : null - } -
- - )} - {/* Authentication - show for HTTP, SSE, and OpenAPI */} {transportType !== "stdio" && transportType !== "" && ( Authentication} name="auth_type" - rules={[{ required: true, message: "Please select an auth type" }]} + rules={[{ required: transportType !== TRANSPORT.OPENAPI, message: "Please select an auth type" }]} > )} + {/* BYOK fields — shown when auth_type is "byok" */} + prev.auth_type !== cur.auth_type}> + {({ getFieldValue }) => + getFieldValue("auth_type") === "byok" ? ( + <> +
+
+ +
+

Bring Your Own Key (BYOK)

+

+ Each user connects this API with their own key — keys are stored per-user and never shared. Users will be prompted to enter their key in the ChatUI before using this tool. +

+
+
+
+ + Key Format} + name="byok_key_format" + initialValue="bearer_token" + rules={[{ required: true, message: "Please select how the key is sent" }]} + > + + + + + Access Description + + + + + } + name="byok_description" + > + + + + ) : null + } +
+ {transportType !== "stdio" && transportType !== "" && shouldShowAuthValueField && (