{"record":{"id":"64c8c3939505a859","repo":"Kong/insomnia","slug":"mcp-connection-aborted","errorCode":null,"errorMessage":"MCP Connection aborted","messagePattern":"MCP Connection aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/main/mcp/oauth-client-provider.ts","lineNumber":171,"sourceCode":"      tokenPrefix: tokens.token_type,\n    });\n  }\n  // add state parameter to authorization url if present in authentication\n  async state() {\n    if ('state' in this.authentication && this.authentication.state) {\n      return this.authentication.state;\n    }\n    return '';\n  }\n  saveResourceMetadataUrl(url: URL | undefined) {\n    this._resourceMetadataUrl = url;\n  }\n  get resourceMetadataUrl() {\n    return this._resourceMetadataUrl;\n  }\n  async redirectToAuthorization(authorizationUrl: URL) {\n    if (this.context.abortController.signal.aborted) {\n      throw new Error('MCP Connection aborted');\n    }\n    const { relayUrl, decryptOAuthResult } = encryptOAuthUrl(authorizationUrl.toString());\n    BrowserWindow.getAllWindows().forEach(window => {\n      window.webContents.send('show-oauth-authorization-modal', relayUrl);\n    });\n    const shouldOpenDefaultBrowser =\n      'grantType' in this.authentication && this.authentication.grantType === 'mcp_auth_flow'\n        ? !this.authentication.launchBrowserManually\n        : true;\n    const redirectedResult = await authorizeUserInDefaultBrowser({\n      url: relayUrl,\n      openDefaultBrowser: shouldOpenDefaultBrowser,\n    });\n    const redirectedTo = decryptOAuthResult(redirectedResult);\n    const redirectParams = Object.fromEntries(new URL(redirectedTo).searchParams);\n    const { code: authorizationCode, error, error_description, error_uri } = redirectParams;\n    if (error) {\n      throw new Error(JSON.stringify({ error, error_description, error_uri }));","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/main/mcp/oauth-client-provider.ts#L153-L189","documentation":"Error \"MCP Connection aborted\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/main/mcp/oauth-client-provider.ts:171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}