pub struct McpServerConfig {Show 15 fields
pub command: Option<String>,
pub args: Vec<String>,
pub env: HashMap<String, String>,
pub url: Option<String>,
pub transport: Option<String>,
pub headers: HashMap<String, String>,
pub auth: Option<McpAuthConfig>,
pub connect_timeout: Option<u64>,
pub execute_timeout: Option<u64>,
pub read_timeout: Option<u64>,
pub disabled: bool,
pub enabled: bool,
pub required: bool,
pub enabled_tools: Vec<String>,
pub disabled_tools: Vec<String>,
}Expand description
Configuration for a single MCP server
Fields§
§command: Option<String>§args: Vec<String>§env: HashMap<String, String>§url: Option<String>§transport: Option<String>Explicit transport selector (stdio | sse | http). When omitted,
the transport is inferred: command ⇒ stdio, url ⇒ sse. Set to
http to use the 2025 Streamable HTTP transport. Accepts the type
alias for compatibility with common mcp.json snippets.
headers: HashMap<String, String>Extra HTTP headers for remote transports (sse / http). Values may
use ${ENV_VAR} placeholders — prefer env indirection over plaintext
secrets in mcp.json.
auth: Option<McpAuthConfig>Shorthand auth (type: bearer | apiKey). Merged before headers;
explicit headers entries override auth defaults.
connect_timeout: Option<u64>§execute_timeout: Option<u64>§read_timeout: Option<u64>§disabled: bool§enabled: bool§required: bool§enabled_tools: Vec<String>§disabled_tools: Vec<String>Implementations§
Source§impl McpServerConfig
impl McpServerConfig
Sourcepub fn resolve_http_headers(
&self,
server_name: &str,
) -> Result<HashMap<String, String>>
pub fn resolve_http_headers( &self, server_name: &str, ) -> Result<HashMap<String, String>>
Resolve HTTP headers for remote transports: explicit headers, plus
shorthand auth, with ${VAR} / $VAR env substitution.
Sourcepub fn redacted_for_display(&self) -> Self
pub fn redacted_for_display(&self) -> Self
Return a copy safe to expose over HTTP APIs (secrets redacted).
Source§impl McpServerConfig
impl McpServerConfig
pub fn effective_connect_timeout(&self, global: &McpTimeouts) -> u64
pub fn effective_execute_timeout(&self, global: &McpTimeouts) -> u64
pub fn effective_read_timeout(&self, global: &McpTimeouts) -> u64
pub fn is_enabled(&self) -> bool
Sourcepub fn transport_kind(&self) -> Result<McpTransportKind>
pub fn transport_kind(&self) -> Result<McpTransportKind>
Resolve the effective transport for this server.
Honors the explicit transport/type field when present, otherwise
infers from command (stdio) vs url (SSE, preserving pre-Streamable
behavior). Returns an error when the config is ambiguous or incomplete.
pub fn is_tool_enabled(&self, tool_name: &str) -> bool
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 moreSource§impl Debug for McpServerConfig
impl Debug for McpServerConfig
Source§impl<'de> Deserialize<'de> for McpServerConfig
impl<'de> Deserialize<'de> for McpServerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for McpServerConfig
Source§impl PartialEq for McpServerConfig
impl PartialEq for McpServerConfig
Source§fn eq(&self, other: &McpServerConfig) -> bool
fn eq(&self, other: &McpServerConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for McpServerConfig
impl Serialize for McpServerConfig
impl StructuralPartialEq for McpServerConfig
Auto Trait Implementations§
impl Freeze for McpServerConfig
impl RefUnwindSafe for McpServerConfig
impl Send for McpServerConfig
impl Sync for McpServerConfig
impl Unpin for McpServerConfig
impl UnsafeUnpin for McpServerConfig
impl UnwindSafe for McpServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.