@tmhs/screencast-mcp 0.44.2 → 0.45.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.
- package/README.md +41 -7
- package/assets/ui/player.html +9 -0
- package/assets/ui/player.js +20 -0
- package/dist/index.js +12 -0
- package/dist/prompts.js +18 -1
- package/dist/server.js +12 -0
- package/dist/tools/addMarker.js +89 -0
- package/dist/tools/backdrop.js +89 -0
- package/dist/tools/bugReport.js +266 -0
- package/dist/tools/chapters.js +156 -0
- package/dist/tools/contactSheet.js +19 -17
- package/dist/tools/findText.js +14 -64
- package/dist/tools/keystrokeOverlay.js +131 -0
- package/dist/tools/pipeline.js +56 -4
- package/dist/tools/reviewRecording.js +12 -0
- package/dist/tools/saveReplay.js +90 -0
- package/dist/tools/startRecording.js +51 -10
- package/dist/tools/stopRecording.js +25 -1
- package/dist/utils/backdrop.js +151 -0
- package/dist/utils/bugReport.js +246 -0
- package/dist/utils/chapters.js +222 -0
- package/dist/utils/keystrokes.js +170 -0
- package/dist/utils/lifecycle.js +11 -2
- package/dist/utils/media.js +5 -2
- package/dist/utils/ocrScan.js +77 -0
- package/dist/utils/pipeline.js +39 -2
- package/dist/utils/replay.js +278 -0
- package/dist/utils/toolsets.js +23 -3
- package/package.json +1 -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
|
|
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 49 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
|
|
|
@@ -92,19 +92,21 @@ What it can do beyond record-and-look:
|
|
|
92
92
|
|
|
93
93
|
## Tools
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
49 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/`.
|
|
96
96
|
|
|
97
97
|
### Capture
|
|
98
98
|
|
|
99
99
|
| Tool | Purpose |
|
|
100
100
|
| --- | --- |
|
|
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`). 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. |
|
|
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. |
|
|
103
104
|
| `list_sessions` | List active and finished sessions. |
|
|
104
105
|
| `get_session` | Inspect a single session by id. |
|
|
105
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. |
|
|
106
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. |
|
|
107
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. |
|
|
108
110
|
| `screenshot` | Capture a single PNG of a `target`, and return it inline as an image the model can view. |
|
|
109
111
|
| `list_audio_devices` | List the DirectShow audio devices ffmpeg can see and flag a likely system-audio loopback device for `start_recording`. |
|
|
110
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`. |
|
|
@@ -147,6 +149,7 @@ These tools re-encode (a filter rewrites pixels, so stream copy does not apply).
|
|
|
147
149
|
| `denoise` | Reduce **steady** background noise (fan, hum, hiss) with `afftdn`, tuned to the file's measured noise floor. Video is copied. |
|
|
148
150
|
| `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. |
|
|
149
151
|
| `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). |
|
|
152
|
+
| `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. |
|
|
150
153
|
| `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. |
|
|
151
154
|
| `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`. |
|
|
152
155
|
|
|
@@ -171,8 +174,11 @@ The production layer turns raw clips into a finished piece. Tools that combine c
|
|
|
171
174
|
| `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). |
|
|
172
175
|
| `reframe` | Re-aspect to `16:9`, `9:16`, `1:1`, or `4:5` with `pad` (letterbox, no content lost) or `crop` (fill, trims overflow). |
|
|
173
176
|
| `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. |
|
|
177
|
+
| `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. |
|
|
178
|
+
| `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. |
|
|
174
179
|
| `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. |
|
|
175
|
-
| `pipeline` | **Several edits in one ffmpeg process**: `steps` of `trim`, `crop`, `scale`, `speed`, `redact`, `callout`, `reframe`, `zoom` (keyframes), ending optionally in `export_preset` or `export_gif`, each with its tool's options. One re-encode, no intermediate files, and a recipe you can save and re-run on the next recording; `dryRun` returns the planned command. |
|
|
180
|
+
| `pipeline` | **Several edits in one ffmpeg process**: `steps` of `trim`, `crop`, `scale`, `speed`, `redact`, `callout`, `keystroke_overlay`, `reframe`, `zoom` (keyframes), `backdrop`, ending optionally in `export_preset` or `export_gif`, each with its tool's options. 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. |
|
|
181
|
+
| `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). |
|
|
176
182
|
|
|
177
183
|
### Targets
|
|
178
184
|
|
|
@@ -216,10 +222,10 @@ Edit and produce tools write to a `<name>.partial.<ext>` file next to the output
|
|
|
216
222
|
|
|
217
223
|
| Toolset | Tools |
|
|
218
224
|
| --- | --- |
|
|
219
|
-
| `capture` | `start_recording`, `stop_recording`, `list_sessions`, `get_session`, `read_events`, `screenshot`, `list_targets`, `list_audio_devices` |
|
|
225
|
+
| `capture` | `start_recording`, `stop_recording`, `save_replay`, `list_sessions`, `get_session`, `read_events`, `add_marker`, `screenshot`, `list_targets`, `list_audio_devices` |
|
|
220
226
|
| `watch` | `sample_frames`, `contact_sheet`, `screen_diff`, `wait_for_change`, `find_text`, `review_recording`, `player_frames` |
|
|
221
227
|
| `edit` | `pipeline`, `trim`, `clip`, `concat`, `convert`, `export_gif`, `crop`, `scale`, `speed`, `compress`, `redact_region`, `cut_idle` |
|
|
222
|
-
| `produce` | `callout`, `overlay`, `zoom`, `reframe`, `title_card`, `xfade_transition`, `assemble_highlights`, `export_preset`, `burn_subtitles` |
|
|
228
|
+
| `produce` | `callout`, `keystroke_overlay`, `backdrop`, `overlay`, `zoom`, `reframe`, `title_card`, `xfade_transition`, `assemble_highlights`, `export_preset`, `burn_subtitles`, `chapters`, `bug_report` |
|
|
223
229
|
| `audio` | `extract_audio`, `normalize_audio`, `denoise`, `transcribe`, `music_bed` |
|
|
224
230
|
| `core` (always) | `doctor`, `get_media_info` |
|
|
225
231
|
|
|
@@ -254,6 +260,33 @@ Don't know where to look? `sample_frames { "input": "…", "mode": "scenes" }` r
|
|
|
254
260
|
|
|
255
261
|
`screenshot { "target": "window:My App" }` is the one-shot equivalent for a still, and also returns the image inline.
|
|
256
262
|
|
|
263
|
+
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:
|
|
264
|
+
|
|
265
|
+
```jsonc
|
|
266
|
+
// 1. keep a rolling 60 s buffer for the whole test loop (maxDurationSec 0 = no cap)
|
|
267
|
+
start_recording { "target": "window:My App", "replayBufferSec": 60, "maxDurationSec": 0, "events": true }
|
|
268
|
+
// -> { "sessionId": "rec-…", "replay": { "bufferSec": 60, "segmentSec": 2 } }
|
|
269
|
+
|
|
270
|
+
// 2. a run fails: keep the last 30 s; the buffer keeps running for the next failure
|
|
271
|
+
save_replay { "sessionId": "rec-…", "lastSec": 30 }
|
|
272
|
+
// -> { "outputPath": "…/recordings/replay-….mp4", "durationSec": 30, "eventsPath": "…/replay-….events.jsonl" }
|
|
273
|
+
|
|
274
|
+
// 3. done: stop and discard the buffer (save: true would write the whole buffer)
|
|
275
|
+
stop_recording { "sessionId": "rec-…" }
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
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.
|
|
279
|
+
|
|
280
|
+
Filing the bug an agent just reproduced (record with `events: true` so the clicks become steps):
|
|
281
|
+
|
|
282
|
+
```jsonc
|
|
283
|
+
bug_report { "sessionId": "rec-…", "title": "Save fails on a read-only folder", "expected": "The file saves or a clear error" }
|
|
284
|
+
// -> { "outputDir": "…/edits/bug-report-…", "reportPath": "…/report.md", "steps": 6,
|
|
285
|
+
// "errors": ["Error: Access to the path is denied."], "redaction": { "found": 1, … } }
|
|
286
|
+
// review report.md and the returned contact sheet, then:
|
|
287
|
+
gh issue create --title "Save fails on a read-only folder" --body-file …/report.md
|
|
288
|
+
```
|
|
289
|
+
|
|
257
290
|
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.
|
|
258
291
|
|
|
259
292
|
`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.
|
|
@@ -265,6 +298,7 @@ Beyond tools, the server offers **prompts**: ready-made workflows that clients s
|
|
|
265
298
|
| Prompt | What it does |
|
|
266
299
|
| --- | --- |
|
|
267
300
|
| `bug-repro-clip` | Record, find the bug moment, check for secrets, trim, annotate, and export a GIF for an issue. |
|
|
301
|
+
| `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. |
|
|
268
302
|
| `demo-gif` | Record a feature walkthrough and export a GIF small enough for a README or PR. |
|
|
269
303
|
| `verify-ui-change` | Screenshot before, make the change, wait for the screen to settle, diff, and confirm the text. |
|
|
270
304
|
| `review-recording` | Summarize what happens in a recording, with timestamps. |
|
package/assets/ui/player.html
CHANGED
|
@@ -63,6 +63,13 @@
|
|
|
63
63
|
.timeline { position: relative; height: 56px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; touch-action: none; }
|
|
64
64
|
.seek { position: absolute; inset: 0; border-radius: 5px; }
|
|
65
65
|
#ticks i { position: absolute; bottom: 0; width: 2px; height: 9px; margin-left: -1px; background: var(--amber); opacity: .8; pointer-events: none; }
|
|
66
|
+
/* Markers (#174): full-height ink ticks, a REC-red cap, and a list below. */
|
|
67
|
+
#marks b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); opacity: .85; pointer-events: none; }
|
|
68
|
+
#marks b::before { content: ""; position: absolute; top: 0; left: -3px; width: 8px; height: 6px; background: var(--rec); border-radius: 0 0 2px 2px; }
|
|
69
|
+
#markList { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
|
|
70
|
+
#markList button { font: 12px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .55rem; cursor: pointer; color: var(--ink); }
|
|
71
|
+
#markList button:hover { border-color: var(--rec); }
|
|
72
|
+
#markList button span { color: var(--rec); margin-right: .4rem; font-variant-numeric: tabular-nums; }
|
|
66
73
|
#strip { position: absolute; inset: 0; display: flex; overflow: hidden; border-radius: 5px; opacity: .55; }
|
|
67
74
|
#strip img { height: 100%; flex: 1 1 0; min-width: 0; object-fit: cover; pointer-events: none; }
|
|
68
75
|
.shade { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); pointer-events: none; }
|
|
@@ -114,6 +121,7 @@
|
|
|
114
121
|
<div id="strip"></div>
|
|
115
122
|
<div class="shade" id="shadeIn"></div><div class="shade" id="shadeOut"></div>
|
|
116
123
|
<div id="ticks"></div>
|
|
124
|
+
<div id="marks"></div>
|
|
117
125
|
<div id="head"></div>
|
|
118
126
|
<!-- Sliders (#243): arrows move a frame, Page Up/Down a tenth, Home/End the ends. -->
|
|
119
127
|
<div class="seek" id="seek" role="slider" tabindex="0" aria-label="Playhead" aria-disabled="true"
|
|
@@ -124,6 +132,7 @@
|
|
|
124
132
|
aria-valuemin="0" aria-valuemax="0" aria-valuenow="0"></div>
|
|
125
133
|
</div>
|
|
126
134
|
<div class="row times"><span>IN <b id="inT">0.0s</b></span><span>OUT <b id="outT">0.0s</b></span><span id="lenT"></span><span id="sampling"></span></div>
|
|
135
|
+
<ul id="markList" aria-label="Markers" hidden></ul>
|
|
127
136
|
<ul id="boxList" aria-label="Redaction boxes"></ul>
|
|
128
137
|
<form id="boxForm" novalidate>
|
|
129
138
|
<fieldset id="boxFields" disabled>
|
package/assets/ui/player.js
CHANGED
|
@@ -121,6 +121,26 @@
|
|
|
121
121
|
t.style.left = `${pct(S.times[i])}%`;
|
|
122
122
|
return t;
|
|
123
123
|
}));
|
|
124
|
+
// Markers (#174): a tick on the timeline and a button that seeks to it.
|
|
125
|
+
const marks = Array.isArray(meta.markers) ? meta.markers.filter((m) => m && typeof m.t === "number" && m.t <= S.duration) : [];
|
|
126
|
+
$("marks").replaceChildren(...marks.map((m) => {
|
|
127
|
+
const b = document.createElement("b");
|
|
128
|
+
b.style.left = `${pct(m.t)}%`;
|
|
129
|
+
return b;
|
|
130
|
+
}));
|
|
131
|
+
$("markList").replaceChildren(...marks.map((m) => {
|
|
132
|
+
const li = document.createElement("li");
|
|
133
|
+
const btn = document.createElement("button");
|
|
134
|
+
btn.type = "button";
|
|
135
|
+
const tc = document.createElement("span");
|
|
136
|
+
tc.textContent = fmt(m.t);
|
|
137
|
+
btn.append(tc, String(m.label || "Marker"));
|
|
138
|
+
btn.setAttribute("aria-label", `Go to marker ${m.label || ""} at ${fmt(m.t)}`);
|
|
139
|
+
btn.addEventListener("click", () => { stop(); show(frameAt(m.t)); render(); });
|
|
140
|
+
li.appendChild(btn);
|
|
141
|
+
return li;
|
|
142
|
+
}));
|
|
143
|
+
$("markList").hidden = marks.length === 0;
|
|
124
144
|
const every = meta.intervalSec ?? S.duration / S.frames.length;
|
|
125
145
|
$("sampling").textContent = `1 frame / ${every.toFixed(1)}s` + (S.scene.size ? `, +${S.scene.size} at scene changes` : "");
|
|
126
146
|
["play", "draw"].forEach((id) => ($(id).disabled = false));
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { abortEditJobs } from "./utils/jobs.js";
|
|
|
6
6
|
import { probeDuration, stopAll } from "./utils/lifecycle.js";
|
|
7
7
|
import { createServer } from "./server.js";
|
|
8
8
|
import { pruneCaptures, retentionDays, RETENTION_ENV } from "./utils/retention.js";
|
|
9
|
+
import { cleanupReplayDirs } from "./utils/replay.js";
|
|
9
10
|
const server = createServer();
|
|
10
11
|
async function main() {
|
|
11
12
|
try {
|
|
@@ -17,6 +18,17 @@ async function main() {
|
|
|
17
18
|
catch (err) {
|
|
18
19
|
process.stderr.write(`Orphan reaping skipped: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
19
20
|
}
|
|
21
|
+
try {
|
|
22
|
+
const live = getStore()
|
|
23
|
+
.list()
|
|
24
|
+
.flatMap((r) => (r.status === "recording" && r.replay ? [r.replay.dir] : []));
|
|
25
|
+
const removed = cleanupReplayDirs(live);
|
|
26
|
+
if (removed > 0)
|
|
27
|
+
process.stderr.write(`Removed ${removed} leftover replay buffer(s).\n`);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
process.stderr.write(`Replay buffer cleanup skipped: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
31
|
+
}
|
|
20
32
|
const days = retentionDays();
|
|
21
33
|
if (days !== null) {
|
|
22
34
|
const pruned = pruneCaptures(days);
|
package/dist/prompts.js
CHANGED
|
@@ -8,7 +8,15 @@ export const PROMPT_TEXT = {
|
|
|
8
8
|
3. find_text { input: <recording>, scanEverySec: 1, query: "sk-|ghp_|api.?key|token|password", regex: true, redact: true } to check the whole clip, not one frame. If anything sensitive shows up, redact_region its redactRegions (each has its own start/end) with style "box" before sharing. OCR can miss text, so also look at the frames yourself.
|
|
9
9
|
4. trim (or clip) to the few seconds around the bug, and callout to box or point at it.
|
|
10
10
|
5. export_gif { input: <clip>, maxBytes: 10000000 } so it can be pasted into an issue or PR.
|
|
11
|
-
Report the final file path, what the clip shows, and anything you redacted
|
|
11
|
+
Report the final file path, what the clip shows, and anything you redacted. (To file it as an issue, bug_report does steps 3-5 in one call and writes report.md.)`,
|
|
12
|
+
fileBugReport: (target, notes, expected) => `File a bug report for ${target}, with a redacted repro package.${notes ? ` The bug: ${notes}.` : ""}${expected ? ` Expected: ${expected}.` : ""}
|
|
13
|
+
|
|
14
|
+
1. start_recording { target: "${target}", events: true } so clicks and shortcuts are logged as repro steps, then reproduce the bug (or ask me to), and stop_recording right after it shows.
|
|
15
|
+
2. contact_sheet { input: <recording> } and find the moment it goes wrong; note its time.
|
|
16
|
+
3. bug_report { sessionId: <session id>, title: <one-line summary>, actual: <what happened>, expected: <what should happen>, clipSec: 30 } (or start/end around that moment). It scans the clip for secrets with OCR and boxes them out before writing the clip, GIF, contact sheet, steps, error text, and report.md.
|
|
17
|
+
4. Read report.md and look at the contact sheet it returns: check the steps make sense and that nothing sensitive is left (OCR can miss text; add regions and rerun with overwrite: true if so).
|
|
18
|
+
5. Only if I confirm, run gh issue create --title <title> --body-file <reportPath>, then attach the GIF to the issue.
|
|
19
|
+
Report the folder path, the steps, the error text found, and what was redacted.`,
|
|
12
20
|
demoGif: (target, maxMB) => `Make a demo GIF of ${target} for a README or PR, under ${maxMB} MB.
|
|
13
21
|
|
|
14
22
|
1. start_recording { target: "${target}" }, walk through the feature (or ask me to), then stop_recording.
|
|
@@ -41,6 +49,15 @@ export function registerPrompts(server) {
|
|
|
41
49
|
notes: z.string().optional().describe("What the bug is."),
|
|
42
50
|
},
|
|
43
51
|
}, ({ target, notes }) => message(PROMPT_TEXT.bugReproClip(target || "full", notes ?? "")));
|
|
52
|
+
server.registerPrompt("file-bug-report", {
|
|
53
|
+
title: "File a bug report",
|
|
54
|
+
description: "Record a repro with input events, then package it with bug_report: redacted clip, GIF, steps, error text, and report.md.",
|
|
55
|
+
argsSchema: {
|
|
56
|
+
target: z.string().optional().describe("What to record, e.g. window:My App (default: full)."),
|
|
57
|
+
notes: z.string().optional().describe("What the bug is."),
|
|
58
|
+
expected: z.string().optional().describe("What should happen instead."),
|
|
59
|
+
},
|
|
60
|
+
}, ({ target, notes, expected }) => message(PROMPT_TEXT.fileBugReport(target || "full", notes ?? "", expected ?? "")));
|
|
44
61
|
server.registerPrompt("demo-gif", {
|
|
45
62
|
title: "Make a demo GIF",
|
|
46
63
|
description: "Record a feature walkthrough and export a GIF small enough for a README or PR.",
|
package/dist/server.js
CHANGED
|
@@ -3,9 +3,12 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { parseToolsets, serverInstructions, SELECTABLE_TOOLSETS, toolsetOf, } from "./utils/toolsets.js";
|
|
4
4
|
import { register as registerStartRecording } from "./tools/startRecording.js";
|
|
5
5
|
import { register as registerStopRecording } from "./tools/stopRecording.js";
|
|
6
|
+
import { register as registerSaveReplay } from "./tools/saveReplay.js";
|
|
6
7
|
import { register as registerListSessions } from "./tools/listSessions.js";
|
|
7
8
|
import { register as registerGetSession } from "./tools/getSession.js";
|
|
8
9
|
import { register as registerReadEvents } from "./tools/readEvents.js";
|
|
10
|
+
import { register as registerAddMarker } from "./tools/addMarker.js";
|
|
11
|
+
import { register as registerChapters } from "./tools/chapters.js";
|
|
9
12
|
import { register as registerReviewRecording } from "./tools/reviewRecording.js";
|
|
10
13
|
import { register as registerScreenshot } from "./tools/screenshot.js";
|
|
11
14
|
import { register as registerSampleFrames } from "./tools/sampleFrames.js";
|
|
@@ -23,6 +26,8 @@ import { register as registerScale } from "./tools/scale.js";
|
|
|
23
26
|
import { register as registerSpeed } from "./tools/speed.js";
|
|
24
27
|
import { register as registerOverlay } from "./tools/overlay.js";
|
|
25
28
|
import { register as registerCallout } from "./tools/callout.js";
|
|
29
|
+
import { register as registerKeystrokeOverlay } from "./tools/keystrokeOverlay.js";
|
|
30
|
+
import { register as registerBackdrop } from "./tools/backdrop.js";
|
|
26
31
|
import { register as registerCompress } from "./tools/compress.js";
|
|
27
32
|
import { register as registerExtractAudio } from "./tools/extractAudio.js";
|
|
28
33
|
import { register as registerNormalizeAudio } from "./tools/normalizeAudio.js";
|
|
@@ -43,6 +48,7 @@ import { register as registerReframe } from "./tools/reframe.js";
|
|
|
43
48
|
import { register as registerZoom } from "./tools/zoom.js";
|
|
44
49
|
import { register as registerPipeline } from "./tools/pipeline.js";
|
|
45
50
|
import { register as registerExportPreset } from "./tools/exportPreset.js";
|
|
51
|
+
import { register as registerBugReport } from "./tools/bugReport.js";
|
|
46
52
|
import { registerResources } from "./resources.js";
|
|
47
53
|
import { registerPrompts } from "./prompts.js";
|
|
48
54
|
import { attachLogging } from "./utils/logging.js";
|
|
@@ -62,9 +68,11 @@ export function createServer(options = {}) {
|
|
|
62
68
|
const tools = captureRegisteredTools(server);
|
|
63
69
|
registerStartRecording(server);
|
|
64
70
|
registerStopRecording(server);
|
|
71
|
+
registerSaveReplay(server);
|
|
65
72
|
registerListSessions(server);
|
|
66
73
|
registerGetSession(server);
|
|
67
74
|
registerReadEvents(server);
|
|
75
|
+
registerAddMarker(server);
|
|
68
76
|
registerReviewRecording(server);
|
|
69
77
|
registerScreenshot(server);
|
|
70
78
|
registerSampleFrames(server);
|
|
@@ -82,12 +90,15 @@ export function createServer(options = {}) {
|
|
|
82
90
|
registerSpeed(server);
|
|
83
91
|
registerOverlay(server);
|
|
84
92
|
registerCallout(server);
|
|
93
|
+
registerKeystrokeOverlay(server);
|
|
94
|
+
registerBackdrop(server);
|
|
85
95
|
registerCompress(server);
|
|
86
96
|
registerExtractAudio(server);
|
|
87
97
|
registerNormalizeAudio(server);
|
|
88
98
|
registerDenoise(server);
|
|
89
99
|
registerTranscribe(server);
|
|
90
100
|
registerBurnSubtitles(server);
|
|
101
|
+
registerChapters(server);
|
|
91
102
|
registerClip(server);
|
|
92
103
|
registerCutIdle(server);
|
|
93
104
|
registerRedactRegion(server);
|
|
@@ -102,6 +113,7 @@ export function createServer(options = {}) {
|
|
|
102
113
|
registerZoom(server);
|
|
103
114
|
registerPipeline(server);
|
|
104
115
|
registerExportPreset(server);
|
|
116
|
+
registerBugReport(server);
|
|
105
117
|
applyToolsets(tools, selection);
|
|
106
118
|
registerResources(server);
|
|
107
119
|
registerPrompts(server);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { looseOutput } from "../utils/toolSpec.js";
|
|
5
|
+
import { assertOutputAllowed } from "../utils/paths.js";
|
|
6
|
+
import { cleanLabel, insertMarker, markerTimeSec, markersPath, readMarkers, writeMarkers, MAX_LABEL, } from "../utils/chapters.js";
|
|
7
|
+
import { getStore } from "../context.js";
|
|
8
|
+
const ADDS_MARKER = {
|
|
9
|
+
readOnlyHint: false,
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
idempotentHint: false,
|
|
12
|
+
openWorldHint: false,
|
|
13
|
+
};
|
|
14
|
+
const inputSchema = {
|
|
15
|
+
label: z.string().min(1).max(MAX_LABEL).describe('e.g. "bug appears".'),
|
|
16
|
+
sessionId: z.string().min(1).optional().describe("Recording to mark (a stopped one needs at)."),
|
|
17
|
+
input: z.string().min(1).optional().describe("Or a video path (needs at)."),
|
|
18
|
+
at: z
|
|
19
|
+
.number()
|
|
20
|
+
.min(0)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Video second (default: now, while recording)."),
|
|
23
|
+
};
|
|
24
|
+
export function register(server) {
|
|
25
|
+
server.registerTool("add_marker", {
|
|
26
|
+
title: "Add Marker",
|
|
27
|
+
description: "Mark a labelled moment on a recording, live or at a second. Kept in the session and a sidecar; " +
|
|
28
|
+
"chapters and pipeline turn markers into chapters.",
|
|
29
|
+
inputSchema,
|
|
30
|
+
outputSchema: looseOutput({ count: z.number().int(), markersPath: z.string() }),
|
|
31
|
+
annotations: ADDS_MARKER,
|
|
32
|
+
}, async (args) => {
|
|
33
|
+
try {
|
|
34
|
+
if (!args.sessionId && !args.input)
|
|
35
|
+
throw new ScreencastError("Pass sessionId or input.");
|
|
36
|
+
if (args.sessionId) {
|
|
37
|
+
const store = getStore();
|
|
38
|
+
const record = store.get(args.sessionId);
|
|
39
|
+
if (!record)
|
|
40
|
+
throw new ScreencastError(`No session with id "${args.sessionId}".`);
|
|
41
|
+
let t = args.at;
|
|
42
|
+
if (t === undefined) {
|
|
43
|
+
if (record.status !== "recording") {
|
|
44
|
+
throw new ScreencastError(`Session "${args.sessionId}" is ${record.status}, so there is no "now" to mark.`, "Pass at (video seconds) to mark a stopped recording.");
|
|
45
|
+
}
|
|
46
|
+
t = markerTimeSec(record.videoStartMs ?? Date.parse(record.startedAt), Date.now());
|
|
47
|
+
}
|
|
48
|
+
else if (record.durationSec != null && t > record.durationSec) {
|
|
49
|
+
throw new ScreencastError(`at ${t}s is past the end of the recording (${record.durationSec}s).`);
|
|
50
|
+
}
|
|
51
|
+
const marker = { t, label: args.label, at: new Date().toISOString() };
|
|
52
|
+
const markers = insertMarker(record.markers ?? [], marker);
|
|
53
|
+
store.update(args.sessionId, { markers });
|
|
54
|
+
let sidecar = markersPath(record.outputPath);
|
|
55
|
+
let warning;
|
|
56
|
+
try {
|
|
57
|
+
sidecar = writeMarkers(record.outputPath, markers, args.sessionId);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
warning = `Saved in the session, but the sidecar ${sidecar} could not be written: ${err.message}`;
|
|
61
|
+
}
|
|
62
|
+
return okResponse({
|
|
63
|
+
sessionId: args.sessionId,
|
|
64
|
+
marker: { t: Math.round(t * 1000) / 1000, label: cleanLabel(args.label) },
|
|
65
|
+
count: markers.length,
|
|
66
|
+
markersPath: sidecar,
|
|
67
|
+
...(record.status === "recording" ? { live: true } : {}),
|
|
68
|
+
...(warning ? { warning } : {}),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const input = args.input;
|
|
72
|
+
if (args.at === undefined)
|
|
73
|
+
throw new ScreencastError("Pass at (video seconds) to mark a file.");
|
|
74
|
+
if (!existsSync(input))
|
|
75
|
+
throw new ScreencastError(`Input file not found: ${input}`);
|
|
76
|
+
assertOutputAllowed(markersPath(input));
|
|
77
|
+
const markers = insertMarker(readMarkers(input), { t: args.at, label: args.label, at: new Date().toISOString() });
|
|
78
|
+
const path = writeMarkers(input, markers);
|
|
79
|
+
return okResponse({
|
|
80
|
+
marker: { t: Math.round(args.at * 1000) / 1000, label: cleanLabel(args.label) },
|
|
81
|
+
count: markers.length,
|
|
82
|
+
markersPath: path,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return errorResponse(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { extname } from "node:path";
|
|
4
|
+
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
5
|
+
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
6
|
+
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
7
|
+
import { runEditJob } from "../utils/jobs.js";
|
|
8
|
+
import { buildBackdropArgs, BACKDROP_PRESET_NAMES, MAX_BACKDROP_COLORS } from "../utils/backdrop.js";
|
|
9
|
+
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
10
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
11
|
+
const STILL = /\.(png|jpe?g|bmp|tiff?|webp)$/i;
|
|
12
|
+
export const backdropOptionsSchema = {
|
|
13
|
+
preset: z.enum(BACKDROP_PRESET_NAMES).optional(),
|
|
14
|
+
colors: z.array(z.string()).min(1).max(MAX_BACKDROP_COLORS).optional(),
|
|
15
|
+
image: z.string().min(1).optional(),
|
|
16
|
+
padding: z.number().int().nonnegative().max(2000).optional(),
|
|
17
|
+
radius: z.number().int().nonnegative().max(1000).optional(),
|
|
18
|
+
shadow: z.number().int().nonnegative().max(200).optional(),
|
|
19
|
+
shadowOpacity: z.number().min(0).max(1).optional(),
|
|
20
|
+
aspect: z.enum(["16:9", "9:16", "1:1", "4:5"]).optional(),
|
|
21
|
+
};
|
|
22
|
+
const o = backdropOptionsSchema;
|
|
23
|
+
const inputSchema = {
|
|
24
|
+
input: z.string().min(1).describe("Path to the source video or image (png/jpg)."),
|
|
25
|
+
preset: o.preset.describe("Gradient: desktop (default, dark slate), rec (red), amber, light."),
|
|
26
|
+
colors: o.colors.describe("Instead: 1 color = solid, 2-4 = diagonal gradient."),
|
|
27
|
+
image: o.image.describe("Instead: a wallpaper image, scaled to cover."),
|
|
28
|
+
padding: o.padding.describe("px around the content (default 6% of the longer side)."),
|
|
29
|
+
radius: o.radius.describe("Corner radius px (default ~1.2% of the longer side; 0 = square)."),
|
|
30
|
+
shadow: o.shadow.describe("Shadow blur px (default ~2.5%; 0 = none)."),
|
|
31
|
+
shadowOpacity: o.shadowOpacity.describe("Default 0.5."),
|
|
32
|
+
aspect: o.aspect.describe("Output on this aspect's canvas (1920x1080, ...), content scaled to fit."),
|
|
33
|
+
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits (screenshots for an image)."),
|
|
34
|
+
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
35
|
+
};
|
|
36
|
+
export function register(server) {
|
|
37
|
+
server.registerTool("backdrop", {
|
|
38
|
+
title: "Add Backdrop",
|
|
39
|
+
description: "Frame a video or screenshot on a gradient, color, or wallpaper with padding, rounded corners, " +
|
|
40
|
+
"and a drop shadow, optionally on a 16:9/1:1/9:16/4:5 canvas.",
|
|
41
|
+
inputSchema,
|
|
42
|
+
outputSchema: looseOutput({ outputPath: z.string(), width: z.number().int(), height: z.number().int() }),
|
|
43
|
+
annotations: WRITES_FILE,
|
|
44
|
+
}, async (args, extra) => {
|
|
45
|
+
try {
|
|
46
|
+
requireFfmpeg();
|
|
47
|
+
if (!existsSync(args.input))
|
|
48
|
+
throw new ScreencastError(`Input file not found: ${args.input}`);
|
|
49
|
+
if (args.image && !existsSync(args.image))
|
|
50
|
+
throw new ScreencastError(`Background image not found: ${args.image}`);
|
|
51
|
+
const still = STILL.test(args.input);
|
|
52
|
+
if (still && args.output && !STILL.test(args.output)) {
|
|
53
|
+
throw new ScreencastError("An image input writes an image: give the output a .png or .jpg extension.");
|
|
54
|
+
}
|
|
55
|
+
if (!still)
|
|
56
|
+
assertEditContainer(args.output);
|
|
57
|
+
const info = await probeMedia(args.input);
|
|
58
|
+
if (!info.width || !info.height)
|
|
59
|
+
throw new ScreencastError(`Could not read the size of ${args.input}.`);
|
|
60
|
+
const ext = still ? (/\.jpe?g$/i.test(args.input) ? extname(args.input).toLowerCase() : ".png") : editOutputExt(args.input);
|
|
61
|
+
const output = resolveOutput(args.output, subdir(still ? "screenshots" : "edits"), `backdrop-${stamp()}-${rand()}${ext}`, args.overwrite);
|
|
62
|
+
const opts = {
|
|
63
|
+
preset: args.preset,
|
|
64
|
+
colors: args.colors,
|
|
65
|
+
image: args.image,
|
|
66
|
+
padding: args.padding,
|
|
67
|
+
radius: args.radius,
|
|
68
|
+
shadow: args.shadow,
|
|
69
|
+
shadowOpacity: args.shadowOpacity,
|
|
70
|
+
aspect: args.aspect,
|
|
71
|
+
};
|
|
72
|
+
const { args: ffArgs, layout } = buildBackdropArgs(args.input, output, opts, { width: info.width, height: info.height }, still);
|
|
73
|
+
await runEditJob(ffArgs, { output, durationSec: still ? null : info.durationSec, extra });
|
|
74
|
+
return okResponse({
|
|
75
|
+
outputPath: output,
|
|
76
|
+
width: layout.canvasW,
|
|
77
|
+
height: layout.canvasH,
|
|
78
|
+
content: { x: layout.x, y: layout.y, width: layout.contentW, height: layout.contentH },
|
|
79
|
+
padding: layout.padding,
|
|
80
|
+
radius: layout.radius,
|
|
81
|
+
shadow: layout.shadow,
|
|
82
|
+
background: args.image ? "image" : args.colors ? "colors" : (args.preset ?? "desktop"),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return errorResponse(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|