#ipc #transport #mcp #unix-socket

turbomcp-unix

Unix domain socket transport implementation for the TurboMCP SDK

28 releases (stable)

Uses new Rust 2024

new 3.1.4 May 9, 2026
3.1.3 May 7, 2026
3.1.2 Apr 27, 2026
3.0.10 Mar 27, 2026
3.0.0-beta.5 Feb 24, 2026

#63 in #unix-socket

31 downloads per month
Used in 8 crates (via turbomcp-transport)

MIT license

1MB
17K SLoC

turbomcp-unix

Unix domain socket transport implementation for the TurboMCP SDK.

Overview

This crate provides Unix domain socket transport 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
  • Security: Configurable file permissions (default 0o600)

Installation

[dependencies]
turbomcp-unix = "3.1"

Or use through the main transport crate:

[dependencies]
turbomcp-transport = { version = "3.1.4", features = ["unix"] }

Quick Start

Server 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_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-traits provides core abstractions
  • Individual Transports: Each transport (stdio, http, websocket, tcp, unix) is a separate crate
  • Backward Compatibility: turbomcp-transport re-exports all transports

License

MIT

Dependencies

~17–26MB
~360K SLoC