@tmhs/screencast-mcp 0.47.0 → 0.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +28 -247
  2. package/assets/fonts/Inter-Bold.ttf +0 -0
  3. package/assets/fonts/Inter-Regular.ttf +0 -0
  4. package/dist/cli.js +189 -34
  5. package/dist/server.js +13 -0
  6. package/dist/setup.js +437 -0
  7. package/dist/tools/assembleHighlights.js +2 -0
  8. package/dist/tools/cutByTranscript.js +3 -3
  9. package/dist/tools/exportPreset.js +2 -0
  10. package/dist/tools/indexRecording.js +37 -15
  11. package/dist/tools/narrate.js +3 -1
  12. package/dist/tools/pipeline.js +23 -11
  13. package/dist/tools/searchRecording.js +9 -3
  14. package/dist/tools/startRecording.js +72 -42
  15. package/dist/tools/stepGuide.js +57 -4
  16. package/dist/tools/titleCard.js +2 -0
  17. package/dist/tools/xfadeTransition.js +2 -0
  18. package/dist/utils/argPaths.js +39 -0
  19. package/dist/utils/audioDevices.js +0 -4
  20. package/dist/utils/captions.js +5 -3
  21. package/dist/utils/events.js +40 -8
  22. package/dist/utils/gpu.js +50 -4
  23. package/dist/utils/lifecycle.js +56 -16
  24. package/dist/utils/media.js +3 -2
  25. package/dist/utils/monitors.js +34 -3
  26. package/dist/utils/narrate.js +12 -3
  27. package/dist/utils/ocr.js +8 -3
  28. package/dist/utils/paths.js +41 -3
  29. package/dist/utils/pause.js +15 -1
  30. package/dist/utils/pipeline.js +5 -1
  31. package/dist/utils/recipes.js +7 -3
  32. package/dist/utils/recorder.js +20 -11
  33. package/dist/utils/recordingIndex.js +54 -8
  34. package/dist/utils/replay.js +20 -2
  35. package/dist/utils/retention.js +4 -1
  36. package/dist/utils/roots.js +1 -1
  37. package/dist/utils/sessions.js +3 -4
  38. package/dist/utils/sheet.js +4 -4
  39. package/dist/utils/stepGuide.js +26 -0
  40. package/dist/utils/transcriptCut.js +20 -5
  41. package/package.json +7 -5
package/README.md CHANGED
@@ -32,12 +32,14 @@ Capture the desktop, a monitor, a window, or a region; sample a recording into f
32
32
 
33
33
  <sub>Made with the tool: <code>start_recording</code> with <code>events: true</code>, one click, then <code>zoom { highlightClicks: true }</code> and <code>export_gif</code>. <a href="https://tmhsdigital.github.io/screencast-mcp/workflows/zoom-clicks.html">How it was made</a> · <a href="https://tmhsdigital.github.io/screencast-mcp/workflows/">more workflows</a></sub>
34
34
 
