class

MCP::Transport

Inherits Reference < Object

Abstract base class defining the transport contract for MCP communication.

Transports handle the low-level communication with MCP servers. Implementations can use STDIO, HTTP, WebSocket, or other protocols.

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
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
send_progress(token : String, progress : Int32, total : Int32, message : String | Nil = nil) : Nil

Send a progress update for a long-running operation. This is an optional feature - default implementation does nothing.

Source