Expand description
§TurboMCP Transport Traits
Core transport traits and types for the TurboMCP Model Context Protocol SDK. This crate provides the foundational abstractions that all transport implementations depend on.
§Overview
This crate defines:
- Traits:
Transport,BidirectionalTransport,StreamingTransport,TransportFactory - Types:
TransportType,TransportState,TransportCapabilities,TransportMessage - Errors:
TransportError,TransportResult - Config:
LimitsConfig,TimeoutConfig,TlsConfig - Metrics:
TransportMetrics,AtomicMetrics
§Usage
Transport implementations should depend on this crate and implement the Transport trait:
ⓘ
use turbomcp_transport_traits::{Transport, TransportResult, TransportMessage};
struct MyTransport { /* ... */ }
impl Transport for MyTransport {
fn transport_type(&self) -> TransportType { /* ... */ }
// ... other trait methods
}Structs§
- Atomic
Metrics - A lock-free, atomic structure for high-performance metrics updates.
- Connection
State - Connection state for bidirectional communication
- Correlation
Context - Correlation context for request-response patterns
- Limits
Config - Configuration for request and response size limits.
- Timeout
Config - Configuration for request and operation timeouts.
- TlsConfig
- TLS/HTTPS configuration for secure transport connections.
- Transport
Capabilities - Describes the capabilities of a transport implementation.
- Transport
Config - Configuration for a transport instance.
- Transport
Event Emitter - An emitter for broadcasting
TransportEvents to listeners. - Transport
Message - A wrapper for a message being sent or received over a transport.
- Transport
Message Metadata - Metadata associated with a
TransportMessage. - Transport
Metrics - A serializable snapshot of a transport’s performance metrics.
Enums§
- Message
Direction - Message direction in the transport layer
- TlsVersion
- TLS protocol version specification.
- Transport
Error - Represents errors that can occur during transport operations.
- Transport
Event - Represents events that occur within a transport’s lifecycle.
- Transport
State - Represents the current state of a transport connection.
- Transport
Type - Enumerates the types of transports supported by the system.
Traits§
- Bidirectional
Transport - A trait for transports that support full-duplex, bidirectional communication.
- Streaming
Transport - A trait for transports that support streaming data.
- Transport
- The core trait for all transport implementations.
- Transport
Factory - A factory for creating instances of a specific transport type.
Functions§
- validate_
request_ size - Validates that a request message size does not exceed the configured limit.
- validate_
response_ size - Validates that a response message size does not exceed the configured limit.
Type Aliases§
- Transport
Result - A specialized
Resulttype for transport operations.