From f54f2ec8090fa0697d8947e8483c7fc68f31ca48 Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 28 Aug 2025 15:03:38 -0700 Subject: [PATCH] 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 a07b67dc9..f7e53eace 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -624,6 +624,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, }, };