Skip to content

Commit 2bfbdca

Browse files
committed
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
1 parent ccb68b9 commit 2bfbdca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

client/src/lib/hooks/useConnection.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,11 @@ export function useConnection({
777777
variant: "destructive",
778778
});
779779
}
780+
toast({
781+
title: "Connection error",
782+
description: `Connection failed: "${e}"`,
783+
variant: "destructive",
784+
});
780785
console.error(e);
781786
setConnectionStatus("error");
782787
}

server/src/mcpProxy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export default function mcpProxy({
3636
id: message.id,
3737
error: {
3838
code: -32001,
39-
message: error.message,
39+
message: error.cause
40+
? `${error.message} (cause: ${error.cause})`
41+
: error.message,
4042
data: error,
4143
},
4244
};

0 commit comments

Comments
 (0)