@tmhs/screencast-mcp 0.46.0 → 0.48.0

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 (55) hide show
  1. package/README.md +127 -303
  2. package/assets/cursor/arrow.png +0 -0
  3. package/assets/fonts/Inter-Bold.ttf +0 -0
  4. package/assets/fonts/Inter-Regular.ttf +0 -0
  5. package/dist/cli.js +515 -0
  6. package/dist/index.js +10 -2
  7. package/dist/server.js +23 -0
  8. package/dist/setup.js +437 -0
  9. package/dist/tools/addMarker.js +6 -2
  10. package/dist/tools/bugReport.js +1 -1
  11. package/dist/tools/chapters.js +1 -1
  12. package/dist/tools/cursor.js +87 -0
  13. package/dist/tools/cutByTranscript.js +3 -3
  14. package/dist/tools/doctor.js +14 -1
  15. package/dist/tools/indexRecording.js +37 -15
  16. package/dist/tools/listVideoDevices.js +26 -0
  17. package/dist/tools/narrate.js +86 -0
  18. package/dist/tools/overlay.js +2 -0
  19. package/dist/tools/pauseRecording.js +44 -0
  20. package/dist/tools/pipeline.js +37 -13
  21. package/dist/tools/readEvents.js +1 -1
  22. package/dist/tools/resumeRecording.js +46 -0
  23. package/dist/tools/reviewRecording.js +1 -1
  24. package/dist/tools/searchRecording.js +9 -3
  25. package/dist/tools/startRecording.js +155 -86
  26. package/dist/tools/stepGuide.js +57 -4
  27. package/dist/tools/stopRecording.js +38 -3
  28. package/dist/utils/argPaths.js +39 -0
  29. package/dist/utils/audioDevices.js +34 -4
  30. package/dist/utils/captions.js +5 -3
  31. package/dist/utils/cursor.js +317 -0
  32. package/dist/utils/events.js +62 -12
  33. package/dist/utils/gpu.js +219 -0
  34. package/dist/utils/lifecycle.js +136 -13
  35. package/dist/utils/media.js +7 -2
  36. package/dist/utils/monitors.js +39 -5
  37. package/dist/utils/narrate.js +233 -0
  38. package/dist/utils/ocr.js +8 -3
  39. package/dist/utils/paths.js +41 -3
  40. package/dist/utils/pause.js +190 -0
  41. package/dist/utils/pipeline.js +29 -2
  42. package/dist/utils/recipes.js +7 -3
  43. package/dist/utils/recorder.js +172 -0
  44. package/dist/utils/recordingIndex.js +55 -9
  45. package/dist/utils/replay.js +20 -2
  46. package/dist/utils/retention.js +4 -1
  47. package/dist/utils/roots.js +1 -1
  48. package/dist/utils/sessions.js +32 -6
  49. package/dist/utils/stepGuide.js +26 -0
  50. package/dist/utils/targets.js +31 -7
  51. package/dist/utils/toolsets.js +8 -3
  52. package/dist/utils/transcriptCut.js +20 -5
  53. package/dist/utils/wgc.js +2 -2
  54. package/dist/wgcRecorder.js +1 -1
  55. package/package.json +5 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **An MCP server that lets an agent record the screen, _watch_ the footage, and make minimal ffmpeg edits — over stdio, on Windows.**
6
6
 
7
- Capture the desktop, a monitor, a window, or a region; sample a recording into frames the agent can actually look at; trim, crop, redact, annotate, zoom toward clicks, and export for GitHub or social. No cloud service, no telemetry: ffmpeg and ffprobe behind 53 typed tools.
7
+ Capture the desktop, a monitor, a window, or a region; sample a recording into frames the agent can actually look at; trim, crop, redact, annotate, zoom toward clicks, and export for GitHub or social. No cloud service, no telemetry: ffmpeg and ffprobe behind <!--tool-count-->58<!--/tool-count--> typed tools.
8
8
 
