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"));