pub struct McpAuditLayer { /* private fields */ }Expand description
Audits tools/call requests for the named MCP tools (the ones that
change the server) as user mcp, with the arguments redacted like an
admin request body. Wrap the MCP server with it.
Implementations§
Source§impl McpAuditLayer
impl McpAuditLayer
pub fn new(tools: impl IntoIterator<Item = impl Into<String>>) -> McpAuditLayer
Trait Implementations§
Source§impl Middleware for McpAuditLayer
impl Middleware for McpAuditLayer
Source§fn accepts_streamed_body(
&self,
request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn accepts_streamed_body( &self, request: &Request, _connection: &ConnectionInfo, ) -> bool
Only POST /mcp… bodies are looked at; everything else passes
straight through (streamed bodies, the async forwarder, inline runs).
fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Source§fn is_passthrough(
&self,
request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn is_passthrough( &self, request: &Request, _connection: &ConnectionInfo, ) -> bool
true when handle would do nothing for request but call next
(e.g. a rate limit that isn’t configured). A WithMiddleware stack
offers the inner application’s execute_async only if every layer
passes the request through. Default false.Source§fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
true when this layer’s own work for request never blocks (in-memory
state, atomics, short mutexes) — see Application::runs_inline. A
WithMiddleware stack runs inline only if every layer and the inner
application agree. Default false.Source§fn answers_streamed_body(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn answers_streamed_body( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
true when this layer answers request itself — it doesn’t call
next — and reads its body as a stream (a proxy forwarding it as it
arrives). The body is then streamed whatever the layers after it and
the application would say. Requires accepts_streamed_body. Since
18.3.0.Auto Trait Implementations§
impl Freeze for McpAuditLayer
impl RefUnwindSafe for McpAuditLayer
impl Send for McpAuditLayer
impl Sync for McpAuditLayer
impl Unpin for McpAuditLayer
impl UnsafeUnpin for McpAuditLayer
impl UnwindSafe for McpAuditLayer
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
Mutably borrows from an owned value. Read more