mod mcp; use clap::{Args, Parser, Subcommand}; #[cfg(test)] use libmcp_testkit as _; use std::path::PathBuf; #[derive(Parser)] #[command( author, version, about = "Consultative Claude Code MCP with a hardened host/worker spine" )] struct Cli { #[command(subcommand)] command: Command, } #[derive(Subcommand)] enum Command { /// Serve the stdio MCP host. Mcp { #[command(subcommand)] command: McpCommand, }, } #[derive(Subcommand)] enum McpCommand { /// Run the durable stdio host. Serve, /// Run the disposable worker process. Worker(McpWorkerArgs), /// Run one detached background consult job. BackgroundConsult(McpBackgroundConsultArgs), } #[derive(Args)] struct McpWorkerArgs { /// Logical worker generation assigned by the host. #[arg(long)] generation: u64, } #[derive(Args)] struct McpBackgroundConsultArgs { /// Persisted background job file to execute and update. #[arg(long)] job_file: PathBuf, } fn main() -> Result<(), Box> { let cli = Cli::parse(); match cli.command { Command::Mcp { command } => match command { McpCommand::Serve => mcp::run_host()?, McpCommand::Worker(args) => mcp::run_worker(args.generation)?, McpCommand::BackgroundConsult(args) => mcp::run_background_consult(args.job_file)?, }, } Ok(()) }