pub struct MCPConfig { /* private fields */ }Expand description
Parsed representation of an MCP host config file.
Implementations§
Source§impl MCPConfig
impl MCPConfig
Sourcepub fn from_json(json: &str) -> Result<MCPConfig, Error>
pub fn from_json(json: &str) -> Result<MCPConfig, Error>
Parse an MCP config JSON string.
Returns an error when the JSON is malformed or when the mcpServers
key is absent.
Sourcepub fn server_names(&self) -> Vec<String>
pub fn server_names(&self) -> Vec<String>
Return server names in ascending lexicographic order.
Sourcepub fn server(&self, name: &str) -> Option<&ServerConfig>
pub fn server(&self, name: &str) -> Option<&ServerConfig>
Look up a server configuration by name.
Sourcepub fn cli_prefix(&self, server_name: &str) -> String
pub fn cli_prefix(&self, server_name: &str) -> String
Return the CLI prefix (sanitized server name) for a given server.
Used to namespace subcommands in multi-server CLI mode.
Trait Implementations§
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
Mutably borrows from an owned value. Read more