import type { MCPHttpSseTransportConfig, MCPJsonRpcMessage, MCPTransport, MCPTransportSendOptions } from '../../types/connector/index.js'; import { type Logger } from '../../utils/logger.js'; export declare class HttpSseTransport implements MCPTransport { private readonly config; private messageHandlers; private closeHandlers; private errorHandlers; private connected; private abortController; private generation; private activeSends; private sseUrl; private postUrl; private log; private readonly timeoutMs; /** Defaults to the ambient global `fetch`; never read again once captured. */ private readonly fetchImpl; constructor(config: MCPHttpSseTransportConfig, log?: Logger); connect(): Promise; close(): Promise; /** * Drop every registered handler. * * `onMessage`/`onClose`/`onError` append, and `MCPClient.connect()` calls * all three every time — and is reachable again after `disconnect()`. So * without this each reconnect duplicated the set, and after n cycles one * inbound message dispatched to n handlers, n-1 of them closures over dead * sessions that kept their old client state alive. */ private clearHandlers; send(message: MCPJsonRpcMessage, options?: MCPTransportSendOptions): Promise; onMessage(handler: (message: MCPJsonRpcMessage) => void): void; onClose(handler: () => void): void; onError(handler: (error: Error) => void): void; isConnected(): boolean; /** * `extra` comes from `MCPTransportSendOptions.headers` — the client's * per-send authority — and is merged over this transport's own static * config headers so a caller's value wins on a collision. See * {@link StreamableHttpTransport}'s method of the same name, which this * mirrors; the HTTP-SSE POST had no equivalent merge until now, so a * per-request header or bearer token silently never reached the wire. */ private buildHeaders; private beginSend; private assertCurrent; private isCurrent; private startSSE; private listenSSE; } //# sourceMappingURL=http-sse.d.ts.map