mcp: redact stdio server spec debug

This commit is contained in:
2026-06-20 16:54:48 +09:00
parent a114fa9d0a
commit f396e1a253
2 changed files with 47 additions and 1 deletions
+19 -1
View File
@@ -52,7 +52,7 @@ impl Default for McpStdioLimits {
}
/// A resolved, explicit local stdio MCP server process specification.
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct McpStdioServerSpec {
pub name: String,
pub command: String,
@@ -107,6 +107,24 @@ impl McpStdioServerSpec {
}
}
impl fmt::Debug for McpStdioServerSpec {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let env: BTreeMap<&str, &str> = self
.env
.keys()
.map(|name| (name.as_str(), "[redacted]"))
.collect();
f.debug_struct("McpStdioServerSpec")
.field("name", &self.name)
.field("command", &self.command)
.field("args", &self.args)
.field("cwd", &self.cwd)
.field("env", &env)
.field("redaction_count", &self.redactions.len())
.finish()
}
}
/// Resolve one explicitly named stdio server from typed MCP config.
pub fn resolve_named_stdio_server(
config: &McpConfig,