pub struct McpServerConfig {
pub command: String,
pub args: Vec<String>,
pub env: HashMap<String, String>,
pub url: Option<String>,
pub headers: HashMap<String, String>,
pub env_headers: HashMap<String, String>,
pub allow_private_network: bool,
pub enabled_tools: Vec<String>,
pub disabled_tools: Vec<String>,
pub defer: Option<bool>,
}Expand description
MCP server configuration
Fields§
§command: StringCommand to execute (e.g., “npx”, “node”, “python”). Empty = unset;
exactly one of command / url must be set (see Self::transport_kind).
args: Vec<String>Command-line arguments
env: HashMap<String, String>Environment variables for the server process
url: Option<String>Streamable HTTP endpoint URL for a remote MCP server. Presence selects
the HTTP transport; mutually exclusive with command. Must never
serialize as a bare None — toml errors on unsupported None values.
headers: HashMap<String, String>Literal HTTP headers sent on every request to url (e.g. an
Authorization token). Values are secrets: redacted in Debug.
env_headers: HashMap<String, String>HTTP headers whose VALUES come from environment variables (map is
header name -> env var name), resolved at request-build time so a
secret header never has to live in config.toml. A missing env var is
skipped. Same semantics as UserProviderConfig::env_headers.
allow_private_network: boolAllow url to resolve to private/link-local addresses. Off by default:
plugin bundles ship MCP configs, and a malicious bundle must not be
able to point a server entry at 169.254.169.254 or the LAN.
enabled_tools: Vec<String>If non-empty, only these tool names are exposed to the model.
disabled_tools: Vec<String>Tool names hidden from the model. Takes precedence over enabled_tools.
defer: Option<bool>Per-server deferral override: Some(false) always advertises this
server’s tools directly (skips tool_search); Some(true) defers
even when the global mcp_defer_tools is off; None follows the
global setting.
Implementations§
Source§impl McpServerConfig
impl McpServerConfig
Sourcepub fn transport_kind(&self) -> Result<TransportKind>
pub fn transport_kind(&self) -> Result<TransportKind>
Resolve which transport this config selects, enforcing the invariants:
exactly one of command / url set, and an HTTP url must be https
anywhere or http to a loopback host only (plaintext to a routable
host would leak Authorization headers in cleartext).
Sourcepub fn tool_allowed(&self, tool_name: &str) -> bool
pub fn tool_allowed(&self, tool_name: &str) -> bool
Whether tool_name should be exposed to the model: hidden when listed in
disabled_tools (which wins), else allowed when enabled_tools is empty
(allow-all) or names it.
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 Default for McpServerConfig
impl Default for McpServerConfig
Source§fn default() -> McpServerConfig
fn default() -> 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>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<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