@@ -200,6 +200,12 @@ pub enum CliRootCommands {
200200 #[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
201201 args : Vec < String > ,
202202 } ,
203+ /// Model Context Protocol (MCP)
204+ Mcp {
205+ /// Args for the MCP subcommand (passed through to `qchat mcp …`)
206+ #[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
207+ args : Vec < String > ,
208+ } ,
203209 /// Inline shell completions
204210 #[ command( subcommand) ]
205211 Inline ( inline:: InlineSubcommand ) ,
@@ -235,6 +241,7 @@ impl CliRootCommands {
235241 CliRootCommands :: Version { .. } => "version" ,
236242 CliRootCommands :: Dashboard => "dashboard" ,
237243 CliRootCommands :: Chat { .. } => "chat" ,
244+ CliRootCommands :: Mcp { .. } => "mcp" ,
238245 CliRootCommands :: Inline ( _) => "inline" ,
239246 }
240247 }
@@ -344,15 +351,16 @@ impl Cli {
344351 CliRootCommands :: Telemetry ( subcommand) => subcommand. execute ( ) . await ,
345352 CliRootCommands :: Version { changelog } => Self :: print_version ( changelog) ,
346353 CliRootCommands :: Dashboard => launch_dashboard ( false ) . await ,
347- CliRootCommands :: Chat { args } => Self :: execute_chat ( Some ( args) , true ) . await ,
354+ CliRootCommands :: Chat { args } => Self :: execute_chat ( "chat" , Some ( args) , true ) . await ,
355+ CliRootCommands :: Mcp { args } => Self :: execute_chat ( "mcp" , Some ( args) , true ) . await ,
348356 CliRootCommands :: Inline ( subcommand) => subcommand. execute ( & cli_context) . await ,
349357 } ,
350358 // Root command
351- None => Self :: execute_chat ( None , true ) . await ,
359+ None => Self :: execute_chat ( "chat" , None , true ) . await ,
352360 }
353361 }
354362
355- pub async fn execute_chat ( args : Option < Vec < String > > , enforce_login : bool ) -> Result < ExitCode > {
363+ pub async fn execute_chat ( subcmd : & str , args : Option < Vec < String > > , enforce_login : bool ) -> Result < ExitCode > {
356364 if enforce_login {
357365 assert_logged_in ( ) . await ?;
358366 }
@@ -369,8 +377,7 @@ impl Cli {
369377 }
370378
371379 let mut cmd = tokio:: process:: Command :: new ( home_local_bin ( ) ?. join ( CHAT_BINARY_NAME ) ) ;
372- cmd. arg ( "chat" ) ;
373-
380+ cmd. arg ( subcmd) ;
374381 if let Some ( args) = args {
375382 cmd. args ( args) ;
376383 }
0 commit comments