mirror of
https://github.com/Monadical-SAS/cubbi.git
synced 2025-12-21 12:49:07 +00:00
fix: handle removing MCP in no sessions
Why: The attribute mcps doesn't seem to be set in any session object anywhere in the codebase.
This commit is contained in:
@@ -1282,14 +1282,17 @@ def mcp_logs(
|
|||||||
|
|
||||||
@mcp_app.command("remove")
|
@mcp_app.command("remove")
|
||||||
def remove_mcp(name: str = typer.Argument(..., help="MCP server name")) -> None:
|
def remove_mcp(name: str = typer.Argument(..., help="MCP server name")) -> None:
|
||||||
"""Remove an MCP server configuration"""
|
"""Remove an MCP server configuration.
|
||||||
|
|
||||||
|
It does not stop the server nor remove it from docker.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
# Check if any active sessions might be using this MCP
|
# Check if any active sessions might be using this MCP
|
||||||
active_sessions = container_manager.list_sessions()
|
active_sessions = container_manager.list_sessions()
|
||||||
affected_sessions = []
|
affected_sessions = []
|
||||||
|
|
||||||
for session in active_sessions:
|
for session in active_sessions:
|
||||||
if session.mcps and name in session.mcps:
|
if getattr(session, 'mcps', []) and name in session.mcps:
|
||||||
affected_sessions.append(session)
|
affected_sessions.append(session)
|
||||||
|
|
||||||
# Just warn users about affected sessions
|
# Just warn users about affected sessions
|
||||||
|
|||||||
Reference in New Issue
Block a user