INNER CODE UNIT · Python
_check_params_urls
tiliondev/fortress · mcp/server.py:146
async def _check_params_urls(params: dict | None) -> None:
"""Defense-in-depth: SSRF-check any URL-looking values a flow might navigate to."""
for v in (params or {}).values():
if isinstance(v, str) and v[:8].lower().startswith(("http://", "https:/")):
await _check_url(v)
@asynccontextmanager
async def _lifespan(_server):
"""Pre-warm the stealth browser at server startup so the agent's FIRST tool
call is a ~150ms warm hit, not a ~2.2s cold launch. Disable with
TILION_MCP_PREWARM=0. Shuts the browser down cleanly on exit."""
if _env("MCP_PREWARM", "1") != "0":
try:
await _t()
except Exception:
pass # never let a pre-warm failure block the server
try: