pub struct McpServerConfig {Show 18 fields
pub id: String,
pub command: Option<String>,
pub args: Vec<String>,
pub env: HashMap<String, String>,
pub url: Option<String>,
pub timeout: u64,
pub policy: McpPolicy,
pub headers: HashMap<String, String>,
pub oauth: Option<McpOAuthConfig>,
pub trust_level: McpTrustLevel,
pub tool_allowlist: Option<Vec<String>>,
pub allow_untrusted_without_allowlist: bool,
pub expected_tools: Vec<String>,
pub roots: Vec<McpRootEntry>,
pub tool_metadata: HashMap<String, ToolSecurityMeta>,
pub elicitation_enabled: Option<bool>,
pub env_isolation: Option<bool>,
pub media_passthrough: bool,
}Fields§
§id: String§command: Option<String>Stdio transport: command to spawn.
args: Vec<String>§env: HashMap<String, String>Environment variables for the spawned Stdio process. Values may hold vault
references (${VAULT_KEY}) or, in a hand-written config, raw secrets.
§Security
Intentionally not redacted in Serialize: --init persists this map to
config.toml, so a redacting Serialize would corrupt the round-trip. The
redacting Debug impl on this struct is the approved representation for any
log/dump/status output — never emit this field’s values via Serialize or any other
non-Debug representation.
url: Option<String>HTTP transport: remote MCP server URL.
timeout: u64§policy: McpPolicyOptional declarative policy for this server (allowlist, denylist, rate limit).
headers: HashMap<String, String>Static HTTP headers for the transport (e.g. Authorization: Bearer <token>).
Values support vault references: ${VAULT_KEY}.
§Security
Intentionally not redacted in Serialize — same rationale as
env: --init persists this map to config.toml, and the redacting
Debug impl is the approved representation for log/dump/status output — never emit
this field’s values via Serialize or any other non-Debug representation.
oauth: Option<McpOAuthConfig>OAuth 2.1 configuration for this server.
trust_level: McpTrustLevelTrust level for this server. Default: Untrusted.
tool_allowlist: Option<Vec<String>>Tool allowlist. None means no override (inherit defaults).
Some(vec![]) is an explicit empty list (deny all for Untrusted/Sandboxed).
Some(vec!["a", "b"]) allows only listed tools.
allow_untrusted_without_allowlist: boolExplicit opt-in to expose all tools for an Untrusted server that has no
tool_allowlist declared. Default: false — secure by default (fails closed).
When false (default) and trust_level == Untrusted with tool_allowlist = None,
zero tools are exposed. Set true only when you intentionally want this server to
expose all its tools while still running the full untrusted pipeline (SSRF checks,
sanitization, injection detection, attestation, data-flow filtering) — this is
distinct from trust_level = trusted, which additionally relaxes SSRF/data-flow
enforcement. Has no effect on Trusted/Sandboxed servers or when tool_allowlist
is set.
expected_tools: Vec<String>Expected tool names for attestation. Supplements tool_allowlist.
When non-empty: tools not in this list are filtered out (Untrusted/Sandboxed) or warned about (Trusted). Schema drift is logged when fingerprints change between connections.
roots: Vec<McpRootEntry>Filesystem roots exposed to this MCP server via roots/list.
Each entry is a {uri, name?} pair. URI must use file:// scheme.
When empty, the server receives an empty roots list.
tool_metadata: HashMap<String, ToolSecurityMeta>Per-tool security metadata overrides. Keys are tool names. When absent for a tool, metadata is inferred from the tool name via heuristics.
elicitation_enabled: Option<bool>Per-server elicitation override. None = inherit global elicitation_enabled.
Some(true) = allow this server to elicit regardless of global setting.
Some(false) = always decline for this server.
env_isolation: Option<bool>Isolate the environment for this Stdio server.
When true (or when [mcp].default_env_isolation = true), the spawned process
only sees a minimal base env (PATH, HOME, etc.) plus this server’s env map.
Overrides [mcp].default_env_isolation when set explicitly.
Default: false (backward compatible).
media_passthrough: boolOpt-in: decode and attach images this server returns as native MessagePart::Image
siblings for vision-capable providers (spec-072). Default: false.
Independent of trust_level but always hard-blocked when
trust_level == McpTrustLevel::Sandboxed, regardless of this flag.
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>,
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,
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request