| 7 | * Since we're using mcp library there's a good chance 405 means auth issue and doesn't hurt to retry with auth |
| 8 | */ |
| 9 | export function isAuthError(error: unknown): boolean { |
| 10 | return ( |
| 11 | (error instanceof SseError && error.code === 401) || |
| 12 | (error instanceof SseError && error.code === 405) || |
| 13 | (error instanceof StreamableHTTPError && error.code === 401) || |
| 14 | (error instanceof StreamableHTTPError && error.code === 405) || |
| 15 | (error instanceof Error && error.message.includes("401")) || |
| 16 | (error instanceof Error && error.message.includes("405")) || |
| 17 | (error instanceof Error && error.message.includes("Unauthorized")) |
| 18 | ); |
| 19 | } |