capacitor-cors-bypass-enhanced
Version:
Enhanced Capacitor plugin for CORS bypass with HTTP/2, HTTP/3, gRPC, GraphQL, file operations, and advanced networking features. Modular TypeScript definitions for better maintainability.
58 lines • 1.62 kB
TypeScript
/**
* StreamableHTTP Transport for MCP (Web Implementation)
* Implements the new single-endpoint transport protocol
*
* @see https://modelcontextprotocol.io/specification/2025-03-26/basic/transports
*/
export interface StreamableHTTPCallback {
onMessage: (message: any) => void;
onError: (error: string) => void;
onConnectionStateChange: (state: string) => void;
}
export declare class StreamableHTTPTransport {
private endpointUrl;
private callback;
private resumable;
private sessionId;
private lastSequence;
private abortController;
private currentReader;
constructor(endpointUrl: string, callback: StreamableHTTPCallback, resumable?: boolean, sessionId?: string, lastSequence?: number);
/**
* Send a JSON-RPC message to the server
*/
sendMessage(message: any, expectStream?: boolean): Promise<void>;
/**
* Open a GET stream to listen for server-initiated messages
*/
openListenStream(): Promise<void>;
/**
* Handle SSE stream response
*/
private handleSSEStream;
/**
* Process an SSE event data
*/
private processSSEEvent;
/**
* Handle single JSON response
*/
private handleJSONResponse;
/**
* Close the transport and cancel any active streams
*/
close(): void;
/**
* Get the current session ID
*/
getSessionId(): string | null;
/**
* Get the last sequence number
*/
getLastSequence(): number;
/**
* Check if transport is resumable
*/
isResumable(): boolean;
}
//# sourceMappingURL=streamable-http.d.ts.map