Skip to content

Commit 03d83a2

Browse files
committed
fix: add mcp-list slash command
1 parent 7954d02 commit 03d83a2

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/cortex-tui/src/commands/executor/dispatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl CommandExecutor {
9696
// ============ MCP ============
9797
// All MCP commands redirect to the interactive panel
9898
"mcp" => self.cmd_mcp(cmd),
99+
"mcp-list" => CommandResult::OpenModal(ModalType::McpManager),
99100
"mcp-tools" | "tools" | "lt" => CommandResult::OpenModal(ModalType::McpManager),
100101
"mcp-auth" | "auth" => CommandResult::OpenModal(ModalType::McpManager),
101102
"mcp-reload" => CommandResult::OpenModal(ModalType::McpManager),

src/cortex-tui/src/commands/executor/tests.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,16 @@ fn test_async_commands() {
256256
));
257257
}
258258

259+
#[test]
260+
fn test_mcp_list_opens_mcp_manager() {
261+
let executor = CommandExecutor::new();
262+
263+
assert!(matches!(
264+
executor.execute_str("/mcp-list"),
265+
CommandResult::OpenModal(ModalType::McpManager)
266+
));
267+
}
268+
259269
#[test]
260270
fn test_add_command() {
261271
let executor = CommandExecutor::new();

src/cortex-tui/src/commands/registry/builtin.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,15 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) {
581581
false,
582582
));
583583

584+
registry.register(CommandDef::new(
585+
"mcp-list",
586+
&[],
587+
"List MCP servers",
588+
"/mcp-list",
589+
CommandCategory::Mcp,
590+
false,
591+
));
592+
584593
registry.register(CommandDef::new(
585594
"mcp-auth",
586595
&["auth"],

src/cortex-tui/src/commands/registry/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ mod tests {
193193

194194
// MCP
195195
assert!(registry.exists("mcp"));
196+
assert!(registry.exists("mcp-list"));
196197
assert!(registry.exists("mcp-tools"));
197198
assert!(registry.exists("mcp-auth"));
198199
assert!(registry.exists("mcp-reload"));

0 commit comments

Comments
 (0)