From 83ab74f585f080daefa116a4c7158e059f7bfd0d Mon Sep 17 00:00:00 2001 From: Chris <41129709+chrissRo@users.noreply.github.com> Date: Tue, 22 Jul 2025 19:45:43 +0200 Subject: [PATCH] Improve MCP command messaging for existing servers (#229) Improve MCP command error messaging for existing servers * Update the messages when attempting to add an already loaded server -> this should clarify that the server is active and there is no error * Provide guidance on how to reload it Co-authored-by: christian.pritzl --- src/cai/repl/commands/mcp.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cai/repl/commands/mcp.py b/src/cai/repl/commands/mcp.py index a2dc6884..aba85e74 100644 --- a/src/cai/repl/commands/mcp.py +++ b/src/cai/repl/commands/mcp.py @@ -602,8 +602,9 @@ Example: `/mcp add burp 13` True if successful """ if name in _GLOBAL_MCP_SERVERS: - console.print(f"[yellow]Server '{name}' already exists. Remove it first.[/yellow]") - return False + console.print(f"[yellow]Server '{name}' is already loaded and active.[/yellow]") + console.print(f"[dim]Use '/mcp remove {name}' first if you want to reload it.[/dim]") + return True console.print(f"Connecting to SSE server at {url}...") @@ -690,8 +691,9 @@ Example: `/mcp add burp 13` True if successful """ if name in _GLOBAL_MCP_SERVERS: - console.print(f"[yellow]Server '{name}' already exists. Remove it first.[/yellow]") - return False + console.print(f"[yellow]Server '{name}' is already loaded and active.[/yellow]") + console.print(f"[dim]Use '/mcp remove {name}' first if you want to reload it.[/dim]") + return True console.print( f"Starting stdio server '{name}' with command: {command} {' '.join(cmd_args)}"