(error: Error)
| 191 | * We check both signals to avoid false positives from generic 404s (wrong URL, server gone, etc.). |
| 192 | */ |
| 193 | export function isMcpSessionExpiredError(error: Error): boolean { |
| 194 | const httpStatus = |
| 195 | 'code' in error ? (error as Error & { code?: number }).code : undefined |
| 196 | if (httpStatus !== 404) { |
| 197 | return false |
| 198 | } |
| 199 | // The SDK embeds the response body text in the error message. |
| 200 | // MCP servers return: {"error":{"code":-32001,"message":"Session not found"},...} |
| 201 | // Check for the JSON-RPC error code to distinguish from generic web server 404s. |
| 202 | return ( |
| 203 | error.message.includes('"code":-32001') || |
| 204 | error.message.includes('"code": -32001') |
| 205 | ) |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Default timeout for MCP tool calls (effectively infinite - ~27.8 hours). |
no outgoing calls
no test coverage detected