#[non_exhaustive]pub struct McpServerRule {
pub server_name: Option<String>,
pub server_command: Option<Vec<String>>,
pub server_url: Option<String>,
pub extra: Extra,
}Expand description
An entry of allowedMcpServers or deniedMcpServers: one of the
three fields.
Allowlist the MCP servers people can add. Claude Code blocks any server that doesn’t match
an entry wherever it’s defined, including plugin servers, servers a user passes with
--mcp-config, and servers from claude.ai.
Docs: allowedMcpServers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.server_name: Option<String>Name of the MCP server that users are allowed to configure.
- Values: string
- Default: unset
Docs: serverName.
server_command: Option<Vec<String>>Exact command and arguments used to start stdio servers.
- Values: array of strings
- Default: unset
Docs: serverCommand.
server_url: Option<String>URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*).
- Values: string
- Default: unset
Docs: serverUrl.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.
Trait Implementations§
Source§impl Clone for McpServerRule
impl Clone for McpServerRule
Source§impl Debug for McpServerRule
impl Debug for McpServerRule
Source§impl Default for McpServerRule
impl Default for McpServerRule
Source§impl<'de> Deserialize<'de> for McpServerRule
impl<'de> Deserialize<'de> for McpServerRule
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for McpServerRule
impl PartialEq for McpServerRule
Source§impl Serialize for McpServerRule
impl Serialize for McpServerRule
impl StructuralPartialEq for McpServerRule
Auto Trait Implementations§
impl Forget for McpServerRule
impl Freeze for McpServerRule
impl Move for McpServerRule
impl RefUnwindSafe for McpServerRule
impl Send for McpServerRule
impl Sync for McpServerRule
impl Unpin for McpServerRule
impl UnsafeUnpin for McpServerRule
impl UnwindSafe for McpServerRule
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