pub struct McpServerPolicy { /* private fields */ }Expand description
A PermissionPolicy that governs McpPermissionRequests by checking
whether the target server is trusted and the requested auth scopes are
in the allow-list.
§Example
use agentkit_tools_core::McpServerPolicy;
let policy = McpServerPolicy::new()
.trust_server("github-mcp")
.allow_auth_scope("repo:read");Implementations§
Source§impl McpServerPolicy
impl McpServerPolicy
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new MCP server policy with approval required for untrusted servers.
Sourcepub fn trust_server(self, server_id: impl Into<String>) -> Self
pub fn trust_server(self, server_id: impl Into<String>) -> Self
Marks a server as trusted so operations targeting it are allowed.
Sourcepub fn allow_auth_scope(self, scope: impl Into<String>) -> Self
pub fn allow_auth_scope(self, scope: impl Into<String>) -> Self
Adds an auth scope to the allow-list.
Trait Implementations§
Source§impl Default for McpServerPolicy
impl Default for McpServerPolicy
Source§impl PermissionPolicy for McpServerPolicy
impl PermissionPolicy for McpServerPolicy
Source§fn evaluate(&self, request: &dyn PermissionRequest) -> PolicyMatch
fn evaluate(&self, request: &dyn PermissionRequest) -> PolicyMatch
Evaluate the request and return a match or
PolicyMatch::NoOpinion.Auto Trait Implementations§
impl Freeze for McpServerPolicy
impl RefUnwindSafe for McpServerPolicy
impl Send for McpServerPolicy
impl Sync for McpServerPolicy
impl Unpin for McpServerPolicy
impl UnsafeUnpin for McpServerPolicy
impl UnwindSafe for McpServerPolicy
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