Skip to main content

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

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

fn http(url: impl Into<String>) -> Self
Create a new HTTP transport config Parameters:
NameType
urlimpl Into&lt;String&gt;

websocket

fn websocket(url: impl Into<String>) -> Self
Create a new WebSocket transport config Parameters:
NameType
urlimpl Into&lt;String&gt;

env

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;
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

fn timeout(mut self, timeout: u32) -> Self
Set timeout Parameters:
NameType
timeoutu32

Source

View on GitHub

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