diff --git a/src/cortex-tui/src/commands/executor/dispatch.rs b/src/cortex-tui/src/commands/executor/dispatch.rs index 39cb9f2ee..0d6e7a603 100644 --- a/src/cortex-tui/src/commands/executor/dispatch.rs +++ b/src/cortex-tui/src/commands/executor/dispatch.rs @@ -97,7 +97,9 @@ impl CommandExecutor { // All MCP commands redirect to the interactive panel "mcp" => self.cmd_mcp(cmd), "mcp-tools" | "tools" | "lt" => CommandResult::OpenModal(ModalType::McpManager), + "mcp-list" | "mcp-ls" => CommandResult::OpenModal(ModalType::McpManager), "mcp-auth" | "auth" => CommandResult::OpenModal(ModalType::McpManager), + "mcp-remove" | "mcp-rm" => CommandResult::OpenModal(ModalType::McpManager), "mcp-reload" => CommandResult::OpenModal(ModalType::McpManager), "mcp-logs" => CommandResult::OpenModal(ModalType::McpManager), diff --git a/src/cortex-tui/src/commands/executor/tests.rs b/src/cortex-tui/src/commands/executor/tests.rs index 5e05ad996..cb1e4945f 100644 --- a/src/cortex-tui/src/commands/executor/tests.rs +++ b/src/cortex-tui/src/commands/executor/tests.rs @@ -316,6 +316,14 @@ fn test_mcp_subcommands() { CommandResult::OpenModal(ModalType::McpManager) )); + for command in &["/mcp-list", "/mcp-ls", "/mcp-remove", "/mcp-rm"] { + let result = executor.execute_str(command); + assert!(matches!( + result, + CommandResult::OpenModal(ModalType::McpManager) + )); + } + // All mcp subcommands now redirect to the interactive panel let result = executor.execute_str("/mcp status"); assert!(matches!( diff --git a/src/cortex-tui/src/commands/registry/builtin.rs b/src/cortex-tui/src/commands/registry/builtin.rs index 839eb404a..d3a6d05b2 100644 --- a/src/cortex-tui/src/commands/registry/builtin.rs +++ b/src/cortex-tui/src/commands/registry/builtin.rs @@ -581,6 +581,15 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) { false, )); + registry.register(CommandDef::new( + "mcp-list", + &["mcp-ls"], + "List configured MCP servers", + "/mcp-list", + CommandCategory::Mcp, + false, + )); + registry.register(CommandDef::new( "mcp-auth", &["auth"], @@ -590,6 +599,15 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) { false, )); + registry.register(CommandDef::new( + "mcp-remove", + &["mcp-rm"], + "Remove an MCP server", + "/mcp-remove", + CommandCategory::Mcp, + true, + )); + registry.register(CommandDef::new( "mcp-reload", &[], diff --git a/src/cortex-tui/src/commands/registry/mod.rs b/src/cortex-tui/src/commands/registry/mod.rs index 541ae303c..b22db36d6 100644 --- a/src/cortex-tui/src/commands/registry/mod.rs +++ b/src/cortex-tui/src/commands/registry/mod.rs @@ -78,19 +78,15 @@ mod tests { let general = registry.get_by_category(CommandCategory::General); assert!(!general.is_empty()); - assert!( - general - .iter() - .all(|cmd| cmd.category == CommandCategory::General) - ); + assert!(general + .iter() + .all(|cmd| cmd.category == CommandCategory::General)); let session = registry.get_by_category(CommandCategory::Session); assert!(!session.is_empty()); - assert!( - session - .iter() - .all(|cmd| cmd.category == CommandCategory::Session) - ); + assert!(session + .iter() + .all(|cmd| cmd.category == CommandCategory::Session)); } #[test] @@ -194,7 +190,11 @@ mod tests { // MCP assert!(registry.exists("mcp")); assert!(registry.exists("mcp-tools")); + assert!(registry.exists("mcp-list")); + assert!(registry.exists("mcp-ls")); assert!(registry.exists("mcp-auth")); + assert!(registry.exists("mcp-remove")); + assert!(registry.exists("mcp-rm")); assert!(registry.exists("mcp-reload")); // Auth