add sseOptions

(cherry picked from commit f9a1cd0b52)
This commit is contained in:
aheizi 2025-03-10 12:36:46 +08:00
parent a77be3feb7
commit 5a491672c4

View file

@ -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) => {