diff --git a/client/src/lib/hooks/useConnection.ts b/client/src/lib/hooks/useConnection.ts index eb782041b..c26c1d660 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -7,6 +7,7 @@ import { import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions, + StreamableHTTPError, } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import { ClientNotification, @@ -358,8 +359,11 @@ export function useConnection({ const is401Error = (error: unknown): boolean => { return ( (error instanceof SseError && error.code === 401) || + (error instanceof StreamableHTTPError && error.code === 401) || (error instanceof Error && error.message.includes("401")) || - (error instanceof Error && error.message.includes("Unauthorized")) + (error instanceof Error && error.message.includes("Unauthorized")) || + (error instanceof Error && + error.message.includes("Missing Authorization header")) ); };