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
| Name | Type | Description |
|---|---|---|
transport_type | TransportType | Transport type |
command | Option<String> | Command for stdio transport |
args | Vec<String> | Arguments for stdio transport |
url | Option<String> | URL for HTTP/WebSocket transport |
headers | HashMap<String | Headers for HTTP transport |
env | HashMap<String | Environment variables |
timeout | u32 | Connection timeout in seconds |
Methods
stdio
fn stdio(command: impl Into<String>, args: &[&str]) -> SelfCreate a new stdio transport config
Parameters:
| Name | Type |
|---|---|
command | impl Into<String> |
args | &[&str] |
http
fn http(url: impl Into<String>) -> SelfCreate a new HTTP transport config
Parameters:
| Name | Type |
|---|---|
url | impl Into<String> |
websocket
fn websocket(url: impl Into<String>) -> SelfCreate a new WebSocket transport config
Parameters:
| Name | Type |
|---|---|
url | impl Into<String> |
env
fn env(mut self, key: impl Into<String>, value: impl Into<String>) -> SelfAdd an environment variable
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
value | impl Into<String> |
header
fn header(mut self, key: impl Into<String>, value: impl Into<String>) -> SelfAdd a header
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
value | impl Into<String> |
timeout
fn timeout(mut self, timeout: u32) -> SelfSet timeout
Parameters:
| Name | Type |
|---|---|
timeout | u32 |
Source
View on GitHubpraisonai/src/mcp/mod.rs at line 47