Skip to main content

Module watch

Module watch 

Source
Expand description

example watch — health monitor for the MCP HTTP server.

Polls {url}/health on a fixed interval and emits a single stdout line whenever the server state changes. Stdout is the event stream; the plugin monitor runtime delivers each line to Claude as a notification.

States: UP — /health returned 2xx DEGRADED — /health returned a non-2xx HTTP response DOWN — connection refused / timeout / DNS failure

Only state changes produce output, so Claude isn’t spammed while the server is stable. The initial state always emits one line.

Functions§

run_watch
Run the health watch loop. Exits only on CTRL+C or fatal error.