pub enum McpServerConfig {
Stdio(McpStdioServerConfig),
Sse(McpSSEServerConfig),
Http(McpHttpServerConfig),
Sdk(McpSdkServerConfig),
}Expand description
Union type for MCP server configurations.
Supports four transport types for MCP (Model Context Protocol) servers:
Stdio— External process communicating via stdin/stdout.Sse— Remote server using Server-Sent Events.Http— Remote server using HTTP.Sdk— In-process server running within your application.
Variants§
Stdio(McpStdioServerConfig)
External stdio MCP server process.
Sse(McpSSEServerConfig)
Remote SSE MCP server.
Http(McpHttpServerConfig)
Remote HTTP MCP server.
Sdk(McpSdkServerConfig)
In-process SDK MCP server.
Implementations§
Source§impl McpServerConfig
impl McpServerConfig
Sourcepub fn to_cli_json(&self) -> Value
pub fn to_cli_json(&self) -> Value
Converts this configuration to a JSON value for the CLI protocol.
SDK-type servers are serialized as {"type": "sdk", "name": "<name>"} since
the actual server instance runs in-process and doesn’t need full serialization.
§Example
use claude_code::{McpServerConfig, McpSSEServerConfig};
let config = McpServerConfig::Sse(McpSSEServerConfig {
type_: "sse".to_string(),
url: "https://example.com/mcp".to_string(),
headers: None,
});
let json = config.to_cli_json();
assert_eq!(json["type"], "sse");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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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