Skip to main content

validate_mcp_command

Function validate_mcp_command 

Source
pub fn validate_mcp_command(command: &str) -> Result<(), String>
Expand description

Validate an MCP server command before spawning it.

Rejects control bytes, shell metacharacters, path traversal (..), and shell-interpreter basenames. Returns Ok(()) if the command is a safe single token that is not a known shell.

ยงErrors

Returns a human-readable reason string describing why the command was rejected.