ENGINEERING FIELD NOTE / agent-cli-mcp-rust

Directory guarding & secret scrubbing for stdio MCP servers

Allowed-roots path validation, destructive-command deny patterns, and regex credential redaction of subprocess output — the policy and redaction modules carry the unit tests.

Separate transport from execution

This Rust server exposes installed coding CLIs through JSON-RPC over standard input and output. Session management, policy checks, and subprocess supervision sit behind the MCP transport. Executor tools still need their own installation and authentication.

Check paths before launching a process

Allowed-root checks reject operations outside configured directories, quarantine markers can block a directory, and selected destructive commands have deny rules. These checks reduce accidental exposure but do not isolate a subprocess at the operating-system level.

Treat output as another data boundary

Subprocess output can contain credentials even when the original request did not. Redaction targets common database URLs, API keys, JWTs, and service tokens before output returns to the client. Pattern-based redaction cannot establish that every secret has been removed.