pir-mcp
This server is a privacy-preserving motion sensor for AI agents: it watches named screen rectangles or windows, and reports only change metrics (rmse/peak), never images. Capabilities:
Define regions:
pir_define_region(fixed coordinates, optional masks) orpir_define_window(follows a moving window).Human-assisted selection:
pir_pick_region,pir_pick_mask,pir_pick_windowlet a person draw/click the area to watch, with a requiredpurposenote.Sample on demand:
pir_samplecaptures once and scores against the previous sample (baseline or quick check).Block for changes:
pir_wait_for_changewaits until the region changes or times out (doorbell for build output, dialogs, etc.).Block for stillness:
pir_wait_for_stillnesswaits until the region has been still for a set duration—detects frozen status bars, animations settling, or crashes.Manage regions:
pir_list_regionsandpir_remove_regionfor housekeeping.Tunable sensitivity: per-call
threshold,metric(rmse for whole-region, peak for small ticking elements),interval_ms, andtimeout_ms.No image output: never returns pixels or writes frames to disk; all data is reduced to coarse averaged grids (≤64 cells) for privacy.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pir-mcp watch my build output and tell me when it changes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pir-mcp
A motion sensor for AI agents.
"Gives your LLM agents enough info to be a helpful "watcher" without being a privacy nightmare like Windows Recall" -Solteris-Dev
A PIR sensor tells you that something moved, never what. This is the same idea for a screen: an MCP server that watches named rectangles and answers "did this change?" and "has this gone still?" with a number, a size and a timestamp. No tool in it returns pixels, image files, or anything that could be turned back into a picture.
It exists because an agent driving a desktop keeps needing the same two things: wake me when the build output moves and tell me if this status bar has stopped ticking. Both are motion questions. Neither needs a screenshot.
What it does
pir_pick_regionask the person at the screen to draw the rectangle, the way a regional screenshot works (slurp, slop). The human chooses what is sensed; the agent gets the geometry. Use this whenever someone is there.pir_pick_maskthe same gesture for a patch inside a region to ignore (a clock, a spinner, a caret).pir_define_regionthe scriptable path: name a rectangle by global layout coordinates, with optional masks.pir_pick_window/pir_define_windowwatch a window instead of a fixed rectangle. Its geometry is looked up again before every capture, so the region follows the window when it moves; a resize counts as maximal change. The pick offers your visible windows as boxes to click.pir_samplecapture once, score against the previous sample of that region. Cheap; also the way to check the capture command works.pir_wait_for_changeblock until the region departs from how it looked when the call began, or time out. A doorbell.pir_wait_for_stillnessblock until nothing has changed forstill_for_ms, or time out. A short window means "the animation settled, safe to act". A long window on something that should keep changing means it is frozen, andstill=trueis the alarm.pir_list_regions,pir_remove_regionhousekeeping.
Every comparison reports two numbers over a coarse grid of averaged colour cells (at most 64 across, each at least 4 px), both 0 for identical and 1 for black against white:
rmseover the whole grid: did the region as a whole move? A cursor edge or an antialiased caret scores about 0.02; a dialog opening 0.1 or more. This is the default metric, threshold 0.05.peakthe single most-changed cell: did anything in it move? A clock digit flipping inside a 1920-wide status bar scores rmse 0.018 (invisible to the default) but peak 0.145. Usemetric=peakfor a small thing that should tick inside a larger region.
Averaging is what makes this a sensor rather than a camera: 64 cells cannot be read.
Related MCP server: settled-computer
What it deliberately does not do
It never returns image data. There is no snapshot tool and none is planned. If an agent needs to see, use the screenshot tool your environment already has, so that choice stays explicit and yours.
It never writes frames to disk. A capture lives in memory for the milliseconds it takes to reduce it to a grid, and only the grid of the last sample is kept per region.
It does not capture on its own. Every sample is a tool call the agent made, visible in the transcript, and
pir_pick_regioncarries apurposeline the agent has to write down before you draw.
What it does reveal, so you can decide whether that is acceptable: that a given rectangle changed, at a given time, by a given magnitude. On a region covering a chat window that is presence information. Choose regions accordingly; the server has no opinion.
The capture itself is delegated to a command you configure, run with your
privileges. The default is grim, so nothing here has screen access that you
did not already give to grim.
Install
It is on npm as pir-mcp and in
the official MCP Registry
as io.github.Solteris-Dev/pir-mcp, so most clients can run it with
npx -y pir-mcp and no clone:
claude mcp add -s user pir -- npx -y pir-mcpFrom source:
git clone https://github.com/Solteris-Dev/pir-mcp
cd pir-mcp && npm install && npm run buildRequires Node 20+ and a screenshot tool that can write binary PPM to stdout.
Capture command
PIR_CAPTURE_CMD is a template; {x} {y} {w} {h} are substituted and the
result runs under sh -c. It must print a binary PPM (P6) to stdout.
environment | command |
wlroots / Hyprland / Sway (default) |
|
X11 with maim |
|
X11 with ImageMagick |
|
macOS |
|
Coordinates are whatever the capture tool uses. On a wlroots layout that is the global layout, so an output placed left of the primary has negative x.
Selector command
PIR_SELECT_CMD runs when an agent calls pir_pick_region or
pir_pick_mask and must print x,y wxh. Set it to an empty string to remove
those tools entirely.
environment | command |
wlroots / Hyprland / Sway (default) |
|
X11 |
|
macOS | see contrib/macos (untested) |
Window commands
PIR_WINDOW_GEOMETRY_CMD gets {id} substituted and must print x,y wxh
for that window; PIR_PICK_WINDOW_CMD must print the id of the window the
person chose. Both default to Hyprland (via jq and slurp -r). Set either
to an empty string to remove the corresponding tools. Window ids are limited
to [A-Za-z0-9_.:-] before they reach a shell.
environment | geometry | pick |
Hyprland (default) |
| visible windows as slurp boxes, prints the address |
Sway |
|
|
X11 |
|
|
Only the Hyprland pair has been run; the others are written from the tools' documentation.
Claude Code
claude mcp add -s user pir -- npx -y pir-mcp
# or, from a source checkout:
claude mcp add -s user pir -- node /path/to/pir-mcp/dist/stdio.jsBlocking calls default to 55 s and are capped by PIR_MAX_WAIT_MS (540 s).
Keep the cap under your host's MCP tool timeout; an agent that needs to watch
for longer just calls again.
Other settings
variable | default | meaning |
| unset | JSON file of regions to define at startup |
|
| default change threshold |
|
| default sampling period |
|
| default timeout for blocking calls |
|
| cap for blocking calls |
|
| how long one capture may take |
|
| how long the person has to draw a selection |
|
| grid resolution on the long side; smaller is coarser and more private |
A regions file looks like:
[
{ "name": "bar", "x": 0, "y": 0, "w": 1920, "h": 26,
"masks": [{ "x": 1690, "y": 0, "w": 110, "h": 26 }] }
]Example
The case that produced this: a status bar that occasionally froze for hours while its process looked healthy. The clock in it should change every minute, so a bar that is still for three minutes is a frozen bar.
pir_pick_region name=bar purpose="watch the status bar for a freeze"
pir_wait_for_stillness name=bar still_for_ms=180000 metric=peak timeout_ms=540000still=true comes back only if the bar stopped; otherwise the call returns
still=false at the timeout and the agent calls again. Nothing on the screen
was ever seen, and the person drew the rectangle themselves.
Contributing starting points
contrib/macos/ holds an AppKit rectangle selector and capture recipe,
written blind and untested. If you run it on a real Mac, fix what breaks and
send it back.
Tests
npm testLicense
MIT.
Available Tools
10 toolspir_define_regionA
Name a rectangle of the screen to watch. Coordinates are in the global layout the capture tool uses (on a multi-monitor wlroots layout an output left of the primary has negative x). Masks are rects inside the region, in region-local pixels, that are ignored: put a clock or spinner there. Redefining a name replaces it and forgets its last sample.
Inputs: h (required), w (required), x (required), y (required), +2 more.
pir_define_windowA
Watch a window rather than a fixed rectangle: geometry is looked up from the window id before every capture, so the region follows the window when it moves. A resize counts as maximal change. Masks are window-local. The id is whatever your window-geometry command understands (a Hyprland address like 0x5f3a..., an X11 window id).
Inputs: name (required), window (required), masks.
pir_list_regionsA
The regions currently defined, with their geometry and masks.
Inputs: no named parameters.
pir_pick_maskA
Ask the person to draw a rectangle inside an existing region that should be ignored (a clock, a spinner, a caret). Forgets the region's last sample, since masked grids are not comparable to unmasked ones.
Inputs: name (required).
pir_pick_regionA
Ask the person at the screen to draw the rectangle to watch (a selector such as slurp appears; Escape cancels). Prefer this over pir_define_region whenever a human is present: they choose what is sensed, and you get the geometry back. Blocks until they finish or the selector times out.
Inputs: name (required), purpose.
pir_pick_windowA
Ask the person at the screen to click the window to watch (visible windows are offered as boxes; Escape cancels). The region then follows that window. Prefer this over pir_define_window when a human is present.
Inputs: name (required), purpose.
pir_remove_regionC
Forget a region.
Inputs: name (required).
pir_sampleA
Capture the region once and score it against the previous sample of the same region (null on the first call). Cheap and non-blocking: use it to check the capture command works, to take a baseline before doing something, or to ask 'did anything happen there since I last looked?'.
Inputs: name (required).
pir_wait_for_changeA
Block until the region looks different from how it looked when this call started, or until timeout_ms. Returns changed=true with the score, or changed=false with the largest score seen. Use it as a doorbell: 'wake me when the build output moves', 'when the dialog closes', 'when the game loads'.
Inputs: name (required), metric, threshold, timeout_ms, +1 more.
pir_wait_for_stillnessA
Block until consecutive samples have stayed below threshold for still_for_ms, or until timeout_ms. A short window means 'the page/animation has settled, safe to act'. A long window on something that should keep changing (a clock, a progress bar, a status bar) means it is frozen: still=true is then the alarm.
Inputs: name (required), still_for_ms (required), metric, threshold, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct operation: sampling, defining, picking, waiting, listing, removing. The define/pick and change/stillness pairs are clearly differentiated by coordinate vs. human selection and blocking vs. non-blocking behavior.
All tools follow the pir_ prefix with snake_case verb_noun or verb_prep_noun patterns (e.g., define_region, wait_for_change, list_regions). The naming is uniform and predictable.
Ten tools is well-scoped for a screen-region monitoring server, covering definition, selection, observation, and removal without unnecessary duplication or bloat.
The lifecycle is well covered: define/pick/list/remove regions, plus sample and wait operations. Minor gaps exist—masks can only be added interactively via pir_pick_mask, and there is no explicit update tool—but redefining a region replaces it, so most workflows are supported.
Related MCP Connectors
Recurring webpage change, price, inventory and metadata monitoring for autonomous agents.
Give agents eyes on any web page: structured context, and changes explained in plain language.
Flags when an AI agent's context is stale: freshness score 0-100 and source change detection.
AI agent monitoring: alerts when your agents fail, stall or need you
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to see, analyze, and visually verify web page changes through pixel-perfect diffing, theme extraction, layout analysis, and interactive element detection.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to use a desktop computer with event-driven settling, waiting for the screen to react and stabilize before returning a settled screenshot and verdict.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to inspect UI screen recordings as token-efficient image sheets with changed regions boxed, single-frame flicker flagged, and speech aligned to frames. Exposes watch_video and zoom_video tools so agents can pull dense keyframes across any time range or one sharp full-resolution frame, all processed locally.26 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to capture and inspect the screen with coordinate grids, request consent-gated camera frames, annotate the real display with shapes and text bubbles, and wait for visual changes through a hidden background service.3MIT