From 78b3130c93d5deae5f188ad580a5fe647a2363b2 Mon Sep 17 00:00:00 2001 From: aheizi Date: Wed, 12 Mar 2025 01:11:22 +0800 Subject: [PATCH] remove rejectUnauthorized (cherry picked from commit 5e788fc5f1de49ea7972f4d803d24c0c6544ed79) --- src/services/mcp/McpHub.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/services/mcp/McpHub.ts b/src/services/mcp/McpHub.ts index 4daa2839ba..95a2ca9a86 100644 --- a/src/services/mcp/McpHub.ts +++ b/src/services/mcp/McpHub.ts @@ -167,16 +167,6 @@ export class McpHub { } } - private isLocalhost(hostname: string): boolean { - return ( - hostname === "localhost" || - hostname === "127.0.0.1" || - hostname === "::1" || - hostname.endsWith(".localhost") || - hostname.endsWith(".local") - ) - } - private async connectToServer(name: string, config: z.infer): Promise { // Remove existing connection if it exists await this.deleteConnection(name) @@ -251,15 +241,8 @@ export class McpHub { const sseOptions = { requestInit: { headers: config.headers, - // Only disable certificate validation for local development connections - ...(this.isLocalhost(new URL(config.url).hostname) && { - agent: new (require("https").Agent)({ - rejectUnauthorized: false, - }), - }), }, } - // @ts-ignore - EventSource types are not fully compatible global.EventSource = EventSource transport = new SSEClientTransport(new URL(config.url), sseOptions)