diff --git a/hermes_cli/mcp_config.py b/hermes_cli/mcp_config.py index 377c6b20b..bb8f89487 100644 --- a/hermes_cli/mcp_config.py +++ b/hermes_cli/mcp_config.py @@ -225,13 +225,15 @@ def _probe_single_server( server = await asyncio.wait_for( _connect_server(name, config), timeout=connect_timeout ) - for t in server._tools: - desc = getattr(t, "description", "") or "" - # Truncate long descriptions for display - if len(desc) > 80: - desc = desc[:77] + "..." - tools_found.append((t.name, desc)) - await server.shutdown() + try: + for t in server._tools: + desc = getattr(t, "description", "") or "" + # Truncate long descriptions for display + if len(desc) > 80: + desc = desc[:77] + "..." + tools_found.append((t.name, desc)) + finally: + await server.shutdown() try: _run_on_mcp_loop(_probe(), timeout=connect_timeout + 10)