From 049f904af84c2fe2b1f6f75962f45d32e5d2754e Mon Sep 17 00:00:00 2001 From: jZonG Date: Thu, 29 May 2025 17:22:19 +0800 Subject: [PATCH] fix: auto authorizing --- web/app/components/tools/mcp/index.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/app/components/tools/mcp/index.tsx b/web/app/components/tools/mcp/index.tsx index c5d06d571b..fa069ac7f0 100644 --- a/web/app/components/tools/mcp/index.tsx +++ b/web/app/components/tools/mcp/index.tsx @@ -68,13 +68,18 @@ const MCPList = ({ const handleCreate = async (provider: ToolWithProvider) => { await refetch() // update list setCurrentProviderID(provider.id) - await authorizeMcp({ + const res = await authorizeMcp({ provider_id: provider.id, }) - await refetch() // update authorization in list - await updateTools(provider.id) - invalidateMCPTools(provider.id) - await refetch() // update tool list in provider list + if (res.result === 'success') { + await refetch() // update authorization in list + await updateTools(provider.id) + invalidateMCPTools(provider.id) + await refetch() // update tool list in provider list + } + else if (res.authorization_url) { + router.push(res.authorization_url) + } } const handleUpdateAuthorization = async (providerID: string, code: string) => {