import { EventEmitter } from 'node:events';
/**
 * JSON-RPC message format used by MCP
 */
export interface JsonRpcMessage {
    jsonrpc: '2.0';
    id?: number | string;
    method?: string;
    params?: unknown;
    result?: unknown;
    error?: {
        code: number;
        message: string;
        data?: unknown;
    };
}
/**
 * Transport layer for communicating with MCP servers
 */
export declare class StdioTransport extends EventEmitter {
    private readonly config;
    private process;
    private messageId;
    private pendingRequests;
    private buffer;
    private decoder;
    private stdoutDataHandler;
    private exitHandler;
    private errorHandler;
    constructor(config: {
        command: string;
        args?: string[];
        env?: Record<string, string>;
    });
    /**
     * Start the MCP server process
     */
    start(): Promise<void>;
    /**
     * Stop the MCP server process and clean up event listeners
     */
    stop(): Promise<void>;
    /**
     * Send a JSON-RPC request and wait for response
     */
    sendRequest(method: string, params?: unknown): Promise<unknown>;
    /**
     * Send a JSON-RPC notification (no response expected)
     */
    sendNotification(method: string, params?: unknown): void;
    /**
     * Send a raw message to the MCP server
     */
    private sendMessage;
    /**
     * Handle incoming data from the MCP server
     * Supports both Content-Length header framing and newline-delimited messages
     */
    private handleData;
    /**
     * Process a parsed JSON-RPC message
     */
    private processMessage;
    /**
     * Check if the process is running
     */
    isRunning(): boolean;
}
//# sourceMappingURL=transport.d.ts.map