pub struct McpServerConfig {
pub name: String,
pub transport: String,
pub command: Option<String>,
pub args: Vec<String>,
pub url: Option<String>,
pub env: HashMap<String, String>,
pub auto_approve: Vec<String>,
}Expand description
MCP (Model Context Protocol) server configuration.
Declares an MCP server that the runtime should connect to for additional tool capabilities.
§Wire Shape (CANON §3.8)
{
"name": "my-mcp-server",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"],
"env": {"HOME": "/tmp"},
"auto_approve": ["read_file", "list_dir"]
}§Example
use adk_managed::types::McpServerConfig;
let config = McpServerConfig {
name: "filesystem".to_string(),
transport: "stdio".to_string(),
command: Some("npx".to_string()),
args: vec!["-y".to_string(), "@mcp/server-filesystem".to_string()],
url: None,
env: Default::default(),
auto_approve: vec!["read_file".to_string()],
};
let json = serde_json::to_string(&config).unwrap();
assert!(json.contains(r#""name":"filesystem""#));Fields§
§name: StringUnique name for this MCP server.
transport: StringTransport type: "stdio", "sse", "streamable_http", etc.
command: Option<String>Command to launch the server (for stdio transport).
args: Vec<String>Arguments to pass to the command.
url: Option<String>URL for network-based transports (SSE, HTTP).
env: HashMap<String, String>Environment variables to set when launching the server.
auto_approve: Vec<String>Tool names that are pre-approved (no confirmation needed).
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