diff --git a/scripts/cli/client.py b/scripts/cli/client.py index 1f7b97e..ba0f35d 100644 --- a/scripts/cli/client.py +++ b/scripts/cli/client.py @@ -105,10 +105,16 @@ async def call_tool( return {"status": "ok", "raw": ""} - except Exception as e: + except BaseException as e: + # Unwrap ExceptionGroup / TaskGroup to surface the real error. + # The MCP SDK uses anyio TaskGroups; on auth failure (401) the + # actual HTTP error is buried inside an ExceptionGroup. + cause = e + while isinstance(cause, BaseExceptionGroup) and cause.exceptions: + cause = cause.exceptions[0] return { "status": "error", - "message": f"Erreur MCP : {e}", + "message": f"Erreur MCP : {cause}", } async def list_tools(self) -> list: diff --git a/scripts/cli/commands.py b/scripts/cli/commands.py index e4db390..589a742 100644 --- a/scripts/cli/commands.py +++ b/scripts/cli/commands.py @@ -39,7 +39,7 @@ async def _run(): result = await client.call_tool(tool_name, args) if json_flag: show_json(result) - elif result.get("status") in ("ok", "healthy", "created", "deleted", "connected", "disconnected"): + elif result.get("status") in ("ok", "healthy", "degraded", "created", "deleted", "connected", "disconnected"): on_success(result) else: show_error(result.get("message", f"Erreur: {result.get('status', '?')}"))