pub enum TransportArgs {
Stdio {
command: String,
args: Vec<String>,
env: Vec<String>,
cwd: Option<String>,
},
Http {
url: String,
headers: Vec<String>,
},
Sse {
url: String,
headers: Vec<String>,
},
}Expand description
CLI-flag mirror of McpTransport, holding the raw, unvalidated
Option/Vec<String> values clap hands back.
Every variant is a legal state by construction — there is no all-None
or “both http and sse” shape to represent, unlike the flat flag surface
this type is built from. In the real CLI path, values come from
TryFrom<ServerFlags> for ServerSource, the
single place “exactly one transport selected” is enforced (backed by
clap’s server_source argument group at parse time); since this type and
its fields are pub, a direct caller can also construct one by hand
(e.g. as a library), which is exactly why every variant already being
well-formed matters. TryFrom<TransportArgs> for McpTransport does the
KEY=VALUE parsing for environment variables and headers.
§Examples
use mcp_execution_cli::commands::common::TransportArgs;
let transport = TransportArgs::Stdio {
command: "github-mcp-server".to_string(),
args: vec!["stdio".to_string()],
env: vec![],
cwd: None,
};
assert!(matches!(transport, TransportArgs::Stdio { .. }));Debug output redacts env/headers entries wholesale, not just a value
half — these are raw, unparsed KEY=VALUE strings, and per
parse_key_value’s own doc comment the whole string may be the secret
with no discernible key:
use mcp_execution_cli::commands::common::TransportArgs;
let transport = TransportArgs::Http {
url: "https://api.example.com/mcp".to_string(),
headers: vec!["Authorization=Bearer sk-secret".to_string()],
};
let debug_output = format!("{transport:?}");
assert!(!debug_output.contains("sk-secret"));
assert!(!debug_output.contains("Authorization"));
assert!(debug_output.contains("<redacted>"));Variants§
Stdio
Stdio transport (default): raw CLI flags.
Fields
Http
HTTP transport: raw CLI flags.
Sse
SSE transport: raw CLI flags.
Trait Implementations§
Source§impl Clone for TransportArgs
impl Clone for TransportArgs
Source§fn clone(&self) -> TransportArgs
fn clone(&self) -> TransportArgs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more