My agentic slop goes here. Not intended for anyone else!
at main 1.4 kB view raw
1(** Stdio transport implementation for MCP *) 2 3(** Parameters for creating a stdio transport *) 4type params = { 5 command : string; 6 (** The command to execute (executable path or name in PATH) *) 7 8 args : string list; 9 (** Command-line arguments to pass to the command *) 10 11 env : (string * string) list option; 12 (** Optional environment variables to set. If [None], inherits parent environment. 13 If [Some vars], these are ADDED to essential preserved variables (HOME, PATH, etc.) *) 14 15 max_buffer_size : int option; 16 (** Maximum buffer size for reading from stdout. Defaults to 1MB if [None] *) 17} 18 19(** [create ~sw ~process_mgr params] creates a new stdio transport by spawning 20 a subprocess with the given parameters. 21 22 The subprocess communicates via line-delimited JSON on stdin/stdout: 23 - Each message is a single JSON object on one line 24 - Lines are terminated with newline ('\n') 25 - The transport handles encoding/decoding automatically 26 27 @param sw The Eio switch that manages the subprocess lifetime 28 @param process_mgr The Eio process manager for spawning subprocesses 29 @param params Configuration parameters for the subprocess 30 @raise Transport.Connection_error if subprocess spawning fails *) 31val create : 32 sw:Eio.Switch.t -> 33 process_mgr:_ Eio.Process.mgr -> 34 params -> 35 Transport.t 36 37(** Exception raised when subprocess spawning fails *) 38exception Process_spawn_error of string