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>, Error>
pub fn resolve_http_headers( &self, server_name: &str, ) -> Result<HashMap<String, String>, Error>
Resolve HTTP headers for remote transports: explicit headers, plus
shorthand auth, with ${VAR} / $VAR env substitution.
Sourcepub fn redacted_for_display(&self) -> McpServerConfig
pub fn redacted_for_display(&self) -> McpServerConfig
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, Error>
pub fn transport_kind(&self) -> Result<McpTransportKind, Error>
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<McpServerConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<McpServerConfig, <__D as Deserializer<'de>>::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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more