From 2bfbdca48592f5b910881f1e7adcd4f058b78e34 Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 28 Aug 2025 15:03:38 -0700 Subject: [PATCH 1/2] Add a toast on connection error When failing to connect to an MCP server, its very hard to understand why. There is only an opaque "Connection Error" message with no additional info. This also doesn't change at all on repeated attempts, so there is no indication we attempted again and failed. This change introduces a `toast` to visualize the error, and adds the `cause` into the error message for further debugging --- client/src/lib/hooks/useConnection.ts | 5 +++++ server/src/mcpProxy.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/lib/hooks/useConnection.ts b/client/src/lib/hooks/useConnection.ts index 8639feebc..8d8fee46d 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -777,6 +777,11 @@ export function useConnection({ variant: "destructive", }); } + toast({ + title: "Connection error", + description: `Connection failed: "${e}"`, + variant: "destructive", + }); console.error(e); setConnectionStatus("error"); } diff --git a/server/src/mcpProxy.ts b/server/src/mcpProxy.ts index 664f17119..174eef0ec 100644 --- a/server/src/mcpProxy.ts +++ b/server/src/mcpProxy.ts @@ -36,7 +36,9 @@ export default function mcpProxy({ id: message.id, error: { code: -32001, - message: error.message, + message: error.cause + ? `${error.message} (cause: ${error.cause})` + : error.message, data: error, }, }; From 0b569f2fff7374e4b8ad03a889f8eee1c8fe830a Mon Sep 17 00:00:00 2001 From: John Howard Date: Mon, 13 Oct 2025 08:22:10 -0700 Subject: [PATCH 2/2] Move under else --- client/src/lib/hooks/useConnection.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/lib/hooks/useConnection.ts b/client/src/lib/hooks/useConnection.ts index 8d8fee46d..f37ec6370 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -776,12 +776,13 @@ export function useConnection({ description: `Server declares logging capability but doesn't implement method: "${lastRequest}"`, variant: "destructive", }); + } else { + toast({ + title: "Connection error", + description: `Connection failed: "${e}"`, + variant: "destructive", + }); } - toast({ - title: "Connection error", - description: `Connection failed: "${e}"`, - variant: "destructive", - }); console.error(e); setConnectionStatus("error"); }