rust-mcp-transport 0.6.0

Transport implementations for the MCP (Model Context Protocol) within the rust-mcp-sdk ecosystem, enabling asynchronous data exchange and efficient message handling between MCP clients and servers.
Documentation

rust-mcp-transport.

rust-mcp-transport is a part of the rust-mcp-sdk ecosystem, offering transport implementations for the MCP (Model Context Protocol). It enables asynchronous data exchange and efficient MCP message handling between MCP Clients and Servers.

Usage Example

For MCP Server

use rust_mcp_transport::{StdioTransport, TransportOptions};

// create a stdio transport to be used in a MCP Server
let transport = StdioTransport::new(TransportOptions { timeout: 60_000 })?;

Refer to the Hello World MCP Server example for a complete demonstration.

For MCP Client

use rust_mcp_transport::{StdioTransport, TransportOptions};

// create a stdio transport that launches `server-everything` MCP Server
let transport = StdioTransport::create_with_server_launch(
        "npx",
        vec!["-y".to_string(), "@modelcontextprotocol/server-everything"],
        None,
        TransportOptions { timeout: 60_000 }
    )?;

With environment variables:

use rust_mcp_transport::{StdioTransport, TransportOptions};

// environment variables will be available to the MCP server at launch time
let environment_value = HashMap::from([(
       "API_KEY".to_string(),
       "A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6".to_string(),
   )]);

// configure an arbitrary MCP Server to launch with argument and environment variables
let transport = StdioTransport::create_with_server_launch(
    "your-mcp-server",
    vec!["argument".to_string()],
    Some(environment_value),
    TransportOptions::default(),
)?;

Refer to the Simple MCP Client example for a complete demonstration.


Check out rust-mcp-sdk , a high-performance, asynchronous toolkit for building MCP servers and clients. Focus on your app's logic while rust-mcp-sdk takes care of the rest!