9
9
  **For developers who want their coding agent to see and prove UI changes on Windows**: bug repros, UI verification, and demo clips the agent records, checks, and edits itself. Capture is Windows-only; the watch and edit tools work on any OS with ffmpeg. Free for non-commercial use ([CC BY-NC-ND 4.0](#license)); [why not OBS, Playwright, or a screenshot MCP?](#why-not-just)
10
10
 
@@ -32,28 +32,26 @@ 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:**
44
46
 
45
47
  | Client | How |
46
48
  | --- | --- |
47
- | Claude Code | `claude mcp add screencast -- cmd /c npx -y @tmhs/screencast-mcp` |
49
+ | Claude Code | `claude mcp add screencast -- cmd /c npx -y @tmhs/screencast-mcp`, or the plugin (the server plus bug-repro, README-demo, and UI-verify skills): `/plugin install screencast --marketplace TMHSDigital/screencast-mcp` (older Claude Code: `/plugin marketplace add TMHSDigital/screencast-mcp`, then `/plugin install screencast@screencast-mcp`) |
48
50
  | Claude Desktop | Download [`screencast-mcp.mcpb`](https://github.com/TMHSDigital/screencast-mcp/releases/latest/download/screencast-mcp.mcpb) from the latest release and open it (one click) |
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
  | --- | --- |
@@ -92,323 +72,167 @@ What it can do beyond record-and-look:
92
72
 
93
73
  ## Tools
94
74
 
95
- 53 tools in six groups. The manifest in [`mcp-tools.json`](mcp-tools.json) is the canonical surface; tests keep it, this README, and the docs site in sync with `src/tools/`.
75
+ <!-- tools:start -->
76
+ 58 tools in 6 toolsets, generated from the server's own schemas by `npm run docs` (do not edit between the markers). Each name links to its reference page with every parameter, an example call, and what it returns; [`mcp-tools.json`](mcp-tools.json) is the same list as JSON, and [`llms-full.txt`](https://tmhsdigital.github.io/screencast-mcp/llms-full.txt) all of it in one file.
77
+
78
+ ### Core
79
+
80
+ Always loaded, whatever `SCREENCAST_TOOLSETS` selects.
81
+
82
+ | Tool | What it does |
83
+ | --- | --- |
84
+ | [`get_media_info`](https://tmhsdigital.github.io/screencast-mcp/tools/get_media_info.html) | Probe a media file with ffprobe and return duration, resolution, frame rate, codecs, container format, and size. |
85
+ | [`doctor`](https://tmhsdigital.github.io/screencast-mcp/tools/doctor.html) | Check the setup: ffmpeg/ffprobe (FFmpeg 8+?), optional filters, capture devices, Windows OCR, settings, and enabled toolsets; `problems` says what is missing and how to fix it. Call on first use or when a tool reports a missing feature. |
96
86
 
97
87
  ### Capture
98
88
 
99
- | Tool | Purpose |
89
+ Record or screenshot the desktop, a monitor, a window, or a region. Every capture is an explicit tool call: nothing records on its own.
90
+
91
+ | Tool | What it does |
100
92
  | --- | --- |
101
- | `start_recording` | Start a background recording. `target` = `full` \| `monitor:<index>` \| `window:<title>` \| `region:<x>,<y>,<w>,<h>`; optional `fps`, `quality`, `audio` (set `audio.source` = `system` to also capture loopback audio), `maxDurationSec` (auto-stop cap, default 3600; `0` = none), and `events` (log clicks, scroll, cursor, and key presses to `<recording>.events.jsonl`; `keys` = `masked` by default or `shortcuts`), and `replayBufferSec` (instant replay: keep only the last N seconds, see `save_replay`). Returns a session id and output path. |
102
- | `stop_recording` | Stop a session by id. Sends ffmpeg a graceful quit so the file is **finalized, not truncated**. Returns the final path and duration. On a replay buffer, `save: true` writes the whole buffer to the output path; otherwise the buffer is discarded. |
103
- | `save_replay` | Instant replay: write the last `lastSec` seconds of a buffer started with `start_recording { "replayBufferSec": 60 }` to an mp4, without stopping it. A stream copy, so it returns in about a second; `reencode: true` for a frame-exact file. With `events: true` the event log is sliced to match. |
104
- | `list_sessions` | List active and finished sessions. |
105
- | `get_session` | Inspect a single session by id. |
106
- | `review_recording` | **Review player** in clients that support MCP Apps: an inline player where a person scrubs the recording, drags trim handles, and draws redaction boxes, then exports a trimmed, redacted copy (one `pipeline` call). Pass it a stopped recording's `sessionId`. Elsewhere it returns the video's details. |
107
- | `player_frames` | Preview JPEG frames for the review player (an even grid plus scene changes, labelled with their real times); called by the player (app-only), not by agents. |
108
- | `read_events` | Read a recording's input event log (clicks, scroll, cursor, shortcuts, typing bursts) on the video's clock. Opt in with `start_recording` `events: true`. |
109
- | `add_marker` | Stamp a labelled moment ("bug appears", "step 3") on a running recording's video clock, or at a given second of a stopped one or any file. Markers are kept in the session (survive `stop_recording`, shown by `get_session`) and in a `<video>.markers.json` sidecar; the review player shows them as ticks, and `chapters` / `pipeline` turn them into chapters. |
110
- | `screenshot` | Capture a single PNG of a `target`, and return it inline as an image the model can view. |
111
- | `list_audio_devices` | List the DirectShow audio devices ffmpeg can see and flag a likely system-audio loopback device for `start_recording`. |
112
- | `list_targets` | List what can be captured: the desktop, each monitor (bounds, DPI scale), and each window (title, exe, pid, hwnd, bounds, minimized, cloaked, and whether gdigrab and `wgc` can capture it). Every entry carries a `target` string (`window:hwnd=<handle>` for windows) to pass as-is to `screenshot` or `start_recording`; filter with `exe` / `titleContains`. |
113
- | `doctor` | Check the setup: ffmpeg/ffprobe path and version (FFmpeg 8+?), key filters (`whisper`, `gfxcapture`, `subtitles`, `drawtext`, ...), `gdigrab`/`dshow` devices, Windows OCR, `SCREENCAST_HOME`, and the env settings in effect, with a `problems` list naming each fix. |
93
+ | [`start_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/start_recording.html) | Start a background screen recording. Returns a session id; finalize it with stop_recording. Never auto-starts. |
94
+ | [`stop_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/stop_recording.html) | Stop a recording gracefully so the file is finalized; returns the path and duration. |
95
+ | [`pause_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/pause_recording.html) | Pause a recording; until resume_recording nothing is captured, and the gap is left out of the file, events, and markers. |
96
+ | [`resume_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/resume_recording.html) | Resume a paused recording (same target and settings). |
97
+ | [`save_replay`](https://tmhsdigital.github.io/screencast-mcp/tools/save_replay.html) | Save the last N seconds of a replay buffer (start_recording replayBufferSec) to an mp4; the buffer keeps running. |
98
+ | [`list_sessions`](https://tmhsdigital.github.io/screencast-mcp/tools/list_sessions.html) | List all recording sessions (active and finished) with their status, target, output path, and whether the process is still alive. |
99
+ | [`get_session`](https://tmhsdigital.github.io/screencast-mcp/tools/get_session.html) | Inspect a single recording session by id, including live status and whether its output file exists on disk. |
100
+ | [`read_events`](https://tmhsdigital.github.io/screencast-mcp/tools/read_events.html) | Read the input events (clicks, scroll, cursor, shortcuts, typing bursts) of a recording made with events: true, in video seconds and pixels; e.g. types: ['down'], then sample_frames there. |
101
+ | [`add_marker`](https://tmhsdigital.github.io/screencast-mcp/tools/add_marker.html) | Mark a labelled moment on a recording, live or at a second. Kept in the session and a sidecar; chapters and pipeline turn markers into chapters. |
102
+ | [`screenshot`](https://tmhsdigital.github.io/screencast-mcp/tools/screenshot.html) | Capture one PNG of the screen, a monitor, a window, or a region, returned inline and by path. |
103
+ | [`list_audio_devices`](https://tmhsdigital.github.io/screencast-mcp/tools/list_audio_devices.html) | List DirectShow audio devices and flag a likely loopback (Stereo Mix or a virtual-audio driver), for start_recording's audio.device. |
104
+ | [`list_video_devices`](https://tmhsdigital.github.io/screencast-mcp/tools/list_video_devices.html) | List DirectShow cameras for start_recording's webcam.device. |
105
+ | [`list_targets`](https://tmhsdigital.github.io/screencast-mcp/tools/list_targets.html) | List the desktop, monitors, and visible windows (topmost first, with capturability per backend). Each entry has a `target` string to pass as-is to capture tools; use it instead of guessing a title. |
114
106
 
115
107
  ### Watch
116
108
 
117
- | Tool | Purpose |
118
- | --- | --- |
119
- | `sample_frames` | Extract frames from a video — at a fixed `fps`, at explicit `timestamps`, or only where the screen changed (`mode: "scenes"`) — so the agent can view what happened. Returns the frame paths, with the first few frames inline as images. |
120
- | `contact_sheet` | Tile timestamped frames into **one** image (evenly spaced, or at the scene changes) so the agent sees a whole recording in a single look; returned inline. `poster: true` writes one representative frame instead. |
121
- | `screen_diff` | Compare two screenshots/frames: SSIM score, share changed, and **bounding boxes of what changed**, with the changes outlined in an inline image. Verify a UI change happened, and only where expected. |
122
- | `wait_for_change` | Watch a target and return when it **changes** (a dialog opened) or **settles** (a build or page finished), instead of guessing a sleep. Reports elapsed time, changed regions, and the final state inline. |
123
- | `find_text` | **Read text** on screen or in a frame with the OCR engine built into Windows (no install): every line and match with its bounding box. Locate a button by its label, check what the screen says, or find secrets (`regex: "sk-|ghp_"`) and get `redact_region` rectangles with `redact: true`; `scanEverySec` checks a whole video, with a time window per match. Best-effort; review before relying on it. |
124
- | `index_recording` | **Text timeline** of a recording (path or `sessionId`): cuts it at scene changes (with fill keyframes so no stretch over 10 s goes unread), OCRs one keyframe per segment, and attaches input events, markers, and transcript cues (an `.srt`, the `<video>.srt` sidecar, or `transcript: "whisper"`). Writes `<video>.index.json` next to the video (or under `SCREENCAST_HOME/edits/indexes` when that folder is outside the allowed output dirs); a re-run on an unchanged file reuses the OCR. The index holds the raw screen text, so treat it like the video. |
125
- | `search_recording` | **Find a moment as text** in an indexed recording: "when did Save failed appear?" returns timecoded hits (segment `start`/`end` plus the exact time of a matching cue, marker, or event), best first, with secrets masked in the snippets. Plain queries tolerate OCR misreads; `regex: true` for patterns. No images unless `images: N` asks for small thumbnails of the top hits. |
126
- | `get_media_info` | ffprobe wrapper: duration, resolution, fps, codecs, container format, and size. |
127
-
128
- ### Minimal edit
129
-
130
- | Tool | Purpose |
109
+ Turn footage into something a model can read: frames, contact sheets, diffs, OCR, and a searchable text timeline.
110
+
111
+ | Tool | What it does |
131
112
  | --- | --- |
132
- | `trim` | Cut a sub-clip by `start` + (`end` or `duration`). Re-encodes by default so nothing before `start` stays in the file; `exact: false` stream-copies for speed. |
133
- | `concat` | Join two or more videos into one. |
134
- | `convert` | Convert between `mp4`, `gif`, and `webm`. |
135
- | `export_gif` | Animated **GIF or WebP that fits a size budget** (default: GitHub's 10 MB image limit) for PRs, issues, and READMEs. Two-stage palette for GIF; steps fps, width, and palette/quality down until it fits, and reports the settings used. |
113
+ | [`review_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/review_recording.html) | Open a recording for a person to review: in MCP Apps clients an inline player to scrub, trim, and redact, then export; elsewhere just the video's details. |
114
+ | [`player_frames`](https://tmhsdigital.github.io/screencast-mcp/tools/player_frames.html) | Preview frames for the review player: JPEGs on an even grid over the video plus frames at scene changes, with their real times. Used by the inline player; agents should use sample_frames or contact_sheet instead. *(app-only: called by the review player, not the agent)* |
115
+ | [`sample_frames`](https://tmhsdigital.github.io/screencast-mcp/tools/sample_frames.html) | Sample PNG frames from a video (by fps, timestamps, or scene changes) and return the first few inline so the model can see what happened. |
116
+ | [`contact_sheet`](https://tmhsdigital.github.io/screencast-mcp/tools/contact_sheet.html) | Tile timestamped frames of a video into one image to see a whole recording at a glance (the cheapest first look). |
117
+ | [`screen_diff`](https://tmhsdigital.github.io/screencast-mcp/tools/screen_diff.html) | Compare two screenshots or frames: SSIM score, changed share, and changed boxes in b's pixels, to check a UI change happened only where expected. |
118
+ | [`wait_for_change`](https://tmhsdigital.github.io/screencast-mcp/tools/wait_for_change.html) | Wait until part of the screen changes or settles, instead of guessing a sleep. Returns the elapsed time, changed regions (screenshot pixels; add `origin` for desktop), and the final state. |
119
+ | [`find_text`](https://tmhsdigital.github.io/screencast-mcp/tools/find_text.html) | OCR (built into Windows) on the screen, an image, or video frames, with line and match boxes in image pixels (add `origin` for desktop coordinates). Locate UI text or secrets (e.g. regex 'sk-\|ghp_\|api.?key') to redact. Best-effort: review results. |
120
+ | [`index_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/index_recording.html) | Build a recording's text timeline (<video>.index.json: OCR per scene, events, markers, transcript) for search_recording. |
121
+ | [`search_recording`](https://tmhsdigital.github.io/screencast-mcp/tools/search_recording.html) | Search an index_recording timeline (screen text, events, markers, transcript): timecoded hits, best first, secrets masked. No frames unless asked. |
136
122
 
137
- ### Edit surface
123
+ ### Edit
138
124
 
139
- These tools re-encode (a filter rewrites pixels, so stream copy does not apply). They reuse the same `draft`/`standard`/`high` presets as capture.
125
+ Cut, convert, compress, and redact. A tool that writes a file refuses to replace an existing `output` unless `overwrite: true`; default output paths are always unique.
140
126
 
141
- | Tool | Purpose |
142
- | --- | --- |
143
- | `crop` | Crop to a pixel rectangle (`x`, `y`, `width`, `height`). A rectangle that runs off the frame is rejected, not silently clamped. |
144
- | `scale` | Resize to a `width` and/or `height`. One side keeps the aspect ratio; both set an exact size. |
145
- | `speed` | Change playback speed by a `factor` (>1 faster, <1 slower). Audio is retempo'd when present. |
146
- | `overlay` | Composite a logo, watermark, or picture-in-picture onto a base video at a position, optionally scaled and time-limited. |
147
- | `callout` | **Timed annotations**: boxes, text labels, and arrows at any angle, each shown between two timestamps. Mark the bug, point at the button, caption a step. Text Inter can't draw (CJK, emoji, Arabic, Indic, ...) falls back to a Windows system font that covers it; `fontFile` picks one explicitly, and anything no font covers comes back in `warnings` instead of as silent boxes. |
148
- | `compress` | Re-encode smaller with a `light`/`medium`/`heavy` CRF ladder and an optional `maxWidth` that only downscales. |
149
- | `extract_audio` | Write the audio track to its own file (`mp3`, `aac`, `wav`, or `copy`). |
150
- | `normalize_audio` | **Loudness to a delivery target** (two-pass EBU R128 `loudnorm`): `youtube` −14 LUFS, `podcast` −16, `broadcast` −23, or any LUFS value. Video is copied; reports loudness before and after. |
151
- | `denoise` | Reduce **steady** background noise (fan, hum, hiss) with `afftdn`, tuned to the file's measured noise floor. Video is copied. |
152
- | `transcribe` | **Speech to an SRT file, locally**, with FFmpeg 8's `whisper` filter (needs a whisper.cpp model: pass `model` or set `SCREENCAST_WHISPER_MODEL`). Cues are renumbered and de-overlapped; `words: true` gives one word per cue (whisper `max_len=1`) for `cut_by_transcript`. |
153
- | `burn_subtitles` | Burn an SRT/ASS into the video in the bundled font: `clean` (outlined line) or `social` (big bold text on a dark box, for muted autoplay). |
154
- | `chapters` | **Chapters without a re-encode**: from markers (the default), the strongest scene changes, transcript sections (an SRT split at pauses), or an explicit list, written into an mp4/mkv/mov copy as real chapters (FFMETADATA, stream copy; they show in VLC and MPC) and returned as YouTube chapter text, with any YouTube rule it breaks (first at 0:00, three or more, 10 s each). `subtitles` muxes an SRT as a soft, toggleable track (`mov_text` in mp4) instead of burning it in; `textOnly` writes nothing. |
155
- | `clip` | Extract one or more frame-accurate sub-segments, each to its own file. For a single segment, `trim` (default `exact: true`) does the same. |
156
- | `cut_idle` | **Remove dead air**: cut stretches where the screen is frozen and (when there is audio) silent, keeping a short pad at each edge. `dryRun` reports first; speech over a still screen is kept unless `useAudio: false`. |
157
- | `cut_by_transcript` | **Edit by the transcript**: cut the lines you quote (`remove: ["exact words"]`, or cue numbers) and, with `fillers: true`, um/uh/erm, in one select/aselect pass that keeps audio and video in sync. Writes a re-timed `.srt` next to the video so `burn_subtitles` still lines up. Timing is as fine as the SRT: `transcribe { words: true }` gives one word per cue; with sentence cues a partial quote is placed by estimate (`exact: false`) and fillers inside a sentence are left in. `dryRun` returns the edited text first. |
158
-
159
- ### Redact
160
-
161
- | Tool | Purpose |
127
+ | Tool | What it does |
162
128
  | --- | --- |
163
- | `redact_region` | Cover declared rectangles in a video. `style` is `box` (default, a solid irreversible fill), `blur`, or `pixelate`; each region may be limited to a `start`/`end` window and expanded with `pad`. |
164
-
165
- > [!IMPORTANT]
166
- > `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.
129
+ | [`trim`](https://tmhsdigital.github.io/screencast-mcp/tools/trim.html) | Cut a video down to one sub-clip by start + (end or duration). For several segments use clip; to combine with other edits use pipeline. |
130
+ | [`concat`](https://tmhsdigital.github.io/screencast-mcp/tools/concat.html) | Join videos end to end with hard cuts: stream copy when they match, else a re-encode (`mode` says which). For transitions use xfade_transition or assemble_highlights. |
131
+ | [`convert`](https://tmhsdigital.github.io/screencast-mcp/tools/convert.html) | Convert media to mp4, webm, or gif. For a size-bounded GIF/WebP prefer export_gif; for a smaller mp4, compress or export_preset. |
132
+ | [`export_gif`](https://tmhsdigital.github.io/screencast-mcp/tools/export_gif.html) | Export an animated GIF or WebP that fits a size budget (for PRs, issues, READMEs), stepping fps, width, and quality down until it fits. |
133
+ | [`crop`](https://tmhsdigital.github.io/screencast-mcp/tools/crop.html) | Crop a video to a pixel rectangle; one running off the frame is rejected. |
134
+ | [`scale`](https://tmhsdigital.github.io/screencast-mcp/tools/scale.html) | Resize a video to a target width and/or height and re-encode. Provide one side to keep the aspect ratio, or both to set an exact size. |
135
+ | [`speed`](https://tmhsdigital.github.io/screencast-mcp/tools/speed.html) | Change playback speed by a factor (>1 faster, <1 slower) and re-encode. Audio is retempo'd to match when the source has an audio track. |
136
+ | [`compress`](https://tmhsdigital.github.io/screencast-mcp/tools/compress.html) | Re-encode a video smaller (H.264 CRF ladder, optional width cap). For a platform target use export_preset. |
137
+ | [`clip`](https://tmhsdigital.github.io/screencast-mcp/tools/clip.html) | Extract several frame-exact segments, each to its own file. For one segment, trim does the same. |
138
+ | [`cut_idle`](https://tmhsdigital.github.io/screencast-mcp/tools/cut_idle.html) | Remove dead air: cut stretches where the screen is frozen (and silent), keeping a short pad. Returns the time saved. |
139
+ | [`cut_by_transcript`](https://tmhsdigital.github.io/screencast-mcp/tools/cut_by_transcript.html) | Edit a video by its transcript: cut quoted text, cue numbers, or fillers. Also writes the re-timed .srt. |
140
+ | [`redact_region`](https://tmhsdigital.github.io/screencast-mcp/tools/redact_region.html) | Cover given rectangles in a video (e.g. secrets on screen). Not automatic detection: find them with find_text redact: true. Off-frame regions are rejected. |
141
+ | [`pipeline`](https://tmhsdigital.github.io/screencast-mcp/tools/pipeline.html) | Run several edits (trim, crop, scale, speed, cut_idle, redact, callout, keystroke_overlay, cursor, reframe, zoom, backdrop, audio, burn_subtitles, then optionally export_preset or export_gif) in one ffmpeg pass: one re-encode, no intermediate files. Prefer it over chaining edit tools; a recipe does the usual polish in one call. |
167
142
 
168
143
  ### Produce
169
144
 
170
- The production layer turns raw clips into a finished piece. Tools that combine clips auto-normalize each input to a common resolution, fps, and audio rate first, so heterogeneous sources compose cleanly.
145
+ Annotate, frame, and assemble a finished piece. Tools that combine clips normalize each input to a common resolution, fps, and audio rate first.
171
146
 
172
- | Tool | Purpose |
147
+ | Tool | What it does |
173
148
  | --- | --- |
174
- | `xfade_transition` | Crossfade two videos into one with an `xfade` transition (`fade`, `wipeleft`, `slideup`, ...). Audio is crossfaded when both clips have a track. |
175
- | `assemble_highlights` | Stitch two or more clips into one, with hard cuts (`transition: "cut"`) or an xfade transition between each. |
176
- | `title_card` | Generate a standalone title card (centered text on a solid background, with a silent track so it composes). Text uses the bundled Inter, so Latin, Greek and Cyrillic need no system font; other scripts and emoji fall back to a Windows system font (or pass `fontFile`), with `warnings` for anything no font covers. |
177
- | `music_bed` | Lay a music track under a video: looped/trimmed to length, faded in and out, leveled, and mixed with any existing audio (optionally ducked). |
178
- | `reframe` | Re-aspect to `16:9`, `9:16`, `1:1`, or `4:5` with `pad` (letterbox, no content lost) or `crop` (fill, trims overflow). |
179
- | `zoom` | **Smooth zoom-and-pan** (Screen Studio style) into where the action is and back out. Give keyframes (rectangles by time), or let it plan them from the clicks in the input event log (`start_recording` `events: true`; `highlightClicks` rings each click) or from where the screen changes; `dryRun` returns the plan to adjust. |
180
- | `keystroke_overlay` | **Keycast-style badges** ("Ctrl + Shift + P", "Double click", "Typing…") burned in from the input event log, one at a time, each lingering `lingerSec` (default 1.2). Repeats merge (`Ctrl + Z ×3`); `position`, `size`, `clicks`, `typing`. It can only show what the log holds: never typed text, and shortcuts only from `keys: "shortcuts"` recordings; `keys: "masked"` here shows a chord's modifiers only. |
181
- | `backdrop` | **Frame a clip or screenshot** (Screen Studio / CleanShot style): padding, a gradient, solid, or wallpaper `image` background, rounded corners, and a soft drop shadow, optionally on a `16:9`/`9:16`/`1:1`/`4:5` canvas. Presets in the project palette: `desktop` (default, dark slate), `rec` (record red), `amber` (amber to red), `light`. A PNG/JPG input writes a framed still. |
182
- | `export_preset` | Encode a platform-ready file (`youtube`, `instagram_reel`, `tiktok`, `x`, `square`, `steam_trailer`, `vertical_reel`): reframes, caps fps, and encodes H.264 at the platform bitrate with faststart. `steam_trailer` is 1080p H.264 High at a padded 5.5 Mbps CBR (above Steam's 5 Mbps floor) with 48 kHz audio at -14 LUFS; `vertical_reel` centres the footage over a blurred copy of itself with audio at -14 LUFS. |
183
- | `pipeline` | **Several edits in one ffmpeg process**: `steps` of `trim`, `crop`, `scale`, `speed`, `cut_idle`, `redact`, `callout`, `keystroke_overlay`, `reframe`, `zoom` (keyframes, or `follow: "clicks"` from the event log), `backdrop`, `audio` (`normalize`, `denoise`), `burn_subtitles` (a file, or `transcribe: true`), ending optionally in `export_preset` or `export_gif`, each with its tool's options. Or name a `recipe`: `pr_demo` (cut idle, click zoom, GIF under 10 MB), `tutorial` (plus denoise/normalize and captions, 1080p mp4) or `social_reel` (9:16, big captions); it expands to steps that `dryRun` shows and your own `steps` override. One re-encode, no intermediate files, and a recipe you can save and re-run on the next recording; `dryRun` returns the planned command; `chapters: true` keeps the input's markers as chapters, re-timed through trims and speed changes. |
184
- | `bug_report` | **A paste-ready repro package in one call**: from a recording path or `sessionId`, writes a folder with a trimmed clip (the last 30 s by default) and a GIF under 10 MB, a timecoded contact sheet, numbered steps rebuilt from the input event log, OCR'd error and dialog text, environment details (OS, displays and DPI, window, ffmpeg), and a `report.md` for `gh issue create --body-file` (plus `report.json`). Before anything is encoded, a whole-clip OCR secret scan boxes out API keys, tokens, and `password:` values in every output and masks them in the quoted text; it needs Windows OCR (`redact: false` skips it). |
185
- | `step_guide` | **A step-by-step how-to from a recording** (Steps Recorder for the agent era): from a path or `sessionId` with an input event log, writes `guide.md` with an `images/` folder and/or one self-contained `guide.html`. Each click, shortcut, typing burst, and scroll becomes a numbered step with the frame just before it, the click ringed, and a caption ("Click **Save**") from OCR of the text under the click; markers become section headings. OCR also boxes secrets out of the screenshots and masks them in captions (`ocr: false` skips both; it needs Windows OCR). Typed text is never logged, so it never appears. Returns the steps so the agent can rewrite captions. |
186
-
187
- ### Targets
188
-
189
- Every capture tool takes a single `target` string, so an agent never has to juggle quoting:
190
-
191
- | Target | Captures |
149
+ | [`overlay`](https://tmhsdigital.github.io/screencast-mcp/tools/overlay.html) | Composite an image or video (logo, watermark, picture-in-picture) onto a video at a pixel position, optionally scaled and time-limited; keeps the base's audio and length. |
150
+ | [`callout`](https://tmhsdigital.github.io/screencast-mcp/tools/callout.html) | Annotate a video with timed boxes, text labels, and arrows. Fallback fonts used are listed in fallbackFonts; characters no font covers are reported in warnings. |
151
+ | [`keystroke_overlay`](https://tmhsdigital.github.io/screencast-mcp/tools/keystroke_overlay.html) | Burn keycast-style badges for shortcuts, clicks, and typing from the recording's input event log (start_recording events: true). Never shows typed text: the log has none. |
152
+ | [`cursor`](https://tmhsdigital.github.io/screencast-mcp/tools/cursor.html) | Draw a smoothed, scaled cursor that hides when idle from the event log of a start_recording cursor: "events" recording (no OS cursor in the video), with click ripples and an optional spotlight. |
153
+ | [`backdrop`](https://tmhsdigital.github.io/screencast-mcp/tools/backdrop.html) | Frame a video or screenshot on a gradient, color, or wallpaper with padding, rounded corners, and a drop shadow, optionally on a 16:9/1:1/9:16/4:5 canvas. |
154
+ | [`burn_subtitles`](https://tmhsdigital.github.io/screencast-mcp/tools/burn_subtitles.html) | Burn SRT/ASS subtitles (e.g. from transcribe) into a video in the bundled font. |
155
+ | [`chapters`](https://tmhsdigital.github.io/screencast-mcp/tools/chapters.html) | Write chapters (markers, scene changes, transcript, or a list) into an mp4/mkv/mov copy without re-encoding; returns YouTube chapter text. Can mux an SRT as soft subtitles. |
156
+ | [`xfade_transition`](https://tmhsdigital.github.io/screencast-mcp/tools/xfade_transition.html) | Join two videos with an xfade transition (audio crossfaded); they need not match in size, fps, or audio. For more clips use assemble_highlights. |
157
+ | [`assemble_highlights`](https://tmhsdigital.github.io/screencast-mcp/tools/assemble_highlights.html) | Stitch clips (including title cards) into one video with cuts or xfade transitions; they need not match in size, fps, or audio. |
158
+ | [`title_card`](https://tmhsdigital.github.io/screencast-mcp/tools/title_card.html) | Generate a title card clip (centered text on a solid background, silent audio track) to stitch in with assemble_highlights. Uncoverable characters are reported in warnings. |
159
+ | [`reframe`](https://tmhsdigital.github.io/screencast-mcp/tools/reframe.html) | Re-aspect a video to 16:9, 9:16, 1:1, or 4:5 by padding or cropping. |
160
+ | [`zoom`](https://tmhsdigital.github.io/screencast-mcp/tools/zoom.html) | Smooth animated zoom-and-pan into the action and back out, from keyframes or planned from logged clicks or screen changes. |
161
+ | [`export_preset`](https://tmhsdigital.github.io/screencast-mcp/tools/export_preset.html) | Encode a platform-ready H.264 file (aspect, fps, bitrate, faststart) for a named platform. |
162
+ | [`bug_report`](https://tmhsdigital.github.io/screencast-mcp/tools/bug_report.html) | Package a recording as a paste-ready repro folder: secret-scanned, redacted clip and GIF, contact sheet, steps from the event log, OCR'd errors, environment, report.md for gh issue create --body-file. |
163
+ | [`step_guide`](https://tmhsdigital.github.io/screencast-mcp/tools/step_guide.html) | Turn a recording's event log into a numbered how-to: a ringed screenshot and caption per step, marker headings; Markdown and/or one HTML file. Never includes typed text. |
164
+
165
+ ### Audio
166
+
167
+ Extract, clean up, level, transcribe, and score the soundtrack.
168
+
169
+ | Tool | What it does |
192
170
  | --- | --- |
193
- | `full` | The whole virtual desktop |
194
- | `monitor:<index>` | One display; `0` is always primary |
195
- | `window:<title>` | The on-screen rectangle a window occupies (case-insensitive exact title, else substring; topmost wins) |
196
- | `window:exe=<app.exe>` | That app's topmost window, without relying on its title |
197
- | `window:hwnd=<handle>` | One exact window by handle (hex `0x1A2B` or decimal) |
198
- | `region:<x>,<y>,<w>,<h>` | An absolute pixel rectangle |
199
-
200
- 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.
201
-
202
- 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.
171
+ | [`extract_audio`](https://tmhsdigital.github.io/screencast-mcp/tools/extract_audio.html) | Extract the audio track of a media file to its own file (mp3, aac, wav, or copy). Returns the output path. |
172
+ | [`normalize_audio`](https://tmhsdigital.github.io/screencast-mcp/tools/normalize_audio.html) | Normalize loudness to a delivery target (two-pass EBU R128 loudnorm); video is copied. Reports loudness before and after. |
173
+ | [`denoise`](https://tmhsdigital.github.io/screencast-mcp/tools/denoise.html) | Reduce steady background noise (fan, hum, hiss) in a recording's audio with an adaptive FFT denoiser. Video is copied untouched. Returns the output path. |
174
+ | [`transcribe`](https://tmhsdigital.github.io/screencast-mcp/tools/transcribe.html) | Transcribe a recording's speech to an SRT subtitle file, locally, with FFmpeg 8's whisper filter (needs a whisper.cpp model file). Returns the SRT path and the text. Pair with burn_subtitles to caption the video. |
175
+ | [`music_bed`](https://tmhsdigital.github.io/screencast-mcp/tools/music_bed.html) | Lay music under a video: looped or trimmed to length, faded, leveled, and mixed with any existing audio. Video is stream-copied. |
176
+ | [`narrate`](https://tmhsdigital.github.io/screencast-mcp/tools/narrate.html) | Offline voiceover with the built-in Windows voices: speaks each line at its time or marker over the audio, plus an SRT. |
177
+ <!-- tools:end -->
203
178
 
204
- **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`.
179
+ > [!IMPORTANT]
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.
205
181
 
206
- 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.
207
183
 
208
184
  ## Configuration
209
185
 
210
- `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.
211
187
 
212
188
  | Variable | Default | Purpose |
213
189
  | --- | --- | --- |
214
190
  | `SCREENCAST_HOME` | `<homedir>/.screencast-mcp` | Where recordings, frames, screenshots, and edits are written |
215
- | `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 |
216
192
  | `SCREENCAST_MAX_RECORDING_SEC` | `3600` | Default recording cap (`0` disables it) |
217
193
  | `SCREENCAST_JOB_TIMEOUT_MS` | scales with length | Override the edit job timeout |
218
194
  | `SCREENCAST_WHISPER_MODEL` | none | whisper.cpp model for `transcribe` |
219
195
  | `SCREENCAST_RETENTION_DAYS` | off | Delete screenshots, frames, and leftover raw event logs older than this many days at startup (never recordings or edits) |
220
196
  | `SCREENCAST_PS_TIMEOUT_MS` | 20000 (OCR 60000) | Limit for the PowerShell helpers that list monitors and windows and run OCR |
221
- | `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 |
222
- | `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) |
223
199
  | `FFMPEG_PATH` / `FFPROBE_PATH` | `PATH` lookup | Explicit ffmpeg / ffprobe binaries |
224
200
 
225
- **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`).
226
-
201
+ <!-- toolsets:start -->
227
202
  | Toolset | Tools |
228
203
  | --- | --- |
229
- | `capture` | `start_recording`, `stop_recording`, `save_replay`, `list_sessions`, `get_session`, `read_events`, `add_marker`, `screenshot`, `list_targets`, `list_audio_devices` |
230
- | `watch` | `sample_frames`, `contact_sheet`, `screen_diff`, `wait_for_change`, `find_text`, `index_recording`, `search_recording`, `review_recording`, `player_frames` |
231
- | `edit` | `pipeline`, `trim`, `clip`, `concat`, `convert`, `export_gif`, `crop`, `scale`, `speed`, `compress`, `redact_region`, `cut_idle`, `cut_by_transcript` |
232
- | `produce` | `callout`, `keystroke_overlay`, `backdrop`, `overlay`, `zoom`, `reframe`, `title_card`, `xfade_transition`, `assemble_highlights`, `export_preset`, `burn_subtitles`, `chapters`, `bug_report`, `step_guide` |
233
- | `audio` | `extract_audio`, `normalize_audio`, `denoise`, `transcribe`, `music_bed` |
234
- | `core` (always) | `doctor`, `get_media_info` |
235
-
236
- 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.
237
-
238
- **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.
239
-
240
- **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`.
241
-
242
- ## Usage
243
-
244
- **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).
245
-
246
- A typical watch loop — record, sample, look:
247
-
248
- ```jsonc
249
- // 1. record a region for a few seconds
250
- start_recording { "target": "region:0,0,1280,720", "quality": "draft" }
251
- // -> { "sessionId": "rec-…", "outputPath": "…/recordings/rec-….mp4" }
252
-
253
- // 2. finalize the file
254
- stop_recording { "sessionId": "rec-…" }
255
- // -> { "durationSec": 4.2, "finalizedGracefully": true }
256
-
257
- // 3. look at it: the frames come back inline, so the model sees them directly
258
- sample_frames { "input": "…/recordings/rec-….mp4", "timestamps": [0.5, 2, 3.5] }
259
- // -> { "frames": ["…/frames/…/frame_000_0.5s.png", …], "inlineImages": 3 }
260
- // + 3 image blocks the client shows to the model
261
- ```
262
-
263
- 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.
264
-
265
- `screenshot { "target": "window:My App" }` is the one-shot equivalent for a still, and also returns the image inline.
266
-
267
- 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:
268
-
269
- ```jsonc
270
- // 1. keep a rolling 60 s buffer for the whole test loop (maxDurationSec 0 = no cap)
271
- start_recording { "target": "window:My App", "replayBufferSec": 60, "maxDurationSec": 0, "events": true }
272
- // -> { "sessionId": "rec-…", "replay": { "bufferSec": 60, "segmentSec": 2 } }
273
-
274
- // 2. a run fails: keep the last 30 s; the buffer keeps running for the next failure
275
- save_replay { "sessionId": "rec-…", "lastSec": 30 }
276
- // -> { "outputPath": "…/recordings/replay-….mp4", "durationSec": 30, "eventsPath": "…/replay-….events.jsonl" }
277
-
278
- // 3. done: stop and discard the buffer (save: true would write the whole buffer)
279
- stop_recording { "sessionId": "rec-…" }
280
- ```
281
-
282
- 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.
283
-
284
- Filing the bug an agent just reproduced (record with `events: true` so the clicks become steps):
285
-
286
- ```jsonc
287
- bug_report { "sessionId": "rec-…", "title": "Save fails on a read-only folder", "expected": "The file saves or a clear error" }
288
- // -> { "outputDir": "…/edits/bug-report-…", "reportPath": "…/report.md", "steps": 6,
289
- // "errors": ["Error: Access to the path is denied."], "redaction": { "found": 1, … } }
290
- // review report.md and the returned contact sheet, then:
291
- gh issue create --title "Save fails on a read-only folder" --body-file …/report.md
292
- ```
293
-
294
- Documenting a task as a how-to (record with `events: true`; `add_marker` between phases gives section headings):
295
-
296
- ```jsonc
297
- step_guide { "sessionId": "rec-…", "title": "Export a report as PDF" }
298
- // -> { "outputDir": "…/edits/step-guide-…", "markdownPath": "…/guide.md", "htmlPath": "…/guide.html",
299
- // "steps": [{ "n": 1, "caption": "Click File", "section": "Open the report", "image": "step-01.png" }, …] }
300
- ```
301
-
302
- 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.
303
-
304
- `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.
305
-
306
- ## Prompts and resources
307
-
308
- Beyond tools, the server offers **prompts**: ready-made workflows that clients such as Claude Code and VS Code show as slash commands.
309
-
310
- | Prompt | What it does |
311
- | --- | --- |
312
- | `bug-repro-clip` | Record, find the bug moment, check for secrets, trim, annotate, and export a GIF for an issue. |
313
- | `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. |
314
- | `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. |
315
- | `demo-gif` | Record a feature walkthrough and export a GIF small enough for a README or PR. |
316
- | `verify-ui-change` | Screenshot before, make the change, wait for the screen to settle, diff, and confirm the text. |
317
- | `review-recording` | Summarize what happens in a recording, with timestamps. |
318
-
319
- 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.
320
-
321
- ## Windows notes
322
-
323
- - **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.
324
- - **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.
325
- - **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.
326
- - **Fullscreen-exclusive apps** often produce black frames under `gdigrab`; run the source in borderless-windowed mode for reliable capture.
327
- - **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.
328
- - **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`).
204
+ | `capture` | `start_recording`, `stop_recording`, `pause_recording`, `resume_recording`, `save_replay`, `list_sessions`, `get_session`, `read_events`, `add_marker`, `screenshot`, `list_audio_devices`, `list_video_devices`, `list_targets` |
205
+ | `watch` | `review_recording`, `player_frames`, `sample_frames`, `contact_sheet`, `screen_diff`, `wait_for_change`, `find_text`, `index_recording`, `search_recording` |
206
+ | `edit` | `trim`, `concat`, `convert`, `export_gif`, `crop`, `scale`, `speed`, `compress`, `clip`, `cut_idle`, `cut_by_transcript`, `redact_region`, `pipeline` |
207
+ | `produce` | `overlay`, `callout`, `keystroke_overlay`, `cursor`, `backdrop`, `burn_subtitles`, `chapters`, `xfade_transition`, `assemble_highlights`, `title_card`, `reframe`, `zoom`, `export_preset`, `bug_report`, `step_guide` |
208
+ | `audio` | `extract_audio`, `normalize_audio`, `denoise`, `transcribe`, `music_bed`, `narrate` |
209
+ | `core` (always) | `get_media_info`, `doctor` |
210
+ <!-- toolsets:end -->
211
+
212
+ ## More docs
213
+
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):
216
+
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).
329
224
 
330
225
  ## Privacy
331
226
 
332
- - **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.
333
- - **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.
334
- - **What is stored, and where.** Everything goes under `SCREENCAST_HOME` (default `<homedir>/.screencast-mcp`) unless a call names another path:
335
- - `recordings/`: recordings, plus each one's `.events.jsonl` when the event log is on
336
- - `screenshots/`: `screenshot` output, and `find_text` / `wait_for_change` captures only with `keep: true`
337
- - `frames/`: `sample_frames` and `contact_sheet` output
338
- - `edits/`: edit and produce output
339
- - `sessions.json`: the session registry (ids, targets, paths, times)
340
-
341
- `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.
342
- - **What the event log records.** Only with `start_recording` `events: true`, 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.
343
- - **Microphone capture is not supported.** System audio is recorded only with `audio.source` = `system`.
344
- - **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.
345
-
346
- ## Threat model
347
-
348
- > [!WARNING]
349
- > 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.
350
-
351
- - **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)).
352
- - **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).
353
- - **Public repo, private captures.** The `.gitignore` blocks recordings, frames, screenshots, and common video/image output so test media cannot be committed by accident.
354
- - **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.
355
- - **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.
356
- - **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.
357
- - **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.
358
-
359
- ## Project structure
360
-
361
- ```
362
- .
363
- ├── src/
364
- │ ├── index.ts # MCP server entry (stdio); registers every tool, reaps orphans
365
- │ ├── prompts.ts # MCP prompts (workflows as slash commands)
366
- │ ├── resources.ts # MCP resources (sessions, posters)
367
- │ ├── wgcRecorder.ts # recorder process for backend: "wgc"
368
- │ ├── tools/ # one file per tool
369
- │ ├── utils/ # pure builders and helpers (ffmpeg args, targets, sessions, ...)
370
- │ └── __tests__/ # vitest: unit, ffmpeg integration, guarded local-capture harness
371
- ├── assets/ # bundled fonts and the review player (assets/ui)
372
- ├── docs/ # GitHub Pages site (scripts/build-docs-pages.mjs writes the recipe pages)
373
- ├── scripts/ # Claude Desktop bundle (.mcpb) and docs page builders
374
- ├── mcp-tools.json # canonical tool manifest (kept in sync with src/tools)
375
- ├── server.json # MCP Registry listing (name matches package.json mcpName)
376
- ├── .github/workflows/ # CI, release, npm publish, Pages, ecosystem drift check
377
- ├── ROADMAP.md · CONTRIBUTING.md · SECURITY.md · LICENSE
378
- └── package.json
379
- ```
380
-
381
- ## Development
382
-
383
- ```bash
384
- git clone https://github.com/TMHSDigital/screencast-mcp.git
385
- cd screencast-mcp
386
- npm install
387
- npm run build # tsc -> dist/
388
- npm test # vitest: unit tests, plus the ffmpeg integration suite when ffmpeg is on PATH
389
- npm run dev # tsx watch
390
- ```
391
-
392
- To run your build from a client, point it at `dist/index.js`: `"command": "node"`, `"args": ["C:/path/to/screencast-mcp/dist/index.js"]`.
393
-
394
- 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.
395
-
396
- 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:
397
-
398
- ```bash
399
- RUN_LOCAL_CAPTURE_TESTS=1 npm test # Windows + ffmpeg + a real display
400
- ```
401
-
402
- 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.
403
-
404
- ```bash
405
- npm run build && npm run eval # oracle mode
406
- npm run eval -- --agent anthropic --json evals/results/baseline.json
407
- ```
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.
408
232
 
409
233
  ## Contributing
410
234
 
411
- 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).
412
236
 
413
237
  ## License
414
238