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 <christian.pritzl@iu.org>
This commit is contained in:
Chris 2025-07-22 19:45:43 +02:00 committed by GitHub
parent b270cf246d
commit 83ab74f585
1 changed files with 6 additions and 4 deletions

View File

@ -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)}"