From c3ee956dd4376d2c17bf5c3d539004571f644034 Mon Sep 17 00:00:00 2001 From: AI Bot Date: Fri, 26 Jun 2026 19:04:29 +0300 Subject: [PATCH] perf(mcp): skip startup adapter describe under single-surface (faster cold start) Co-Authored-By: Claude Opus 4.8 (1M context) --- src/nilscript/mcp/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nilscript/mcp/server.py b/src/nilscript/mcp/server.py index 27d4ce7..d5db888 100644 --- a/src/nilscript/mcp/server.py +++ b/src/nilscript/mcp/server.py @@ -604,7 +604,10 @@ def build_asgi_app( import asyncio verbs: list[str] = [] - if dynamic_tools and not multi_tenant: + # Single-surface hides dynamic verbs anyway, so skip the startup adapter describe (an Odoo + # fields_get that can take ~minute when the backend is cold) — it was the MCP's slow cold-start, + # which is exactly what left a window for Hermes to discover an unready MCP and cache 0 tools. + if dynamic_tools and not multi_tenant and not _single_surface(): verbs = asyncio.run(_discover_verbs(adapter_url, bearer)) from nilscript.mcp.automation_tools import AutomationTools from nilscript.mcp.brain_tools import BrainTools