From ec7ccd800c6091bc7430d6dc9e23757e2a2df641 Mon Sep 17 00:00:00 2001 From: wangxiaolei Date: Wed, 4 Feb 2026 16:55:12 +0800 Subject: [PATCH] fix: fix mcp server status is not right (#31826) Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> --- .../components/tools/mcp/detail/content.tsx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/web/app/components/tools/mcp/detail/content.tsx b/web/app/components/tools/mcp/detail/content.tsx index 2476973fa5..23d408706d 100644 --- a/web/app/components/tools/mcp/detail/content.tsx +++ b/web/app/components/tools/mcp/detail/content.tsx @@ -103,15 +103,22 @@ const MCPDetailContent: FC = ({ return if (!detail) return - const res = await authorizeMcp({ - provider_id: detail.id, - }) - if (res.result === 'success') - handleUpdateTools() + try { + const res = await authorizeMcp({ + provider_id: detail.id, + }) + if (res.result === 'success') + handleUpdateTools() - else if (res.authorization_url) - openOAuthPopup(res.authorization_url, handleOAuthCallback) - }, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback]) + else if (res.authorization_url) + openOAuthPopup(res.authorization_url, handleOAuthCallback) + } + catch { + // On authorization error, refresh the parent component state + // to update the connection status indicator + onUpdate() + } + }, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback, onUpdate]) const handleUpdate = useCallback(async (data: any) => { if (!detail)