Skip to content

Scheduled MCP health and discovery

Last updated: 2026-11-22T07:10:00-03:00 (UTC-3)

MCP health checks run when an administrator presses Check health. Scheduled checks run the same reachability and tool discovery in the background, for the servers that opt in, so a server that goes down or changes its tools is noticed without waiting for a call. They never run on a request path, never take a request admission slot and never call a tool.

Flag Default What it turns on
mcp_scheduled_health false The background worker, the schedule routes and the registry card line; an operator control; requires mcp_health_checks (and so mcp_execution), and PostgreSQL

A server is a candidate when a background check could reach it with the gateway’s own trust:

  • a boot (YAML) server with execution trust whose registry entry is enabled, streamable_http and at the trusted URL, checked with its boot credential_env under the boot egress policy;
  • an active console-managed MCP server (not a generated API source), checked under that server’s own-origin egress policy and without a credential.

Servers declared auth: per_user_oauth or auth: token_exchange are never checked in the background: their calls need a user’s own credential, and a team or user credential is never used without a caller.

A candidate runs on schedule when, in this order:

  1. its console override says so (PUT .../scheduled-health, true or false);
  2. else its YAML mcp_execution.servers[].scheduled_health (true or false; boot servers only);
  3. else mcp_execution.scheduled_health.default_enabled.
Key Default Bounds Meaning
mcp_execution.scheduled_health.default_enabled false Schedule every candidate without an explicit choice
mcp_execution.scheduled_health.interval_seconds 300 60–86400 Time between two checks of one server
mcp_execution.scheduled_health.jitter_seconds 30 0–3600, below the interval A random 0..jitter added to each next check
mcp_execution.scheduled_health.timeout_seconds 10 1–60 Bound of one check (initialize or server/discover, and the listing)
mcp_execution.scheduled_health.max_per_tick 8 1–64 Checks one replica starts per scheduler tick (every 15 seconds)
mcp_execution.servers[].scheduled_health inherit true, false YAML opt-in or opt-out of one boot server

All are boot configuration (restart to change); the console override is stored in PostgreSQL and takes effect at the next tick.

features:
mcp_health_checks: true
mcp_scheduled_health: true
mcp_execution:
scheduled_health:
interval_seconds: 600
jitter_seconds: 60
servers:
- id: tickets
endpoint_url: https://tickets.example.com/mcp
credential_env: TICKETS_MCP_TOKEN
scheduled_health: true
tools: [{name: lookup, allowed_team_ids: [support]}]

Each server has one row in gateway_mcp_scheduled_health. A replica checks a server only after taking its lease in one UPDATE: the server is due (never checked, or next_due_at passed) and no unexpired lease exists, both on the database clock. The lease lasts the timeout plus 15 seconds. The result is written only while that replica still holds the lease; a check that outlived it is dropped (lost_lease), never written over a newer one. A crashed replica’s lease expires on its own. Turning a server on through the console makes it due at once. With the flag off, or without PostgreSQL, no replica checks anything.

Each result stores what a manual check returns: reachable, error_class, latency_ms, tool_count, granted_tools, missing_tools, the negotiated protocol_version, and the drift lists added_tools, removed_tools and changed_tools, against the reviewed tool set:

Server Reviewed set On drift
Console-managed Its approved snapshot A snapshot with source scheduled is recorded in its discovery history. When an approved tool is missing, outside the validated profile or has another schema, the server’s drift review is raised (drift_pending) and that tool stays quarantined until an administrator approves again. Nothing is ever approved by a check
Boot The previous scheduled result (its trust is reviewed in YAML) Reported on the card; with mcp_boot_discovery_history a scheduled snapshot joins its read-only history; the next check compares with this one

A failed check keeps the last known tools as the baseline; a server that listed no tools has an empty baseline, so its first tools are drift. A description change of a managed server’s tool counts as a change; boot servers compare schema hashes only. A check that outlived its lease records no snapshot and no review flag. Upstream error text, tool descriptions, credentials and session IDs are never stored, returned or logged. A failure records the alert event mcp_health_failed (at most once per server per 10 minutes) and drift records mcp_tool_drift (at most once per server per hour), when an alert channel subscribes to them.

Route Permission Does
GET /api/v1/admin/mcp/scheduled-health mcp:read Every candidate with enabled, enabled_source (console, yaml, default), checking, next_due_at and its last result (marked stale after twice the interval), plus the effective scheduled_health block (it was named settings; the same values are in GET /api/v1/admin/config as mcp_execution.scheduled_health, with each boot server’s own scheduled_health choice under mcp_execution.servers). Reading never contacts a server
PUT /api/v1/admin/mcp/servers/{id}/scheduled-health mcp:manage, CSRF {"enabled": true}, false, or null to inherit; audited as mcp_scheduled_health.enable, .disable or .inherit; answers the listing; 404 for a server that is not a candidate
{
"items": [
{
"server_id": "tickets",
"managed": false,
"enabled": true,
"enabled_source": "yaml",
"checking": false,
"next_due_at": "2026-11-17T22:31:12Z",
"result": {"server_id": "tickets", "reachable": true, "tool_count": 4, "granted_tools": 1, "missing_tools": [],
"latency_ms": 84, "checked_at": "2026-11-17T22:21:05Z", "added_tools": ["export_all"], "removed_tools": [],
"changed_tools": [], "baseline": true, "stale": false, "source": "scheduled", "managed": false,
"protocol_version": "2025-11-25"}
}
],
"scheduled_health": {"default_enabled": false, "interval_seconds": 600, "jitter_seconds": 60, "timeout_seconds": 10, "max_per_tick": 8}
}

MCP registry: the health line of a trusted server shows the newer of the manual and the scheduled result, and below it the schedule (“Scheduled every 600 s (YAML) · next 19:31”) with an Inherit / On / Off choice for mcp:manage. Viewers see the line without the choice.

  • gateway_mcp_scheduled_checks_total{outcome}: reachable, drift, lost_lease or the error class.
  • gateway_mcp_health_checks_total{server,outcome} counts scheduled checks too.
  • Each check logs mcp_scheduled_health_check with its own request_id (mcp-health-…) and trace_id, which also go to the server as X-Request-Id and traceparent.

Migration 189 creates gateway_mcp_scheduled_health and allows the snapshot source scheduled. An older binary rejects the flag name and the new keys in YAML: remove them before rolling back; an older binary reading a scheduled snapshot shows its source as stored. Turn the flag on after every replica runs this release; older replicas never check.

m7gtw[email protected]