fix: derive demo-manifest MCP Hub status from real tool-call evidence

The demo manifest still reported the MCP Hub integration as operational purely
because MCP_HUB_REGISTRATION_ENABLED was set, while the integration status page
had already moved to evidence-based status in Batch 4. Registration is
catalog-driven on the Hub's side, so the flag alone proves nothing; reuse
derive_mcp_hub_status() so "operational" requires real recorded mcp_tool_request
calls.

No change to the MCP integration contract: the four read-only routes, service
token and client id handling, inbound X-Correlation-Id preservation, the locale
field on search-knowledge and the provider/correlation_id response fields were
verified as already correct at deployed revision 727c19a and left untouched.
This commit is contained in:
NuklearRabbit
2026-08-05 13:28:43 +00:00
parent dee8f2f7e9
commit e5307a7c0f
3 changed files with 35 additions and 8 deletions
+8 -5
View File
@@ -11,7 +11,7 @@ from app.models.booking import Booking
from app.models.data_quality import DataQualityIssue
from app.models.outbox import OutboxEvent
from app.schemas import DemoIntegrationSummaryOut, DemoManifestOut, DemoScenarioOut
from app.services.integration_status import derive_n8n_status
from app.services.integration_status import derive_mcp_hub_status, derive_n8n_status
from app.services.knowledge import get_knowledge_provider
settings = get_settings()
@@ -124,6 +124,7 @@ def _scenarios(db: Session) -> list[DemoScenarioOut]:
def _integrations(db: Session) -> list[DemoIntegrationSummaryOut]:
n8n = derive_n8n_status(db)
knowledge_health = get_knowledge_provider().health()
mcp_hub = derive_mcp_hub_status(db)
return [
DemoIntegrationSummaryOut(
@@ -147,11 +148,13 @@ def _integrations(db: Session) -> list[DemoIntegrationSummaryOut]:
),
DemoIntegrationSummaryOut(
key="mcp_hub",
status_code="operational" if settings.mcp_hub_registration_enabled else "notConnected",
# `MCP_HUB_REGISTRATION_ENABLED` on its own proves nothing: registration is
# catalog-driven on the Hub's side, so the flag only says Fleet Ops expects
# to be called. Only real recorded `mcp_tool_request` calls make this
# "operational" -- same evidence rule the integration status page uses.
status_code="operational" if mcp_hub.state == "operational" else "notConnected",
detail_code=(
"mcpDetailEnabled"
if settings.mcp_hub_registration_enabled
else "mcpDetailNotConnected"
"mcpDetailEnabled" if mcp_hub.state == "operational" else "mcpDetailNotConnected"
),
detail_params={},
),