Expand description
§TurboMCP Unix Domain Socket Transport
Unix domain socket transport implementation for the TurboMCP SDK.
This crate provides inter-process communication over Unix domain sockets with:
- Server Mode: Accept multiple client connections with automatic handling
- Client Mode: Connect to a Unix socket server
- Bidirectional Communication: Full-duplex message exchange
- Backpressure Handling: Bounded channels prevent memory exhaustion
- Graceful Shutdown: Clean task termination and socket cleanup
- Message Framing: Uses LinesCodec for reliable newline-delimited JSON
§Quick Start
§Server Mode
ⓘ
use turbomcp_unix::{UnixTransport, UnixTransportBuilder};
use turbomcp_transport_traits::Transport;
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let transport = UnixTransportBuilder::new_server()
.socket_path("/tmp/my-mcp.sock")
.permissions(0o600)
.build();
transport.connect().await?; // Starts listening
Ok(())
}§Client Mode
ⓘ
use turbomcp_unix::{UnixTransport, UnixTransportBuilder};
use turbomcp_transport_traits::Transport;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let transport = UnixTransportBuilder::new_client()
.socket_path("/tmp/my-mcp.sock")
.build();
transport.connect().await?;
Ok(())
}§v3.0 Modular Architecture
This crate is part of TurboMCP v3.0’s modular transport architecture:
- Foundation:
turbomcp-transport-traitsprovides core abstractions - Individual Transports: Each transport (stdio, http, websocket, tcp, unix) is a separate crate
- Backward Compatibility:
turbomcp-transportre-exports all transports
Structs§
- Atomic
Metrics - A lock-free, atomic structure for high-performance metrics updates.
- Transport
Capabilities - Describes the capabilities of a transport implementation.
- Transport
Message - A wrapper for a message being sent or received over a transport.
- Transport
Metrics - A serializable snapshot of a transport’s performance metrics.
- Unix
Config - Unix socket transport configuration
- Unix
Transport - Unix domain socket transport implementation with integrated security
- Unix
Transport Builder - Unix socket transport builder
Enums§
- Transport
Error - Represents errors that can occur during transport operations.
- Transport
State - Represents the current state of a transport connection.
- Transport
Type - Enumerates the types of transports supported by the system.
Traits§
- Transport
- The core trait for all transport implementations.
Type Aliases§
- Transport
Result - A specialized
Resulttype for transport operations.