Browse Source

add sseOptions

(cherry picked from commit f9a1cd0b524450bd5f342261407cef7d0f11b9e8)
aheizi 9 tháng trước cách đây
mục cha
commit
5a491672c4
1 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 7 4
      src/services/mcp/McpHub.ts

+ 7 - 4
src/services/mcp/McpHub.ts

@@ -239,14 +239,17 @@ export class McpHub {
 			} else {
 				// SSE connection
 				const sseOptions = {
-					headers: config.headers,
-					https: {
-						rejectUnauthorized: false, // Allow self-signed certificates if needed
+					requestInit: {
+						headers: config.headers,
+						// Allow self-signed certificates if needed
+						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))
+				transport = new SSEClientTransport(new URL(config.url), sseOptions)
 
 				// Set up SSE specific error handling
 				transport.onerror = async (error) => {