From 03d83a207d95d3dfb84f64aa6e9ef3ca9a3e5c4e Mon Sep 17 00:00:00 2001 From: SlaVKsVolks Date: Wed, 13 May 2026 13:54:43 -0300 Subject: [PATCH] fix: add mcp-list slash command --- src/cortex-tui/src/commands/executor/dispatch.rs | 1 + src/cortex-tui/src/commands/executor/tests.rs | 10 ++++++++++ src/cortex-tui/src/commands/registry/builtin.rs | 9 +++++++++ src/cortex-tui/src/commands/registry/mod.rs | 1 + 4 files changed, 21 insertions(+) diff --git a/src/cortex-tui/src/commands/executor/dispatch.rs b/src/cortex-tui/src/commands/executor/dispatch.rs index 39cb9f2ee..8329a3750 100644 --- a/src/cortex-tui/src/commands/executor/dispatch.rs +++ b/src/cortex-tui/src/commands/executor/dispatch.rs @@ -96,6 +96,7 @@ impl CommandExecutor { // ============ MCP ============ // All MCP commands redirect to the interactive panel "mcp" => self.cmd_mcp(cmd), + "mcp-list" => CommandResult::OpenModal(ModalType::McpManager), "mcp-tools" | "tools" | "lt" => CommandResult::OpenModal(ModalType::McpManager), "mcp-auth" | "auth" => CommandResult::OpenModal(ModalType::McpManager), "mcp-reload" => 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..12b2dd51a 100644 --- a/src/cortex-tui/src/commands/executor/tests.rs +++ b/src/cortex-tui/src/commands/executor/tests.rs @@ -256,6 +256,16 @@ fn test_async_commands() { )); } +#[test] +fn test_mcp_list_opens_mcp_manager() { + let executor = CommandExecutor::new(); + + assert!(matches!( + executor.execute_str("/mcp-list"), + 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..058acb833 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", + &[], + "List MCP servers", + "/mcp-list", + CommandCategory::Mcp, + false, + )); + registry.register(CommandDef::new( "mcp-auth", &["auth"], diff --git a/src/cortex-tui/src/commands/registry/mod.rs b/src/cortex-tui/src/commands/registry/mod.rs index 541ae303c..11cecdb30 100644 --- a/src/cortex-tui/src/commands/registry/mod.rs +++ b/src/cortex-tui/src/commands/registry/mod.rs @@ -193,6 +193,7 @@ mod tests { // MCP assert!(registry.exists("mcp")); + assert!(registry.exists("mcp-list")); assert!(registry.exists("mcp-tools")); assert!(registry.exists("mcp-auth")); assert!(registry.exists("mcp-reload"));