import type { MCPJsonRpcMessage, MCPStdioTransportConfig, MCPTransport, MCPTransportSendOptions } from '../../types/connector/index.js'; import { type Logger } from '../../utils/logger.js'; /** * What the child is handed: plumbing, then the named inheritances, then the * literal values. * * Later wins, and the order is the precedence an operator would guess: a * literal `env` entry overrides an inherited one, and both override the base. * Exported for the tests, which assert on the ENV rather than on the spawn — * a test that only checked the config was accepted would have passed against * the version this replaces. */ export declare function buildChildEnv(config: Pick, source?: NodeJS.ProcessEnv): Record; export declare class StdioTransport implements MCPTransport { private readonly config; private process; private messageHandlers; private closeHandlers; private errorHandlers; private connected; /** The response channel ended for this process generation. */ private retired; /** Prevents a late event from an old child retiring its replacement. */ private generation; /** True between kill and the process's own `close` event. */ private exitPending; private buffer; private log; constructor(config: MCPStdioTransportConfig, 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; /** * Publish one terminal result for the current response channel. * * A child may close stdout and keep running. That is just as terminal for * JSON-RPC as process exit: no pending or future request can receive a * response. Keeping the child handle is intentional; `close()` still owns * and reaps that process after the protocol session has been retired. */ private retire; send(message: MCPJsonRpcMessage, options?: MCPTransportSendOptions): Promise; onMessage(handler: (message: MCPJsonRpcMessage) => void): void; onClose(handler: () => void): void; onError(handler: (error: Error) => void): void; isConnected(): boolean; private processBuffer; } //# sourceMappingURL=stdio.d.ts.map