pub struct CompiledMcp {
pub tools: BTreeMap<String, CompiledMcpTool>,
pub resources: BTreeMap<String, CompiledMcpResource>,
pub prompts: BTreeMap<String, CompiledMcpPrompt>,
pub sessions_ttl_secs: u64,
pub sessions_max_concurrent: usize,
pub path: String,
pub consumer_tool_allowlists: BTreeMap<String, BTreeSet<String>>,
}Expand description
The compiled MCP gateway (DW-087): the tool table, session
policy, and reserved path. Built at AiRuntime compile time
from the ai.mcp config block; immutable once built.
Fields§
§tools: BTreeMap<String, CompiledMcpTool>The compiled tools, keyed by tool name.
resources: BTreeMap<String, CompiledMcpResource>AI-11 (#200): The compiled static resources, keyed by name.
prompts: BTreeMap<String, CompiledMcpPrompt>AI-11 (#200): The compiled static prompts, keyed by name.
sessions_ttl_secs: u64Session TTL in seconds.
sessions_max_concurrent: usizeMax concurrent sessions.
path: StringThe reserved HTTP path for the MCP endpoint.
consumer_tool_allowlists: BTreeMap<String, BTreeSet<String>>Per-consumer tool allowlists (DW-113): consumer name -> the
set of tool names that consumer may call. A consumer NOT in
this map has no restriction (may call any tool). Built from
gateway.consumers[].tool_allowlist at compile time.
Implementations§
Source§impl CompiledMcp
impl CompiledMcp
Sourcepub fn compile(config: &AiMcpConfig, gateway: &Gateway) -> Option<Self>
pub fn compile(config: &AiMcpConfig, gateway: &Gateway) -> Option<Self>
Compile from the ai.mcp config block. Resolves each tool’s
upstream reference to a concrete URL using the gateway’s
upstreams. Returns None when a referenced upstream is missing
or has no endpoints (a validate-vs-build race or an authoring
error validation missed — the tool is silently dropped with a
log).
Sourcepub fn tool_authz(&self, name: &str) -> Option<&Authz>
pub fn tool_authz(&self, name: &str) -> Option<&Authz>
The authz attachment for a tool (DW-087). Returns None when
the tool has no authz attachment (any authenticated consumer
may call it). The dataplane evaluates this attachment using
the security::authz module (the ai domain may not import
security — see scripts/check_deps.py).
Sourcepub fn tool_names(&self) -> impl Iterator<Item = &str>
pub fn tool_names(&self) -> impl Iterator<Item = &str>
All tool names (DW-087), for the dataplane’s authz-filtered
tools/list response.
Sourcepub fn consumer_allowed_tool(&self, consumer: &str, tool: &str) -> bool
pub fn consumer_allowed_tool(&self, consumer: &str, tool: &str) -> bool
Whether consumer is allowed to call tool (DW-113). A
consumer NOT in the allowlist map has no restriction (may call
any tool); a consumer IN the map may call only the tools in its
set. The dataplane checks this BEFORE the authz attachment for
tools/call and filters tools/list by it.
Sourcepub async fn handle_request(
&self,
req: &JsonRpcRequest,
session_id: Option<&str>,
consumer: &str,
) -> McpHandleResult
pub async fn handle_request( &self, req: &JsonRpcRequest, session_id: Option<&str>, consumer: &str, ) -> McpHandleResult
Handle one JSON-RPC request. The session_id is extracted
from the Mcp-Session-Id header (None for initialize).
Returns the JSON-RPC response and optional analytics/observability
outcomes.
Authz is NOT evaluated here — the ai domain may not
import security. The dataplane evaluates each tool’s authz
attachment BEFORE calling this method for tools/call, and
filters the tools/list response after it returns.
This method is async because tools/call makes an HTTP call
to the upstream.
Trait Implementations§
Source§impl Clone for CompiledMcp
impl Clone for CompiledMcp
Source§fn clone(&self) -> CompiledMcp
fn clone(&self) -> CompiledMcp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompiledMcp
impl RefUnwindSafe for CompiledMcp
impl Send for CompiledMcp
impl Sync for CompiledMcp
impl Unpin for CompiledMcp
impl UnwindSafe for CompiledMcp
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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