pub struct McpConfig {
pub enabled: bool,
pub allowed_origins: Vec<String>,
pub discover_ttl_ms: Option<u64>,
pub tools_list_ttl_ms: Option<u64>,
pub task_poll_interval_ms: Option<u64>,
}Expand description
Model Context Protocol surface settings from [mcp].
The surface is DARK by default: with enabled = false (or the section
absent) the /mcp route is not mounted and the path is a plain 404. An MCP
endpoint hands a model the ability to start and cancel durable executions,
so commissioning it is an explicit operator decision, never a side effect of
upgrading.
allowed_origins is EMPTY by default and empty means “no browser origin”.
A programmatic client sends no Origin header and is unaffected; a page in
a browser always sends one, so the empty list refuses every browser-borne
request. That is the DNS-rebinding defence the transport requires, and it is
a real policy rather than an unset value.
Fields§
§enabled: boolWhether the /mcp endpoint is mounted. Defaults to false.
allowed_origins: Vec<String>Browser origins permitted to reach the MCP endpoint. Empty permits none.
discover_ttl_ms: Option<u64>ttlMs on the server/discover result.
Defaults to DEFAULT_MCP_DISCOVER_TTL_MS when omitted and
enabled = true, so switching the surface on does not force sizing two
cache lifetimes first.
tools_list_ttl_ms: Option<u64>ttlMs on the tools/list result. Defaults to
DEFAULT_MCP_TOOLS_LIST_TTL_MS.
task_poll_interval_ms: Option<u64>The pollIntervalMs advertised on a created task. Defaults to
DEFAULT_MCP_TASK_POLL_INTERVAL_MS.
A hint to the client and nothing more: no server behaviour depends on it. There is no task lifetime beside it, because an MCP task here is a projection of a durable run and has nothing to expire.
Implementations§
Source§impl McpConfig
impl McpConfig
Sourcepub fn resolved(&self) -> ResolvedMcpConfig
pub fn resolved(&self) -> ResolvedMcpConfig
Resolve every omitted knob to its default.
A zero poll interval resolves to the DEFAULT rather than to zero.
Self::validate has already refused it on any loaded configuration,
so this arm is reachable only from a hand-constructed config that
skipped validation — and for that case a documented default is the safe
direction, where a literal zero would be a busy loop.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for McpConfig
impl<'de> Deserialize<'de> for McpConfig
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 McpConfig
impl StructuralPartialEq for McpConfig
Auto Trait Implementations§
impl Freeze for McpConfig
impl RefUnwindSafe for McpConfig
impl Send for McpConfig
impl Sync for McpConfig
impl Unpin for McpConfig
impl UnsafeUnpin for McpConfig
impl UnwindSafe for McpConfig
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<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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Source§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