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
This commit is contained in:
John Howard 2025-08-28 15:03:38 -07:00
commit 2bfbdca485
2 changed files with 8 additions and 1 deletions

View file

@ -777,6 +777,11 @@ export function useConnection({
variant: "destructive",
});
}
toast({
title: "Connection error",
description: `Connection failed: "${e}"`,
variant: "destructive",
});
console.error(e);
setConnectionStatus("error");
}

View file

@ -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,
},
};