Skip to content

Commit ead1908

Browse files
feat(cli): support q mcp --help passthrough to qchat mcp (#1837)
* WIP * add mcp list command * add import&status&remove * fmt * add force flag in add & import * update fetch config * use sharedWritter && add ut * add mcp ut * merge refactor changes, keep all in chat_cli * revise CI * pass mcp in q_cli * parse help * ci * use any * fmt --------- Co-authored-by: Brandon Kiser <[email protected]>
1 parent 6dcb273 commit ead1908

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/q_cli/src/cli/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ pub enum CliRootCommands {
201201
args: Vec<String>,
202202
},
203203
/// Model Context Protocol (MCP)
204+
#[command(disable_help_flag = true)]
204205
Mcp {
205206
/// Args for the MCP subcommand (passed through to `qchat mcp …`)
206207
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
@@ -352,7 +353,12 @@ impl Cli {
352353
CliRootCommands::Version { changelog } => Self::print_version(changelog),
353354
CliRootCommands::Dashboard => launch_dashboard(false).await,
354355
CliRootCommands::Chat { args } => Self::execute_chat("chat", Some(args), true).await,
355-
CliRootCommands::Mcp { args } => Self::execute_chat("mcp", Some(args), true).await,
356+
CliRootCommands::Mcp { args } => {
357+
if args.iter().any(|arg| ["--help", "-h"].contains(&arg.as_str())) {
358+
return Self::execute_chat("mcp", Some(vec!["--help".to_owned()]), false).await;
359+
}
360+
Self::execute_chat("mcp", Some(args), true).await
361+
},
356362
CliRootCommands::Inline(subcommand) => subcommand.execute(&cli_context).await,
357363
},
358364
// Root command

0 commit comments

Comments
 (0)