diff --git a/capiscio_mcp/guard.py b/capiscio_mcp/guard.py index 215cca6..eb54054 100644 --- a/capiscio_mcp/guard.py +++ b/capiscio_mcp/guard.py @@ -688,7 +688,18 @@ async def run_eval(): # We're in an async context, use run_coroutine_threadsafe import concurrent.futures future = asyncio.run_coroutine_threadsafe(run_eval(), loop) - result = future.result(timeout=30.0) + try: + result = future.result(timeout=30.0) + except (TimeoutError, concurrent.futures.TimeoutError): + future.cancel() + raise GuardError( + reason=DenyReason.INTERNAL_ERROR, + detail=( + "Guard evaluation timed out. This usually means the " + "guard is being called outside of an MCP request context " + "or the gRPC core server is not responding." + ), + ) else: # No event loop, create one result = asyncio.run(run_eval()) diff --git a/pyproject.toml b/pyproject.toml index 3ecccce..bb7b9ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "capiscio-mcp" -version = "2.7.1" +version = "2.7.2" description = "Trust badges for MCP tool calls - RFC-006 & RFC-007 implementation" readme = "README.md" requires-python = ">=3.10"