diff --git a/src/cortex-tui/src/commands/executor/dispatch.rs b/src/cortex-tui/src/commands/executor/dispatch.rs index 39cb9f2ee..5e5c0a8b1 100644 --- a/src/cortex-tui/src/commands/executor/dispatch.rs +++ b/src/cortex-tui/src/commands/executor/dispatch.rs @@ -98,6 +98,7 @@ impl CommandExecutor { "mcp" => self.cmd_mcp(cmd), "mcp-tools" | "tools" | "lt" => 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..e122ee590 100644 --- a/src/cortex-tui/src/commands/executor/tests.rs +++ b/src/cortex-tui/src/commands/executor/tests.rs @@ -256,6 +256,18 @@ fn test_async_commands() { )); } +#[test] +fn test_mcp_remove_commands_open_mcp_manager() { + let executor = CommandExecutor::new(); + + for command in ["/mcp-remove", "/mcp-rm"] { + assert!(matches!( + executor.execute_str(command), + CommandResult::OpenModal(ModalType::McpManager) + )); + } +} + #[test] fn test_add_command() { let executor = CommandExecutor::new(); diff --git a/src/cortex-tui/src/commands/registry/builtin.rs b/src/cortex-tui/src/commands/registry/builtin.rs index 839eb404a..993f2afd1 100644 --- a/src/cortex-tui/src/commands/registry/builtin.rs +++ b/src/cortex-tui/src/commands/registry/builtin.rs @@ -590,6 +590,15 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) { false, )); + registry.register(CommandDef::new( + "mcp-remove", + &["mcp-rm"], + "Remove MCP servers", + "/mcp-remove", + CommandCategory::Mcp, + false, + )); + 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..fa01b2a4f 100644 --- a/src/cortex-tui/src/commands/registry/mod.rs +++ b/src/cortex-tui/src/commands/registry/mod.rs @@ -195,6 +195,8 @@ mod tests { assert!(registry.exists("mcp")); assert!(registry.exists("mcp-tools")); assert!(registry.exists("mcp-auth")); + assert!(registry.exists("mcp-remove")); + assert!(registry.exists("mcp-rm")); assert!(registry.exists("mcp-reload")); // Auth