pub enum ServerSource {
Config {
name: String,
},
Flags {
transport: TransportArgs,
connect_timeout_secs: Option<u64>,
discover_timeout_secs: Option<u64>,
},
}Expand description
Fully-resolved “how do I reach this server” selection for introspect and
generate.
The output of TryFrom<ServerFlags> for ServerSource, converted from clap’s parsed
argv once the server_source argument group has already guaranteed
exactly one selector was set. Unlike the former RawServerArgs landing
zone, every value of this type is a legal state: --from-config and the
timeout overrides are folded into the same enum because they belong to
the same exclusivity group (a from_config selection can never carry a
meaningless connect_timeout_secs/discover_timeout_secs override, since
those live on the Flags arm only).
§Examples
use mcp_execution_cli::commands::common::{ServerSource, TransportArgs};
let source = ServerSource::Flags {
transport: TransportArgs::Stdio {
command: "github-mcp-server".to_string(),
args: vec!["stdio".to_string()],
env: vec![],
cwd: None,
},
connect_timeout_secs: None,
discover_timeout_secs: None,
};
assert!(matches!(source, ServerSource::Flags { .. }));Debug output redacts via TransportArgs’s own redacting Debug impl:
use mcp_execution_cli::commands::common::{ServerSource, TransportArgs};
let source = ServerSource::Flags {
transport: TransportArgs::Http {
url: "https://api.example.com/mcp".to_string(),
headers: vec!["Authorization=Bearer sk-secret".to_string()],
},
connect_timeout_secs: None,
discover_timeout_secs: None,
};
let debug_output = format!("{source:?}");
assert!(!debug_output.contains("sk-secret"));Variants§
Config
Load server configuration from ~/.claude/mcp.json by name.
Flags
Build server configuration directly from CLI transport flags.
Trait Implementations§
Source§impl Clone for ServerSource
impl Clone for ServerSource
Source§fn clone(&self) -> ServerSource
fn clone(&self) -> ServerSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerSource
impl Debug for ServerSource
Source§impl TryFrom<ServerFlags> for ServerSource
Converts clap’s parsed ServerFlags landing zone into the closed
ServerSource domain enum.
impl TryFrom<ServerFlags> for ServerSource
Converts clap’s parsed ServerFlags landing zone into the closed
ServerSource domain enum.
§Errors
Returns CoreError::InvalidArgument if none or more than one of
from_config/server/http/sse is set. Unreachable when flags came
from real CLI parsing — the server_source argument group on
ServerFlags already enforces exactly one — but reachable from a
directly-constructed ServerFlags value (e.g. in tests, which can build
one since they are a child module of this one).