#[non_exhaustive]pub enum McpServerConfig {
Stdio(McpStdioServerConfig),
Http(McpHttpServerConfig),
Sse(McpHttpServerConfig),
}Expand description
Configuration for a single MCP server.
MCP (Model Context Protocol) servers expose external tools to the agent. Local servers run as a subprocess over stdio; remote servers speak HTTP or Server-Sent Events.
Serialized as a JSON object with a type discriminator ("stdio" |
"http" | "sse").
§Example
let mut servers = HashMap::new();
servers.insert(
"playwright".to_string(),
McpServerConfig::Stdio(McpStdioServerConfig {
tools: vec!["*".to_string()],
command: "npx".to_string(),
args: vec!["-y".to_string(), "@playwright/mcp".to_string()],
..Default::default()
}),
);
servers.insert(
"weather".to_string(),
McpServerConfig::Http(McpHttpServerConfig {
tools: vec!["forecast".to_string()],
url: "https://example.com/mcp".to_string(),
..Default::default()
}),
);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Stdio(McpStdioServerConfig)
Local MCP server launched as a subprocess and addressed over stdio.
On the wire this serializes as {"type": "stdio", ...}. The CLI
also accepts "local" as an alias on input.
Http(McpHttpServerConfig)
Remote MCP server addressed over HTTP.
Sse(McpHttpServerConfig)
Remote MCP server addressed over Server-Sent Events.
Trait Implementations§
Source§impl Clone for McpServerConfig
impl Clone for McpServerConfig
Source§fn clone(&self) -> McpServerConfig
fn clone(&self) -> McpServerConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for McpServerConfig
impl Debug for McpServerConfig
Source§impl<'de> Deserialize<'de> for McpServerConfig
impl<'de> Deserialize<'de> for McpServerConfig
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
Auto Trait Implementations§
impl Freeze for McpServerConfig
impl RefUnwindSafe for McpServerConfig
impl Send for McpServerConfig
impl Sync for McpServerConfig
impl Unpin for McpServerConfig
impl UnsafeUnpin for McpServerConfig
impl UnwindSafe for McpServerConfig
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