pub fn create_sdk_mcp_server(
name: impl Into<String>,
version: impl Into<String>,
tools: Vec<SdkMcpTool>,
) -> McpSdkServerConfigExpand description
Creates an McpSdkServerConfig for use in ClaudeAgentOptions::mcp_servers.
This is the entry point for registering in-process MCP servers with the SDK.
§Arguments
name— Unique server name.version— Server version string.tools— List of tools to register on this server.
§Returns
An McpSdkServerConfig that can be added to the mcp_servers map.
§Example
let server = create_sdk_mcp_server("my-server", "1.0.0", vec![
tool("hello", "Say hello", json!({"type": "object"}), |_| async { Ok(json!({"content": []})) }),
]);
let options = ClaudeAgentOptions {
mcp_servers: McpServersOption::Servers(HashMap::from([
("my-server".to_string(), McpServerConfig::Sdk(server)),
])),
..Default::default()
};