MCPcopy
hub / github.com/continuedev/continue / constructSseTransport

Method constructSseTransport

core/context/mcp/MCPConnection.ts:500–531  ·  view source on GitHub ↗
(
    options: InternalSseMcpOptions,
  )

Source from the content-addressed store, hash-verified

498 }
499
500 private constructSseTransport(
501 options: InternalSseMcpOptions,
502 ): SSEClientTransport {
503 const sseAgent =
504 options.requestOptions?.verifySsl === false
505 ? new HttpsAgent({ rejectUnauthorized: false })
506 : undefined;
507
508 // Merge apiKey into headers if provided
509 const headers = {
510 ...options.requestOptions?.headers,
511 ...(options.apiKey && { Authorization: `Bearer ${options.apiKey}` }),
512 };
513
514 return new SSEClientTransport(new URL(options.url), {
515 eventSourceInit: {
516 fetch: (input, init) =>
517 fetch(input, {
518 ...init,
519 headers: {
520 ...init?.headers,
521 ...headers,
522 },
523 ...(sseAgent && { agent: sseAgent }),
524 }),
525 },
526 requestInit: {
527 headers,
528 ...(sseAgent && { agent: sseAgent }),
529 },
530 });
531 }
532
533 private constructHttpTransport(
534 options: InternalStreamableHttpMcpOptions,

Callers 1

connectClientMethod · 0.95

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected