Trait TransportDispatcher

Source
pub trait TransportDispatcher<R, S, M, OR, OM>: Transport<R, S, M, OR, OM> + McpDispatch<R, OR, M, OM>
where R: Clone + Send + Sync + DeserializeOwned + 'static, S: Clone + Send + Sync + Serialize + 'static, M: Clone + Send + Sync + DeserializeOwned + 'static, OR: Clone + Send + Sync + Serialize + 'static, OM: Clone + Send + Sync + DeserializeOwned + 'static,
{ }
Expand description

A composite trait that combines both transport and dispatch capabilities for the MCP protocol.

TransportDispatcher unifies the functionality of Transport and McpDispatch, allowing implementors to both manage the transport layer and handle message dispatch logic in a single abstraction.

This trait applies to components responsible for the following operations:

  • Handle low-level I/O (stream management, payload parsing, lifecycle control)
  • Dispatch and route messages, potentially awaiting or sending responses

§Supertraits

§Associated Types

  • R: The raw message type expected to be received. Must be deserializable.
  • S: The message type sent over the transport (often serialized directly to wire).
  • M: The internal message type used within the dispatcher.
  • OR: The outbound response type returned from processing a received message.
  • OM: The outbound message type submitted by clients or application code.

Implementors§