/** * stdio transport: newline-delimited JSON-RPC messages on stdin/stdout, logs on * stderr. Nothing but protocol messages is ever written to `stdout`. * @module mcp/stdio */ /** * Split a byte stream into lines without ever buffering more than * `maxBytes` of one line: an over-long line is discarded up to its newline * and reported once through `onOverflow`. */ export declare class LineSplitter { #private; maxBytes: number; onLine: (line: string) => void; onOverflow: () => void; /** @type {Buffer[]} */ parts: Buffer[]; size: number; discarding: boolean; /** * @param {number} maxBytes * @param {(line: string) => void} onLine * @param {() => void} onOverflow */ constructor(maxBytes: number, onLine: (line: string) => void, onOverflow: () => void); /** @param {Buffer} chunk */ push(chunk: Buffer): void; /** Flush a final line that has no trailing newline. */ end(): void; } export type StdioStreams = { stdin: NodeJS.ReadableStream; stdout: NodeJS.WritableStream; stderr?: NodeJS.WritableStream; /** * Stop reading and shut down (as if the input had ended). */ signal?: AbortSignal; }; /** * @typedef {object} StdioStreams * @property {NodeJS.ReadableStream} stdin * @property {NodeJS.WritableStream} stdout * @property {NodeJS.WritableStream} [stderr] * @property {AbortSignal} [signal] Stop reading and shut down (as if the input had ended). */ /** * Serve `server` over the given streams until the input ends. Requests are * handled concurrently (so a cancellation can overtake a running call); the * returned promise resolves when the input is closed and every response has * been written. The server is closed at that point. * @param {import("./server.mjs").McpServer} server * @param {StdioStreams} streams * @returns {Promise} */ export declare function serveStdio(server: import("./server.mjs").McpServer, { stdin, stdout, stderr, signal }: StdioStreams): Promise;