Skip to content

Monitor

Pummelchen edited this page Sep 13, 2026 · 6 revisions

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker


What it is

mcps-mon is a live terminal dashboard for the deployment: which search providers and which SearXNG nodes are up, how fast they answer, and which are returning errors. It is a separate executable, so watching the system never disturbs the server.

swift run mcps-mon            # node health; providers probed once on the first frame
swift run mcps-mon --probe    # also measure provider latency and errors on every refresh
  MCPSearch Monitor  providers and nodes            up 4m12s  cycle 1.2s  refreshed 05:31:08
────────────────────────────────────────────────────────────────────────────────────────────
  PROVIDERS   3 ok · 1 failing · 6 without credentials
    provider        kind       state       last     avg   n   ok%  note
  ● Tavily          index      OK        3241ms  3120ms   5  100%  last ok 05:31:02
  ○ Brave Search    index      NO KEY         –       –   –     –  set BRAVE_SEARCH_API_KEY
  ● DuckDuckGo      scraper    OK        1398ms  1502ms  10  100%  last ok 05:31:02
  ✖ Startpage       scraper    FAIL       917ms       –   0    0%  Startpage is temporarily unavailable.
  ● Parallel Sear…  aggregator OK        2457ms  2390ms  10  100%  last ok 05:31:02

  SEARXNG NODES   5 up · 0 down
    node          state       latency  results   ok  engines
  ● this-mac      UP         1225ms       23 100%  duckduckgo, google cse
  ● node1         UP         2109ms       29 100%  brave, google cse
  ● node2         UP         1661ms       29 100%  brave, google cse
  ● node3         UP         1241ms       29 100%  brave, google cse
  ● node4          UP         752ms       29 100%  brave, google cse
────────────────────────────────────────────────────────────────────────────────────────────
  p probe providers  ·  r refresh now  ·  e toggle engines  ·  c toggle colour  ·  q quit

Choosing what to probe

Command Cost What it measures
mcps-mon one credit per keyed provider on the first frame only, then free Node reachability, latency, results, per-engine health, and one provider snapshot
mcps-mon --probe 1 credit per working keyed provider per refresh All of the above on every refresh

Providers are probed on the first pass so the dashboard is populated immediately, and then only when the operator runs --probe or presses p. There is deliberately no periodic probe term: an unattended dashboard must not spend credits. Node health alone is free, but the first frame still performs one provider probe per configured keyed provider.

Options

Flag Purpose
--node <name=url> Add a node (repeatable). Defaults to this machine plus node1–4
--no-nodes Skip node probing entirely
--interval <seconds> Refresh interval, default 10
--probe Also probe providers with a real search on every refresh
--watch Alias for --probe
--allow-expensive-probing Permit probe intervals below the 60 s floor (a 10 s interval costs roughly 360 credits/hour per keyed provider)
--iterations <n> Stop after n refreshes, for scripts and CI
--no-colour Disable ANSI colour (--no-color is accepted too)
--no-engines Hide the per-node engine breakdown
--help Usage

The 60 s interval floor is applied only when --probe is set, and only until --allow-expensive-probing overrides it.

Keys: p probe now, r refresh, e toggle engines, c toggle colour, q quit.

How it probes

Nodes are asked for JSON directly (/search?format=json), not through the MCP server. That distinction matters: an instance that is running but has JSON disabled returns HTTP 403, and a monitor that reported that as "down" would send an operator hunting for a network fault. It is shown as DEGRADED with the actual reason.

Providers are called through the same adapters the server uses, one provider at a time rather than through the orchestrator. A fused answer deliberately hides which provider failed; the dashboard exists to show exactly that.

Both are probed concurrently, each with its own short timeout, so one dead provider cannot stall the display. Probe queries rotate through a small set so repeated refreshes do not all hit the same cached page upstream.

Reading it

  • ● healthy, ○ idle or not yet probed, ✖ failing, – not configured.
  • NO KEY means the provider is known but has no credentials; the note names the environment variable to set.
  • Average latency is over successful probes only, so a slow failure cannot skew it.
  • ok% is successes over attempts for this session, not a provider SLA.
  • The warnings line calls out the things worth acting on. An engine failing on most nodes is a provider-level problem, not a node-level one, and is surfaced as such.

Non-interactive use

When stdout is not a terminal, the monitor renders plain frames instead of cursor escapes, so it can be redirected or run in a script:

swift run mcps-mon --iterations 1 --no-colour   # one plain snapshot

A redirected frame is not sized for a screen: it carries exactly its content, with no blank filler and no section capped to an assumed height. The interactive path — keys, colour and cursor control — is covered by scripts/monitor_tty_smoke.py, which drives a live dashboard through a pseudo-terminal rather than a window; see Testing. The dashboard pads and caps when it is drawing to a terminal, so the footer sits at the bottom of the display; a frame in a file or a pipe has no display to fill, and silently hiding a provider behind "… N more" would be the worse surprise.

Where the code lives

Path Contents
Sources/MCPSMonitor/main.swift CLI parsing and the refresh loop
Sources/WebSearchCore/Monitor/ Terminal primitives, renderer, model, probes
Tests/WebSearchCoreTests/MonitorTests.swift Layout, rendering, metric accumulation
Tests/MCPSMonitorTests/ CLI parsing

The testable parts live in the library rather than the executable, because an executable's symbols cannot be imported by a test target. Layout is a pure function of the model for the same reason: it can be asserted without a terminal.

Clone this wiki locally