pub struct McpServerConfig {
pub name: String,
pub timeout: Duration,
pub startup_timeout: Duration,
pub required: bool,
pub enabled_tools: Vec<String>,
pub transport: McpTransport,
}Expand description
Transport-agnostic config for a single MCP server. The variant determines whether we POST to a URL or spawn a child process.
Fields§
§name: String§timeout: DurationPer-call tool invocation timeout (maps to tool_timeout_sec).
Default: 30 s for backwards-compat; bootstrap sets it to
the MCP-spec default of 60 s via with_timeout.
startup_timeout: DurationTime allowed for initialize + tools/list handshake.
Default: 10 s (OpenAI Codex default).
required: boolIf true, a failure to initialise aborts session boot.
Default: false (unreachable servers are silently skipped).
enabled_tools: Vec<String>Tool allowlist (short names, no {server}__ prefix).
Empty = all tools exposed.
transport: McpTransportImplementations§
Source§impl McpServerConfig
impl McpServerConfig
Sourcepub fn new(name: impl Into<String>, url: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, url: impl Into<String>) -> Self
HTTP-transport convenience constructor. Same name as the v1
new() for source compat.
pub fn http(name: impl Into<String>, url: impl Into<String>) -> Self
Sourcepub fn stdio(
name: impl Into<String>,
command: impl Into<String>,
args: Vec<String>,
) -> Self
pub fn stdio( name: impl Into<String>, command: impl Into<String>, args: Vec<String>, ) -> Self
stdio-transport convenience constructor. env / working_dir
default to empty; use the struct literal form or chain setters
if you need them.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Per-call tool invocation timeout.
Sourcepub fn with_startup_timeout(self, timeout: Duration) -> Self
pub fn with_startup_timeout(self, timeout: Duration) -> Self
Time allowed for initialize + tools/list handshake.
Sourcepub fn with_required(self, required: bool) -> Self
pub fn with_required(self, required: bool) -> Self
If true, init failure aborts session boot.
Sourcepub fn with_enabled_tools(self, tools: Vec<String>) -> Self
pub fn with_enabled_tools(self, tools: Vec<String>) -> Self
Tool allowlist (short names without {server}__ prefix).
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a static HTTP request header (HTTP transport only).
pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_working_dir(self, dir: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for McpServerConfig
impl Clone for McpServerConfig
Source§fn clone(&self) -> McpServerConfig
fn clone(&self) -> McpServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more