class

MCP::Transports::Stdio

Inherits MCP::Transport < Reference < Object

STDIO transport for communicating with MCP servers via stdin/stdout.

This transport spawns the MCP server as a subprocess and communicates using line-delimited JSON-RPC messages over stdin/stdout.

Constructors

new(command : String, args : Array(String) = [] of String)
Source

Instance methods

connect

Establish a connection to the MCP server.

Source
connected?

Check if the transport is currently connected.

Source
disconnect

Close the connection to the MCP server.

Source
get_stderr

Get the stderr output from the server process, if available.

Source
receive_message

Receive a message from the MCP server. Returns nil if no message is available.

Source
send_message(message : String) : Nil

Send a message to the MCP server.

Source