MCPEx.Transport.Stdio (MCPEx v0.1.0)
Implementation of the MCP transport over standard I/O.
This transport spawns an external process and communicates with it over standard input/output pipes. It handles encoding/decoding of messages and manages the lifecycle of the external process.
Summary
Functions
Returns a specification to start this module under a supervisor.
Closes the transport connection.
Sends a message to the process.
Starts a new stdio transport as a linked process.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec close(pid()) :: :ok
Closes the transport connection.
Returns
:ok
- The connection was closed successfully
Sends a message to the process.
Parameters
message
- The message to send
Returns
:ok
- The message was sent successfully{:error, reason}
- Failed to send the message
Starts a new stdio transport as a linked process.
Options
:command
- The command to execute (required):args
- List of command arguments (default: []):cd
- Working directory for the command (default: current directory):env
- Environment variables for the command (default: current environment)
Returns
{:ok, pid}
- The transport was started successfully{:error, reason}
- Failed to start the transport