Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cortex-tui/src/commands/executor/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
8 changes: 8 additions & 0 deletions src/cortex-tui/src/commands/executor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
18 changes: 18 additions & 0 deletions src/cortex-tui/src/commands/registry/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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",
&[],
Expand Down
20 changes: 10 additions & 10 deletions src/cortex-tui/src/commands/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down