35
- [Quick start](#quick-start) · [Tools](#tools) · [Configuration](#configuration) · [Usage](#usage) · [Privacy](#privacy) · [Threat model](#threat-model)
35
+ [Quick start](#quick-start) · [Tools](#tools) · [Configuration](#configuration) · [More docs](#more-docs) · [Privacy](#privacy)
36
36
 
37
37
  </div>
38
38
 
39
39
  ## Quick start
40
40
 
41
+ The fastest path: `npx -y @tmhs/screencast-mcp setup` checks FFmpeg 8, OCR, and speech, offers `winget install Gyan.FFmpeg` when FFmpeg is missing, and adds the server to Claude Desktop, Claude Code, Cursor, and VS Code (backing up each config). `--dry-run` shows the changes first; `--test` records a 3-second GIF to prove it works. Or set it up by hand:
42
+
41
43
  **You need** Windows 10 or 11, [Node.js](https://nodejs.org) 22+, and **FFmpeg 8 or newer** on `PATH` (`winget install Gyan.FFmpeg`, the full build). Older builds run most tools, but `transcribe` (the `whisper` filter) and `backend: "wgc"` (`gfxcapture`) need FFmpeg 8, and essentials or distro builds can lack them (Ubuntu LTS `apt install ffmpeg` gives 6.x). Capture is Windows-only; the watch, edit, and produce tools work anywhere ffmpeg runs. After connecting, ask the agent to run `doctor`: it reports the ffmpeg version, the filters and devices it has, OCR, and anything missing.
42
44
 
43
45
  **Add it to your client:**
@@ -49,11 +51,7 @@ Capture the desktop, a monitor, a window, or a region; sample a recording into f
49
51
  | Cursor, VS Code, others | The JSON config below, or step-by-step on [Connect your client](https://tmhsdigital.github.io/screencast-mcp/connect.html) |
50
52
 
51
53
  ```json
52
- {
53
- "mcpServers": {
54
- "screencast": { "command": "npx", "args": ["-y", "@tmhs/screencast-mcp"] }
55
- }
56
- }
54
+ { "mcpServers": { "screencast": { "command": "npx", "args": ["-y", "@tmhs/screencast-mcp"] } } }
57
55
  ```
58
56
 
59
57
  **Then ask your agent:**
@@ -62,27 +60,9 @@ Capture the desktop, a monitor, a window, or a region; sample a recording into f
62
60
 
63
61
  More in the [workflows](https://tmhsdigital.github.io/screencast-mcp/workflows/): a bug-repro GIF for a PR, a README demo, a UI verification loop, a social clip, a cheap review of a long recording, zoom toward clicks, and the whole edit in one call.
64
62
 
65
- ## Overview
66
-
67
- Screencast MCP gives an agent a screen recorder it can drive and reason about. It speaks [Model Context Protocol](https://modelcontextprotocol.io) over stdio and exposes ffmpeg as a small, typed tool surface rather than a flag soup. The defining capability is the **watch loop**: an agent records footage, samples it into PNG frames, and views those frames to confirm what actually happened on screen.
68
-
69
- The design choices are deliberate rather than incidental:
70
-
71
- - **Capture is always explicit.** A recording or screenshot happens only on a tool call — nothing auto-fires and there is no background or scheduled capture.
72
- - **Footage is made viewable.** `sample_frames` turns a video into images returned straight to the model, so "watch what happened" is a first-class operation, not an afterthought.
73
- - **Presets over raw flags.** Quality is `draft` / `standard` / `high`; the agent never reasons about codecs, CRF, or pixel formats.
74
- - **Safe by default.** Output lands under `SCREENCAST_HOME`, never inside a project checkout, and the public repo's `.gitignore` blocks captured media from being committed.
75
- - **Recordings end.** When the client disconnects (or the server gets SIGINT/SIGTERM), every active recording is finalized and the server exits. Every recording also has a `maxDurationSec` cap (default one hour). A recording interrupted by a hard crash is reconciled on the next start (orphan reaping).
76
-
77
- What it can do beyond record-and-look:
63
+ ## Why not just...
78
64
 
79
- - **Zoom toward clicks.** Record with `events: true` and `zoom` glides in on each click and rings it, Screen Studio style.
80
- - **Review before sharing.** In clients with MCP Apps, `review_recording` opens an inline player where a person trims and draws redaction boxes.
81
- - **Find and cover secrets.** `find_text` reads the screen with Windows OCR and returns rectangles for `redact_region`.
82
- - **One call, one encode.** `pipeline` runs trim, crop, redact, callouts, and an export as a single ffmpeg pass; `recipe: "tutorial"` turns a raw recording into a cut, zoomed, normalized, captioned mp4.
83
- - **Record a covered window.** `backend: "wgc"` records a window's own surface through Windows Graphics Capture.
84
-
85
- ### Why not just...
65
+ The core is the **watch loop**: the agent records, samples the footage into frames it can see, and checks what actually happened on screen. Capture only ever happens on an explicit tool call, and output lands under `SCREENCAST_HOME`, never in your checkout.
86
66
 
87
67
  | Instead of | The difference |
88
68
  | --- | --- |
@@ -197,48 +177,27 @@ Extract, clean up, level, transcribe, and score the soundtrack.
197
177
  <!-- tools:end -->
198
178
 
199
179
  > [!IMPORTANT]
200
- > `redact_region` covers the regions **you** declare. It is not automatic secret detection, so it cannot find a secret you did not point it at. The default `box` style is a solid fill, which is irreversible; `blur` and `pixelate` are softer but can be partially recovered, so prefer `box` for real secrets. They have minimum strengths: blur uses a radius of at least 8 px (or half the region's smaller side) applied three times, and pixelate uses blocks of at least 16 px. Coordinates are in the displayed frame, after any rotation the file carries, and `pipeline` refuses a `redact` placed after `zoom`. A region that falls outside the frame is rejected rather than silently doing nothing.
201
-
202
- ### Targets
203
-
204
- Every capture tool takes a single `target` string, so an agent never has to juggle quoting:
205
-
206
- | Target | Captures |
207
- | --- | --- |
208
- | `full` | The whole virtual desktop |
209
- | `monitor:<index>` | One display; `0` is always primary |
210
- | `window:<title>` | The on-screen rectangle a window occupies (case-insensitive exact title, else substring; topmost wins) |
211
- | `window:exe=<app.exe>` | That app's topmost window, without relying on its title |
212
- | `window:hwnd=<handle>` | One exact window by handle (hex `0x1A2B` or decimal) |
213
- | `region:<x>,<y>,<w>,<h>` | An absolute pixel rectangle |
214
-
215
- For `window:` targets, `screenshot` and `start_recording` both report `matchedWindow`, `matchCount`, `matchKind` (`exact`, `substring`, `exe`, or `hwnd`), and the captured `region`. When the title matched only as a substring, or several windows matched, the result carries a `windowWarning` listing the candidate titles, so a generic title like `window:Code` cannot quietly record a different window. Pass `exactTitle: true` to refuse the substring fallback entirely.
216
-
217
- Output is written under `SCREENCAST_HOME` (default `<homedir>/.screencast-mcp`) into `recordings/`, `frames/`, `screenshots/`, and `edits/`. Any tool also accepts an explicit output path; a relative one resolves under that tool's `SCREENCAST_HOME` subfolder, never the server's working directory.
180
+ > `redact_region` covers only the rectangles **you** declare; it is not automatic secret detection (use `find_text` with `redact: true` to locate them). Prefer the default `box` style for real secrets: it is a solid, irreversible fill, while `blur` and `pixelate` can be partially recovered.
218
181
 
219
- **Output confinement.** When the client sends workspace roots (the MCP `roots` capability), or `SCREENCAST_ALLOWED_DIRS` is set, an explicit output path (or `sample_frames` `outputDir`) must sit inside `SCREENCAST_HOME`, one of those roots, or one of those folders; anything else is refused with an error naming the allowed folders. The roots are re-read when the client reports they changed. With neither, any path you can write to is accepted, as before. `doctor` reports the folders in effect as `storage.allowedOutputDirs`.
220
-
221
- Edit and produce tools write to a `<name>.partial.<ext>` file next to the output and rename it into place only when ffmpeg succeeds, so a failed, timed-out, or cancelled job never leaves a truncated file at `output`. The job timeout scales with the media's length (at least 10 minutes, or 4x the duration); set `SCREENCAST_JOB_TIMEOUT_MS` to override it. Clients that send a progress token get `notifications/progress` updates while a job runs, and cancelling the request stops ffmpeg.
182
+ Every capture tool takes one `target` string: `full`, `monitor:<index>`, `window:<title>`, `window:exe=<app.exe>`, `window:hwnd=<handle>`, or `region:<x>,<y>,<w>,<h>`; `list_targets` returns ready-made ones. See [`start_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/start_recording.html) and the [Windows notes](https://tmhsdigital.github.io/screencast-mcp/#windows-notes) for how windows, monitors, and `backend: "wgc"` are captured.
222
183
 
223
184
  ## Configuration
224
185
 
225
- `ffmpeg` and `ffprobe` must be on `PATH`, or pointed at with `FFMPEG_PATH` / `FFPROBE_PATH`; the server checks per call and returns an install hint if either is missing (macOS: `brew install ffmpeg`; Linux: `apt install ffmpeg`, for the non-capture tools; distro packages may predate FFmpeg 8, so `transcribe` needs a newer static build). `doctor` shows what the ffmpeg in use supports.
186
+ `ffmpeg` and `ffprobe` must be on `PATH`, or set `FFMPEG_PATH` / `FFPROBE_PATH`. All settings are optional environment variables; `doctor` reports the ones in effect.
226
187
 
227
188
  | Variable | Default | Purpose |
228
189
  | --- | --- | --- |
229
190
  | `SCREENCAST_HOME` | `<homedir>/.screencast-mcp` | Where recordings, frames, screenshots, and edits are written |
230
- | `SCREENCAST_ALLOWED_DIRS` | none | `;`-separated folders explicit outputs may also go to; when set, or when the client sends roots, outputs outside `SCREENCAST_HOME`, the roots, and these folders are refused |
191
+ | `SCREENCAST_ALLOWED_DIRS` | none | `;`-separated folders tools may also read from and write to; when set, or when the client sends roots, files outside `SCREENCAST_HOME`, the roots, and these folders are refused. Without either, replacing an existing file outside `SCREENCAST_HOME` is refused. Network (UNC) paths are always refused |
231
192
  | `SCREENCAST_MAX_RECORDING_SEC` | `3600` | Default recording cap (`0` disables it) |
232
193
  | `SCREENCAST_JOB_TIMEOUT_MS` | scales with length | Override the edit job timeout |
233
194
  | `SCREENCAST_WHISPER_MODEL` | none | whisper.cpp model for `transcribe` |
234
195
  | `SCREENCAST_RETENTION_DAYS` | off | Delete screenshots, frames, and leftover raw event logs older than this many days at startup (never recordings or edits) |
235
196
  | `SCREENCAST_PS_TIMEOUT_MS` | 20000 (OCR 60000) | Limit for the PowerShell helpers that list monitors and windows and run OCR |
236
- | `SCREENCAST_CONFIRM_CAPTURE` | off | Set to `1` to ask the user to confirm every live capture (`start_recording`, `screenshot`, `find_text` on a target, `wait_for_change`) through MCP elicitation; clients without elicitation are refused |
237
- | `SCREENCAST_TOOLSETS` | `all` | Comma-separated toolsets to expose (`capture`, `watch`, `edit`, `produce`, `audio`); the rest are not loaded, which shrinks the tool list the agent pays for on every turn |
197
+ | `SCREENCAST_CONFIRM_CAPTURE` | off | Set to `1` to ask the user to confirm every live capture through MCP elicitation; clients without elicitation are refused |
198
+ | `SCREENCAST_TOOLSETS` | `all` | Comma-separated toolsets to expose; the rest are not loaded, which shrinks the tool list the agent pays for on every turn (`core` is always on) |
238
199
  | `FFMPEG_PATH` / `FFPROBE_PATH` | `PATH` lookup | Explicit ffmpeg / ffprobe binaries |
239
200
 
240
- **Toolsets.** The full tool list (`tools/list`) is about 70 KB, roughly 17k tokens of context; `capture` alone is about 16 KB. Set `SCREENCAST_TOOLSETS` to load only the groups an agent needs, for example `capture,watch` for a QA agent that records and looks but never edits. `core` (`doctor`, `get_media_info`) is always on; unset, empty, `all`, or a value naming no known toolset loads everything, and unknown names are ignored with a warning (and listed by `doctor`).
241
-
242
201
  <!-- toolsets:start -->
243
202
  | Toolset | Tools |
244
203
  | --- | --- |
@@ -250,208 +209,30 @@ Edit and produce tools write to a `<name>.partial.<ext>` file next to the output
250
209
  | `core` (always) | `get_media_info`, `doctor` |
251
210
  <!-- toolsets:end -->
252
211
 
253
- The server also sends MCP `instructions` at initialize: the record, look, edit workflow, which tool to reach for when, and the toolsets in effect, so each tool's own description stays short.
254
-
255
- **Capture consent.** With `SCREENCAST_CONFIRM_CAPTURE=1`, each live capture first asks the user through the client (MCP elicitation), showing what will be captured: the matched window, the duration, the audio source, and the output path. Only the user can answer, not the model, so a prompt injection cannot approve its own capture. Declining, cancelling, or not answering within 5 minutes captures nothing. A client that does not support elicitation fails closed: the tool returns an error and nothing is captured.
256
-
257
- **Log messages.** The server declares the MCP `logging` capability: ffmpeg warnings (dropped frames, a full audio buffer, a warning from an edit job that still succeeded) and a recording that ends on its own (cap reached, window closed, recorder crash) are sent as `notifications/message`, filtered by the level the client sets with `logging/setLevel`.
258
-
259
- ## Usage
260
-
261
- **Workflows:** copy-paste recipes with the tool calls and real outputs are on the docs site: [bug-repro clip for a PR](https://tmhsdigital.github.io/screencast-mcp/workflows/bug-repro.html), [README demo GIF](https://tmhsdigital.github.io/screencast-mcp/workflows/demo-gif.html), [agent UI verification loop](https://tmhsdigital.github.io/screencast-mcp/workflows/verify-ui.html), [social clip](https://tmhsdigital.github.io/screencast-mcp/workflows/social-clip.html), [reviewing a long recording](https://tmhsdigital.github.io/screencast-mcp/workflows/review-recording.html), [zoom toward every click](https://tmhsdigital.github.io/screencast-mcp/workflows/zoom-clicks.html), and [the whole edit in one call](https://tmhsdigital.github.io/screencast-mcp/workflows/pipeline.html).
262
-
263
- A typical watch loop — record, sample, look:
264
-
265
- ```jsonc
266
- // 1. record a region for a few seconds
267
- start_recording { "target": "region:0,0,1280,720", "quality": "draft" }
268
- // -> { "sessionId": "rec-…", "outputPath": "…/recordings/rec-….mp4" }
269
-
270
- // 2. finalize the file
271
- stop_recording { "sessionId": "rec-…" }
272
- // -> { "durationSec": 4.2, "finalizedGracefully": true }
273
-
274
- // 3. look at it: the frames come back inline, so the model sees them directly
275
- sample_frames { "input": "…/recordings/rec-….mp4", "timestamps": [0.5, 2, 3.5] }
276
- // -> { "frames": ["…/frames/…/frame_000_0.5s.png", …], "inlineImages": 3 }
277
- // + 3 image blocks the client shows to the model
278
- ```
279
-
280
- Don't know where to look? `sample_frames { "input": "…", "mode": "scenes" }` returns only the frames where the screen actually changed (plus the opening frame), with their `frameTimes`. Screen recordings are mostly static, so this is usually far cheaper than a fixed rate. `sceneThreshold` (default 0.1) sets how big a change counts, and in `fps` mode `dedupe: true` drops near-identical frames.
281
-
282
- `screenshot { "target": "window:My App" }` is the one-shot equivalent for a still, and also returns the image inline.
283
-
284
- Catching a flaky failure: the useful footage is the half minute before the test failed, and by then it is too late to start recording. Run an instant-replay buffer instead and save it when something goes wrong:
285
-
286
- ```jsonc
287
- // 1. keep a rolling 60 s buffer for the whole test loop (maxDurationSec 0 = no cap)
288
- start_recording { "target": "window:My App", "replayBufferSec": 60, "maxDurationSec": 0, "events": true }
289
- // -> { "sessionId": "rec-…", "replay": { "bufferSec": 60, "segmentSec": 2 } }
290
-
291
- // 2. a run fails: keep the last 30 s; the buffer keeps running for the next failure
292
- save_replay { "sessionId": "rec-…", "lastSec": 30 }
293
- // -> { "outputPath": "…/recordings/replay-….mp4", "durationSec": 30, "eventsPath": "…/replay-….events.jsonl" }
294
-
295
- // 3. done: stop and discard the buffer (save: true would write the whole buffer)
296
- stop_recording { "sessionId": "rec-…" }
297
- ```
298
-
299
- The buffer is a ring of 2 s MPEG-TS segments under `SCREENCAST_HOME/replay`, so disk use stays at about the buffer length plus 6 s however long it runs (the same bitrate as an ordinary recording of that target). Encoding costs the same CPU as an ordinary recording. A save snapshots the segments it needs, joins them and cuts with a stream copy, so it returns in about a second; the clip can hold up to 2 s of earlier frames behind an edit list (pass `reencode: true` for a frame-exact file). Buffers no live recording owns are deleted when the server starts.
300
-
301
- Filing the bug an agent just reproduced (record with `events: true` so the clicks become steps):
302
-
303
- ```jsonc
304
- bug_report { "sessionId": "rec-…", "title": "Save fails on a read-only folder", "expected": "The file saves or a clear error" }
305
- // -> { "outputDir": "…/edits/bug-report-…", "reportPath": "…/report.md", "steps": 6,
306
- // "errors": ["Error: Access to the path is denied."], "redaction": { "found": 1, … } }
307
- // review report.md and the returned contact sheet, then:
308
- gh issue create --title "Save fails on a read-only folder" --body-file …/report.md
309
- ```
310
-
311
- Documenting a task as a how-to (record with `events: true`; `add_marker` between phases gives section headings):
312
-
313
- ```jsonc
314
- step_guide { "sessionId": "rec-…", "title": "Export a report as PDF" }
315
- // -> { "outputDir": "…/edits/step-guide-…", "markdownPath": "…/guide.md", "htmlPath": "…/guide.html",
316
- // "steps": [{ "n": 1, "caption": "Click File", "section": "Open the report", "image": "step-01.png" }, …] }
317
- ```
318
-
319
- Inline images are downscaled JPEGs (`maxImageWidth`, default 1280) and capped per call (`maxInlineImages`, default 8, max 20); the full-resolution PNGs stay on disk. Pass `returnImage: false` / `returnImages: false` to get paths only.
320
-
321
- `sample_frames` writes at most `maxFrames` frames per call (default 100, max 1000). In `fps` mode it probes the video first; if the rate would exceed the cap, it samples at a lower rate so the frames still span the whole video, and the result's `capNote` says what it did.
322
-
323
- ### Command line and CI
324
-
325
- The same binary is a headless CLI when the first argument is a subcommand (no arguments still starts the MCP server). `record` records the screen while a command runs, exits with that command's code, and on failure writes a GIF of the last 30 s and a contact sheet:
326
-
327
- ```bash
328
- npx -y @tmhs/screencast-mcp record --target full -- npm run test:e2e
329
- npx -y @tmhs/screencast-mcp call doctor # any tool, JSON args inline or @file.json
330
- ```
331
-
332
- `record` options: `--target`, `--fps`, `--out` (default `screencast-evidence`), `--artifacts failure|always|never`, `--last <sec>`, `--no-gif`, `--no-contact-sheet`, `--discard-on-success`, `--max-duration`; it writes `evidence.json` alongside. For GitHub Actions on `windows-latest`, the composite action in [`action.yml`](action.yml) wraps it and uploads the evidence as an artifact:
333
-
334
- ```yaml
335
- - uses: TMHSDigital/screencast-mcp@main # pin a release tag or SHA
336
- with:
337
- command: npm run test:e2e
338
- target: window:exe=MyApp.exe
339
- ```
340
-
341
- More on the [CI page](https://tmhsdigital.github.io/screencast-mcp/ci.html).
342
-
343
- ## Prompts and resources
212
+ ## More docs
344
213
 
345
- Beyond tools, the server offers **prompts**: ready-made workflows that clients such as Claude Code and VS Code show as slash commands.
346
-
347
- | Prompt | What it does |
348
- | --- | --- |
349
- | `bug-repro-clip` | Record, find the bug moment, check for secrets, trim, annotate, and export a GIF for an issue. |
350
- | `file-bug-report` | Record a repro with input events, package it with `bug_report` (redacted clip, GIF, steps, error text, `report.md`), review it, and file it with `gh issue create` once you confirm. |
351
- | `document-steps` | Record a task with input events and markers, turn it into a step-by-step guide with `step_guide`, and tidy the captions. |
352
- | `demo-gif` | Record a feature walkthrough and export a GIF small enough for a README or PR. |
353
- | `verify-ui-change` | Screenshot before, make the change, wait for the screen to settle, diff, and confirm the text. |
354
- | `review-recording` | Summarize what happens in a recording, with timestamps. |
214
+ - **Usage:** [workflows](https://tmhsdigital.github.io/screencast-mcp/workflows/) walk through real tool calls and outputs: a bug-repro clip, a README demo, a UI verification loop, a social clip, a long-recording review, zoom toward clicks, and the whole edit in one `pipeline` call. Each tool's parameters and results are on its [reference page](https://tmhsdigital.github.io/screencast-mcp/tools/).
215
+ - **Command line and CI:** the same package is a headless CLI (`npx -y @tmhs/screencast-mcp record -- npm run test:e2e`, `... call doctor`), and a GitHub Action records your test run on `windows-latest` and uploads the evidence on failure (being published to GitHub Marketplace). See the [CI page](https://tmhsdigital.github.io/screencast-mcp/ci.html):
355
216
 
356
- It also offers **resources**, so a client can list and attach recordings without a filesystem tool: `screencast://sessions` (every session), `screencast://sessions/{id}` (one session), and `screencast://sessions/{id}/poster` (a JPEG preview frame). Clients are notified when a recording starts or stops.
357
-
358
- ## Windows notes
359
-
360
- - **Multi-monitor offsets.** `gdigrab` has no "capture monitor N" selector, so a monitor target captures the whole virtual desktop and crops to that display's pixel bounds (from `System.Windows.Forms.Screen.AllScreens`). `monitor:1` grabs the second display at its real offset; `monitor:0` is always primary.
361
- - **Window capture** resolves the window to the on-screen **rectangle** it occupies and captures that, rather than the window's own surface — `gdigrab`'s native `title=` grab returns a blank frame for GPU- or DirectComposition-composited windows (Chrome, Electron, UWP). Target it by title, or without relying on the title by `window:exe=Code.exe` (that app's topmost window) or `window:hwnd=0x1A2B` (one exact window); results report the matched title. The window must be **visible, on top, and not minimized** (a minimized window is rejected with a clear error), the capture includes anything drawn over that rectangle, and for `start_recording` the rectangle is fixed **once at start**. Use `backend: "wgc"` (below) to capture the window itself instead.
362
- - **Windows Graphics Capture (`backend: "wgc"`, FFmpeg 8+).** Captures a window's **own surface** by handle, even when other windows cover it. On `screenshot` and `find_text` it takes 1-2 s instead of ~0.2 s, so it is opt-in. On `start_recording` it records the window's client area while it is covered, moved, or in the background. `gfxcapture` only emits a frame when the window presents, so a small recorder process repaints one pixel of the window every 200 ms and repeats the latest frame at the requested fps; it stops on `q` like ffmpeg, so `stop_recording` and `maxDurationSec` work the same. The first frame takes a second or two, and `start_recording` returns once it is captured. No audio with `wgc` yet.
363
- - **Fullscreen-exclusive apps** often produce black frames under `gdigrab`; run the source in borderless-windowed mode for reliable capture.
364
- - **System audio needs a loopback device.** `gdigrab` is video-only, so `start_recording` with `audio.source` = `system` captures from a separate dshow input. Windows has no native loopback, so this needs a virtual-audio device (enable Stereo Mix, or install a driver such as screen-capture-recorder's `virtual-audio-capturer` or VB-CABLE). Run `list_audio_devices` to find it. Microphone capture is intentionally not supported.
365
- - **Windows on ARM64.** CI runs the unit, ffmpeg-integration and gdigrab capture-smoke suites on a native `windows-11-arm` runner with arm64 Node. gyan.dev has no arm64 build; CI uses [BtbN's](https://github.com/BtbN/FFmpeg-Builds/releases) FFmpeg 8.1 `winarm64-gpl-shared` build (from a month-end `autobuild-*` release, which are kept), which has `gdigrab`, `gfxcapture` (WGC) and `drawtext` but is built without whisper and libvpx: `transcribe` and `.webm` output need another build. Run `node scripts/platform-probe.mjs` after `npm run build` to see what your machine supports (`doctor` now reports `arch`).
217
+ ```yaml
218
+ - uses: TMHSDigital/screencast-mcp@v0
219
+ with:
220
+ command: npm run test:e2e
221
+ ```
222
+ - **Prompts and resources:** the server also ships MCP prompts that clients show as slash commands (`bug-repro-clip`, `file-bug-report`, `document-steps`, `demo-gif`, `verify-ui-change`, `review-recording`) and `screencast://sessions` resources for attaching recordings without a filesystem tool.
223
+ - **Threat model and Windows notes:** what capture can expose, and how window, monitor, WGC, and system-audio capture behave, are on the [docs home page](https://tmhsdigital.github.io/screencast-mcp/#threat-model).
366
224
 
367
225
  ## Privacy
368
226
 
369
- - **The server makes no network requests and has no telemetry.** It runs ffmpeg, ffprobe, and PowerShell on your machine and talks to your MCP client over stdio. OCR (`find_text`) and speech (`narrate`) use the engines built into Windows, so screen text and narration scripts are processed locally and never sent anywhere.
370
- - **What a tool returns goes to your model provider.** Inline screenshots and frames, OCR text, event summaries, and every other tool result reach your agent, and your client sends them to the model like any other tool result. Files on disk stay on disk unless a tool returns them or you share them.
371
- - **What is stored, and where.** Everything goes under `SCREENCAST_HOME` (default `<homedir>/.screencast-mcp`) unless a call names another path:
372
- - `recordings/`: recordings, plus each one's `.events.jsonl` when the event log is on
373
- - `screenshots/`: `screenshot` output, and `find_text` / `wait_for_change` captures only with `keep: true`
374
- - `frames/`: `sample_frames` and `contact_sheet` output
375
- - `edits/`: edit and produce output
376
- - `sessions.json`: the session registry (ids, targets, paths, times)
377
-
378
- `find_text`, `wait_for_change`, and `screen_diff` delete their captures after the call by default, since a secret scan's screenshot shows the secret.
379
- - **What the event log records.** Only with `start_recording` `events: true` (or `cursor: "events"`, which also leaves the OS cursor out of the video for the `cursor` tool to redraw), and only while that recording runs. Mouse input is recorded system-wide, not only over the recorded window: clicks, scrolls, and the cursor position (sampled about 30 times a second), each with its time. Typing is recorded only as bursts, a start time and a length on a 0.5 s grid, with no key names and no per-key times: `masked` (default) records nothing more. `shortcuts` also records chords made with Ctrl, Alt, or Win by name (`Ctrl+S`), with their times; Ctrl+Alt+key that types a character on AltGr layouts stays typing. No mode records typed text. If the log has gaps (Windows removed the hook, input went to an elevated window or the lock screen, or the helper stopped), `read_events` reports `truncated: true` and lists them.
380
- - **Microphone capture is not supported.** System audio is recorded only with `audio.source` = `system`.
381
- - **Deleting stored data.** Delete files under `SCREENCAST_HOME`, or the whole folder while nothing is recording. Set `SCREENCAST_RETENTION_DAYS` to delete screenshots, frames, and leftover raw event logs older than that each time the server starts. Recordings and edits are never deleted automatically.
382
-
383
- ## Threat model
384
-
385
- > [!WARNING]
386
- > Screen capture can record **anything** on screen at the moment of capture — passwords, tokens, private messages, and other secrets. `window:` captures the screen rectangle a window occupies, so overlays, notifications, or another window drawn over it are captured too. Treat recordings, screenshots, and sampled frames as sensitive by default.
387
-
388
- - **Capture is always explicit.** Nothing auto-fires; capture is gated behind an explicit tool call. Set `SCREENCAST_CONFIRM_CAPTURE=1` to also require the user's confirmation, through the client, before each live capture (see [Configuration](#configuration)).
389
- - **The server makes no network requests.** Files are written to the local filesystem only. What a tool returns to your agent (frames, OCR text, event summaries) is sent to your model provider like any other tool result; see [Privacy](#privacy).
390
- - **Public repo, private captures.** The `.gitignore` blocks recordings, frames, screenshots, and common video/image output so test media cannot be committed by accident.
391
- - **Review before sharing.** Sample frames or inspect a recording before handing a file to another tool or person, so you know what it contains. In clients that support MCP Apps, `review_recording` opens an inline player where a person can scrub the whole recording and draw redaction boxes before anything leaves the machine. The player gets frames through the MCP connection; no local web server is started.
392
- - **Redaction covers what you declare.** `redact_region` covers only the rectangles you specify. `find_text` can help find them: OCR with a query such as `regex: "sk-|ghp_|api.?key"` and `redact: true` returns ready-made rectangles, and `scanEverySec` checks a whole video rather than one frame. But OCR is best-effort; it can miss small or stylised text, so treat it as an aid, not a guarantee. Use the default `box` style for a solid irreversible fill, and still review the output before sharing.
393
- - **The input event log never records what you type.** `start_recording` `events: true` hooks mouse and keyboard input system-wide for that recording only, in a helper that exits with it (or with the server). Typing is logged only as bursts on a 0.5 s grid, never key by key, so the log does not reveal which keys were pressed, how many, or their timing. `keys: "shortcuts"` also names chords held with Ctrl, Alt, or Win (`Ctrl+S`). Cursor positions and clicks still reveal what you pointed at, so treat `.events.jsonl` like the recording beside it. See [Privacy](#privacy) for exactly what each mode records.
394
- - **System audio is sensitive too.** When `audio.source` = `system`, the recording captures everything playing on the machine (call audio, notifications, media). Treat audio-bearing recordings with the same care as the video.
395
-
396
- ## Project structure
397
-
398
- ```
399
- .
400
- ├── src/
401
- │ ├── index.ts # MCP server entry (stdio); registers every tool, reaps orphans
402
- │ ├── cli.ts # headless CLI: record -- <command>, call <tool>
403
- │ ├── prompts.ts # MCP prompts (workflows as slash commands)
404
- │ ├── resources.ts # MCP resources (sessions, posters)
405
- │ ├── wgcRecorder.ts # recorder process for backend: "wgc"
406
- │ ├── tools/ # one file per tool
407
- │ ├── utils/ # pure builders and helpers (ffmpeg args, targets, sessions, ...)
408
- │ └── __tests__/ # vitest: unit, ffmpeg integration, guarded local-capture harness
409
- ├── assets/ # bundled fonts and the review player (assets/ui)
410
- ├── docs/ # GitHub Pages site; tools/, llms.txt, and the recipe pages are generated
411
- ├── scripts/ # Claude Desktop bundle (.mcpb) and the docs generators (npm run docs)
412
- ├── plugin/ # Claude Code plugin: the server plus workflow skills
413
- ├── action.yml # GitHub Action: record a test run on windows-latest
414
- ├── mcp-tools.json # tool manifest, generated from the registry by npm run docs
415
- ├── server.json # MCP Registry listing (name matches package.json mcpName)
416
- ├── .github/workflows/ # CI, release, npm publish, Pages, ecosystem drift check
417
- ├── ROADMAP.md · CONTRIBUTING.md · SECURITY.md · LICENSE
418
- └── package.json
419
- ```
420
-
421
- ## Development
422
-
423
- ```bash
424
- git clone https://github.com/TMHSDigital/screencast-mcp.git
425
- cd screencast-mcp
426
- npm install
427
- npm run build # tsc -> dist/
428
- npm test # vitest: unit tests, plus the ffmpeg integration suite when ffmpeg is on PATH
429
- npm run dev # tsx watch
430
- npm run docs # regenerate mcp-tools.json, the tool tables, docs/tools/, llms.txt
431
- ```
432
-
433
- The tool tables in this README and on the site, `mcp-tools.json`, and the per-tool pages are generated from the registered tools' schemas; after adding or changing a tool, run `npm run docs` (the docs test fails on a stale copy; `npm run docs:check` checks without writing).
434
-
435
- To run your build from a client, point it at `dist/index.js`: `"command": "node"`, `"args": ["C:/path/to/screencast-mcp/dist/index.js"]`.
436
-
437
- The integration suite (`src/__tests__/integration`) runs the real edit and produce builders through ffmpeg against lavfi-generated fixtures and checks the probed result (durations, dimensions, streams, loudness). It skips when ffmpeg is missing; set `REQUIRE_FFMPEG=1` to make a missing ffmpeg fail instead, as CI's Linux job does.
438
-
439
- The capture path can't be exercised on CI's headless Linux runners, so an end-to-end harness lives behind a flag and is skipped by default:
440
-
441
- ```bash
442
- RUN_LOCAL_CAPTURE_TESTS=1 npm test # Windows + ffmpeg + a real display
443
- ```
444
-
445
- Agent evals (`evals/`) score tool selection, argument validity and outcomes on scripted tasks against lavfi-generated fixtures, through the built server over MCP. The default oracle mode replays known-good calls and needs no model or network; `--agent anthropic` runs a real model (install the SDK ad hoc with `npm install --no-save @anthropic-ai/sdk`; `EVAL_MODEL` defaults to `claude-sonnet-5-5`). Live-capture tools are always blocked.
446
-
447
- ```bash
448
- npm run build && npm run eval # oracle mode
449
- npm run eval -- --agent anthropic --json evals/results/baseline.json
450
- ```
227
+ - **No network requests, no telemetry.** The server runs ffmpeg, ffprobe, and PowerShell locally and talks to your client over stdio. OCR (`find_text`) and speech (`narrate`) use the engines built into Windows.
228
+ - **What a tool returns goes to your model provider.** Inline frames, OCR text, and event summaries reach your agent like any tool result; files on disk stay on disk unless a tool returns them or you share them.
229
+ - **Everything is stored under `SCREENCAST_HOME`** (`recordings/`, `screenshots/`, `frames/`, `edits/`, `sessions.json`) unless a call names another path. `find_text`, `wait_for_change`, and `screen_diff` delete their captures after the call by default.
230
+ - **The event log never records typed text.** Only with `start_recording` `events: true` (or `cursor: "events"`), and only while that recording runs: clicks, scrolls, and cursor positions system-wide, and typing as bursts on a 0.5 s grid with no key names (`keys: "shortcuts"` also names Ctrl/Alt/Win chords). There is no microphone capture; system audio only with `audio.source` = `system`.
231
+ - **Deleting data.** Delete files under `SCREENCAST_HOME`, or set `SCREENCAST_RETENTION_DAYS`; recordings and edits are never deleted automatically.
451
232
 
452
233
  ## Contributing
453
234
 
454
- Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md). Security reports go through [SECURITY.md](SECURITY.md).
235
+ Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) (development setup and project structure) and the [Code of Conduct](CODE_OF_CONDUCT.md). Security reports go through [SECURITY.md](SECURITY.md).
455
236
 
456
237
  ## License
457
238
 
Binary file
Binary file