/** * MCP Transport — JSON-RPC over stdio with Content-Length framing. * * Implements the standard LSP/MCP wire protocol: * Content-Length: \r\n\r\n * * The transport handles: * - Spawning a child process * - Framing outbound JSON-RPC messages * - Parsing inbound Content-Length framed responses * - Routing responses to pending request promises * - Forwarding notifications to a handler */ import type { JsonRpcResponse, JsonRpcNotification } from "./types.js"; export type NotificationHandler = (notification: JsonRpcNotification) => void; export interface StdioTransportConfig { command: string; args?: string[]; env?: Record; cwd?: string; onNotification?: NotificationHandler; /** Timeout for spawning the process (ms, default: 10000) */ spawnTimeout?: number; } export declare class StdioTransport { private config; private process; private nextId; private pending; private buffer; private onNotification; private connected; private _startPromise; constructor(config: StdioTransportConfig); /** * Spawn the child process and start reading stdout. * Throws if the process fails to spawn within the timeout. */ start(): Promise; private _doStart; /** * Stop the transport and kill the child process. */ stop(): void; isConnected(): boolean; /** * Send a JSON-RPC request and wait for the response. * Times out after `timeoutMs` (default: 30s). */ send(method: string, params?: Record, timeoutMs?: number): Promise; /** * Send a JSON-RPC notification (no response expected). */ notify(method: string, params?: Record): void; private static readonly MAX_BUFFER_SIZE; private processBuffer; private handleMessage; } //# sourceMappingURL=transport.d.ts.map