Skip to content

Monitor

Pummelchen edited this page Sep 18, 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   4 ok · 1 failing · 4 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
  – Mojeek       index       NO KEY         –       –   –     –  set MOJEEK_API_KEY
  – Exa          search      NO KEY         –       –   –     –  set EXA_API_KEY
  ● SearXNG      aggregator  OK         986ms   986ms  28  100%  last ok 05:31:02
  – Open Web Se… aggregator  NO KEY         –       –   –     –  set OPEN_WEB_SEARCH_URL
  ● DuckDuckGo   scraper     OK         877ms   877ms  10  100%  last ok 05:31:02
  ✖ Startpage    scraper     FAIL       645ms       –   0    0%  Startpage is temporarily unavailable.
  ● Parallel Se… aggregator  OK        1687ms  1687ms  10  100%  last ok 05:31:02

  SEARXNG NODES   4 up · 0 down
    node          state       latency  results   ok  engines
  ● node1         UP          6101ms       25 100%  duckduckgo, google cse
  ● node2         UP          2020ms       20 100%  duckduckgo, google cse
  ● node3         UP          6078ms       25 100%  duckduckgo, google cse
  ● node4         UP          1745ms       25 100%  duckduckgo, google cse
────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ 4 provider(s) have no credentials; press p to probe the rest
  p probe providers  ·  r refresh now  ·  e toggle engines  ·  c toggle colour  ·  q quit

node1 in that frame is this machine. The local instance is probed over loopback and named after the host, and its remote entry is then dropped rather than listed twice. A machine is counted once, which matters because the engine warning threshold is a fraction of the node count: a duplicate would turn one machine's failing engine into "unavailable on 2 node(s)" — a fleet-level warning for a single machine.

macbook-ab is absent by design: it binds loopback only, so no other machine can reach it. It appears as the local node when the monitor runs there. To have it probed from elsewhere, rebind it with deploy/install.sh --method native --bind 0.0.0.0.

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's own instance plus node1–4, with the local machine not listed twice
--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 what is worth acting on, most urgent first: this machine's own instance being down (the local server has lost its local provider, which is a different problem from a remote node being unreachable), then remote nodes unreachable, then an engine failing on most nodes — a provider-level problem, not a node-level one — and finally providers still without credentials.

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