From 2bfbdca48592f5b910881f1e7adcd4f058b78e34 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 8639feeb..8d8fee46 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 664f1711..174eef0e 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, }, };