Transport Config • Rust AI Agent SDK

TransportConfig: Transport configuration for MCP.

TransportConfig

Defined in the MCP module.

Rust AI Agent SDK

Transport configuration for MCP.

Fields

NameTypeDescription
transport_typeTransportTypeTransport type
commandOption<String>Command for stdio transport
argsVec<String>Arguments for stdio transport
urlOption<String>URL for HTTP/WebSocket transport
headersHashMap<StringHeaders for HTTP transport
envHashMap<StringEnvironment variables
timeoutu32Connection timeout in seconds

Methods

stdio

rust
fn stdio(command: impl Into<String>, args: &[&str]) -> Self

Create a new stdio transport config

Parameters:

NameType
commandimpl Into&lt;String&gt;
args&[&str]

http

rust
fn http(url: impl Into<String>) -> Self

Create a new HTTP transport config

Parameters:

NameType
urlimpl Into&lt;String&gt;

websocket

rust
fn websocket(url: impl Into<String>) -> Self

Create a new WebSocket transport config

Parameters:

NameType
urlimpl Into&lt;String&gt;

env

rust
fn env(mut self, key: impl Into<String>, value: impl Into<String>) -> Self

Add an environment variable

Parameters:

NameType
keyimpl Into&lt;String&gt;
valueimpl Into&lt;String&gt;

header

rust
fn header(mut self, key: impl Into<String>, value: impl Into<String>) -> Self

Add a header

Parameters:

NameType
keyimpl Into&lt;String&gt;
valueimpl Into&lt;String&gt;

timeout

rust
fn timeout(mut self, timeout: u32) -> Self

Set timeout

Parameters:

NameType
timeoutu32

Source

View on GitHub

praisonai/src/mcp/mod.rs at line 47


Related Documentation