stdio.d.ts 991 B

12345678910111213141516171819202122232425262728
  1. import { Readable, Writable } from 'node:stream';
  2. import { JSONRPCMessage } from '../types.js';
  3. import { Transport } from '../shared/transport.js';
  4. /**
  5. * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
  6. *
  7. * This transport is only available in Node.js environments.
  8. */
  9. export declare class StdioServerTransport implements Transport {
  10. private _stdin;
  11. private _stdout;
  12. private _readBuffer;
  13. private _started;
  14. constructor(_stdin?: Readable, _stdout?: Writable);
  15. onclose?: () => void;
  16. onerror?: (error: Error) => void;
  17. onmessage?: (message: JSONRPCMessage) => void;
  18. _ondata: (chunk: Buffer) => void;
  19. _onerror: (error: Error) => void;
  20. /**
  21. * Starts listening for messages on stdin.
  22. */
  23. start(): Promise<void>;
  24. private processReadBuffer;
  25. close(): Promise<void>;
  26. send(message: JSONRPCMessage): Promise<void>;
  27. }
  28. //# sourceMappingURL=stdio.d.ts.map