Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion capiscio_mcp/guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,19 @@ 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)
_GUARD_SYNC_TIMEOUT = 30.0
try:
result = future.result(timeout=_GUARD_SYNC_TIMEOUT)
except (TimeoutError, concurrent.futures.TimeoutError):
future.cancel()
raise GuardError(
reason=DenyReason.INTERNAL_ERROR,
detail=(
f"Guard evaluation timed out after {_GUARD_SYNC_TIMEOUT}s. "
"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())
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down