@@ -200,6 +200,12 @@ pub enum CliRootCommands {
200
200
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
201
201
args : Vec < String > ,
202
202
} ,
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
+ } ,
203
209
/// Inline shell completions
204
210
#[ command( subcommand) ]
205
211
Inline ( inline:: InlineSubcommand ) ,
@@ -235,6 +241,7 @@ impl CliRootCommands {
235
241
CliRootCommands :: Version { .. } => "version" ,
236
242
CliRootCommands :: Dashboard => "dashboard" ,
237
243
CliRootCommands :: Chat { .. } => "chat" ,
244
+ CliRootCommands :: Mcp { .. } => "mcp" ,
238
245
CliRootCommands :: Inline ( _) => "inline" ,
239
246
}
240
247
}
@@ -344,15 +351,16 @@ impl Cli {
344
351
CliRootCommands :: Telemetry ( subcommand) => subcommand. execute ( ) . await ,
345
352
CliRootCommands :: Version { changelog } => Self :: print_version ( changelog) ,
346
353
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 ,
348
356
CliRootCommands :: Inline ( subcommand) => subcommand. execute ( & cli_context) . await ,
349
357
} ,
350
358
// Root command
351
- None => Self :: execute_chat ( None , true ) . await ,
359
+ None => Self :: execute_chat ( "chat" , None , true ) . await ,
352
360
}
353
361
}
354
362
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 > {
356
364
if enforce_login {
357
365
assert_logged_in ( ) . await ?;
358
366
}
@@ -369,8 +377,7 @@ impl Cli {
369
377
}
370
378
371
379
let mut cmd = tokio:: process:: Command :: new ( home_local_bin ( ) ?. join ( CHAT_BINARY_NAME ) ) ;
372
- cmd. arg ( "chat" ) ;
373
-
380
+ cmd. arg ( subcmd) ;
374
381
if let Some ( args) = args {
375
382
cmd. args ( args) ;
376
383
}
0 commit comments