@tmhs/screencast-mcp 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +34 -0
- package/README.md +212 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +13 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/concat.d.ts +3 -0
- package/dist/tools/concat.d.ts.map +1 -0
- package/dist/tools/concat.js +42 -0
- package/dist/tools/concat.js.map +1 -0
- package/dist/tools/convert.d.ts +3 -0
- package/dist/tools/convert.d.ts.map +1 -0
- package/dist/tools/convert.js +38 -0
- package/dist/tools/convert.js.map +1 -0
- package/dist/tools/getMediaInfo.d.ts +3 -0
- package/dist/tools/getMediaInfo.d.ts.map +1 -0
- package/dist/tools/getMediaInfo.js +28 -0
- package/dist/tools/getMediaInfo.js.map +1 -0
- package/dist/tools/getSession.d.ts +3 -0
- package/dist/tools/getSession.d.ts.map +1 -0
- package/dist/tools/getSession.js +28 -0
- package/dist/tools/getSession.js.map +1 -0
- package/dist/tools/listSessions.d.ts +3 -0
- package/dist/tools/listSessions.d.ts.map +1 -0
- package/dist/tools/listSessions.js +18 -0
- package/dist/tools/listSessions.js.map +1 -0
- package/dist/tools/sampleFrames.d.ts +3 -0
- package/dist/tools/sampleFrames.d.ts.map +1 -0
- package/dist/tools/sampleFrames.js +69 -0
- package/dist/tools/sampleFrames.js.map +1 -0
- package/dist/tools/screenshot.d.ts +3 -0
- package/dist/tools/screenshot.d.ts.map +1 -0
- package/dist/tools/screenshot.js +39 -0
- package/dist/tools/screenshot.js.map +1 -0
- package/dist/tools/startRecording.d.ts +3 -0
- package/dist/tools/startRecording.d.ts.map +1 -0
- package/dist/tools/startRecording.js +107 -0
- package/dist/tools/startRecording.js.map +1 -0
- package/dist/tools/stopRecording.d.ts +3 -0
- package/dist/tools/stopRecording.d.ts.map +1 -0
- package/dist/tools/stopRecording.js +100 -0
- package/dist/tools/stopRecording.js.map +1 -0
- package/dist/tools/trim.d.ts +3 -0
- package/dist/tools/trim.d.ts.map +1 -0
- package/dist/tools/trim.js +38 -0
- package/dist/tools/trim.js.map +1 -0
- package/dist/utils/errors.d.ts +25 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +36 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/ffmpeg.d.ts +24 -0
- package/dist/utils/ffmpeg.d.ts.map +1 -0
- package/dist/utils/ffmpeg.js +88 -0
- package/dist/utils/ffmpeg.js.map +1 -0
- package/dist/utils/media.d.ts +53 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/dist/utils/media.js +133 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/utils/monitors.d.ts +14 -0
- package/dist/utils/monitors.d.ts.map +1 -0
- package/dist/utils/monitors.js +55 -0
- package/dist/utils/monitors.js.map +1 -0
- package/dist/utils/paths.d.ts +11 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +47 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/resolveTarget.d.ts +24 -0
- package/dist/utils/resolveTarget.d.ts.map +1 -0
- package/dist/utils/resolveTarget.js +32 -0
- package/dist/utils/resolveTarget.js.map +1 -0
- package/dist/utils/sessions.d.ts +51 -0
- package/dist/utils/sessions.d.ts.map +1 -0
- package/dist/utils/sessions.js +144 -0
- package/dist/utils/sessions.js.map +1 -0
- package/dist/utils/targets.d.ts +43 -0
- package/dist/utils/targets.d.ts.map +1 -0
- package/dist/utils/targets.js +156 -0
- package/dist/utils/targets.js.map +1 -0
- package/dist/utils/windows.d.ts +43 -0
- package/dist/utils/windows.d.ts.map +1 -0
- package/dist/utils/windows.js +127 -0
- package/dist/utils/windows.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Monitor } from "./monitors.js";
|
|
2
|
+
export type Quality = "draft" | "standard" | "high";
|
|
3
|
+
export type Target = {
|
|
4
|
+
kind: "full";
|
|
5
|
+
} | {
|
|
6
|
+
kind: "monitor";
|
|
7
|
+
index: number;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "window";
|
|
10
|
+
title: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "region";
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const QUALITY_PRESETS: Record<Quality, {
|
|
19
|
+
preset: string;
|
|
20
|
+
crf: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const DEFAULT_FPS = 30;
|
|
23
|
+
export declare const DEFAULT_QUALITY: Quality;
|
|
24
|
+
export declare function buildAudioInputArgs(): string[];
|
|
25
|
+
/** Parse a target spec string into a structured Target. */
|
|
26
|
+
export declare function parseTarget(spec: string): Target;
|
|
27
|
+
/** Resolve a monitor index to its pixel bounds using the supplied monitor list. */
|
|
28
|
+
export declare function resolveMonitor(index: number, monitors: Monitor[]): Monitor;
|
|
29
|
+
/** Encoder args for a quality preset (libx264, web-safe pixel format). */
|
|
30
|
+
export declare function resolveQuality(quality: Quality): string[];
|
|
31
|
+
/** The gdigrab input args (offset/size/input) for a target. */
|
|
32
|
+
export declare function targetInputArgs(target: Target, monitors: Monitor[]): string[];
|
|
33
|
+
export interface CaptureOptions {
|
|
34
|
+
fps?: number;
|
|
35
|
+
quality?: Quality;
|
|
36
|
+
output: string;
|
|
37
|
+
monitors?: Monitor[];
|
|
38
|
+
}
|
|
39
|
+
/** Build the full ffmpeg argument vector for a recording (gdigrab -> mp4). */
|
|
40
|
+
export declare function buildCaptureArgs(target: Target, opts: CaptureOptions): string[];
|
|
41
|
+
/** Build ffmpeg args for a single-frame screenshot (gdigrab -> png). */
|
|
42
|
+
export declare function buildScreenshotArgs(target: Target, output: string, monitors?: Monitor[]): string[];
|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,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CA6B7E;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AASD,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE,CAgB/E;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,OAAO,EAAO,GACvB,MAAM,EAAE,CASV"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture target parsing and gdigrab argument construction.
|
|
3
|
+
*
|
|
4
|
+
* Target grammar (a single string so an agent never has to juggle quoting):
|
|
5
|
+
* full - the whole virtual desktop
|
|
6
|
+
* monitor:<index> - one display; 0 is primary (see monitors.ts)
|
|
7
|
+
* window:<title> - a window by exact title (everything after the colon)
|
|
8
|
+
* region:<x>,<y>,<w>,<h> - an absolute pixel rectangle on the virtual desktop
|
|
9
|
+
*
|
|
10
|
+
* Everything here is pure (the monitor list is passed in), so the offset math
|
|
11
|
+
* that makes monitor:1 grab the second display is unit-tested without Windows.
|
|
12
|
+
*/
|
|
13
|
+
import { ScreencastError } from "./errors.js";
|
|
14
|
+
export const QUALITY_PRESETS = {
|
|
15
|
+
draft: { preset: "ultrafast", crf: 28 },
|
|
16
|
+
standard: { preset: "veryfast", crf: 23 },
|
|
17
|
+
high: { preset: "medium", crf: 18 },
|
|
18
|
+
};
|
|
19
|
+
export const DEFAULT_FPS = 30;
|
|
20
|
+
export const DEFAULT_QUALITY = "standard";
|
|
21
|
+
// Phase 2 seam: audio capture (dshow / WASAPI loopback) attaches here. gdigrab
|
|
22
|
+
// is video-only, so Phase 1 records no audio. Keep this returning [] until the
|
|
23
|
+
// audio device-selection surface lands - do NOT half-wire it.
|
|
24
|
+
export function buildAudioInputArgs() {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
function parseIntStrict(value, label) {
|
|
28
|
+
if (!/^-?\d+$/.test(value.trim())) {
|
|
29
|
+
throw new ScreencastError(`${label} must be an integer, got "${value}".`);
|
|
30
|
+
}
|
|
31
|
+
return parseInt(value, 10);
|
|
32
|
+
}
|
|
33
|
+
/** Parse a target spec string into a structured Target. */
|
|
34
|
+
export function parseTarget(spec) {
|
|
35
|
+
const raw = spec.trim();
|
|
36
|
+
if (raw === "" || raw.toLowerCase() === "full")
|
|
37
|
+
return { kind: "full" };
|
|
38
|
+
const colon = raw.indexOf(":");
|
|
39
|
+
if (colon === -1) {
|
|
40
|
+
throw new ScreencastError(`Unrecognized target "${spec}". Use full | monitor:<index> | ` +
|
|
41
|
+
`window:<title> | region:<x>,<y>,<w>,<h>.`);
|
|
42
|
+
}
|
|
43
|
+
const kind = raw.slice(0, colon).toLowerCase();
|
|
44
|
+
const rest = raw.slice(colon + 1);
|
|
45
|
+
if (kind === "monitor") {
|
|
46
|
+
const index = parseIntStrict(rest, "monitor index");
|
|
47
|
+
if (index < 0)
|
|
48
|
+
throw new ScreencastError("monitor index must be >= 0.");
|
|
49
|
+
return { kind: "monitor", index };
|
|
50
|
+
}
|
|
51
|
+
if (kind === "window") {
|
|
52
|
+
const title = rest.trim();
|
|
53
|
+
if (title === "")
|
|
54
|
+
throw new ScreencastError("window title must not be empty.");
|
|
55
|
+
return { kind: "window", title };
|
|
56
|
+
}
|
|
57
|
+
if (kind === "region") {
|
|
58
|
+
const parts = rest.split(",").map((p) => p.trim());
|
|
59
|
+
if (parts.length !== 4) {
|
|
60
|
+
throw new ScreencastError(`region must be x,y,w,h (4 integers), got "${rest}".`);
|
|
61
|
+
}
|
|
62
|
+
const [x, y, w, h] = [
|
|
63
|
+
parseIntStrict(parts[0], "region x"),
|
|
64
|
+
parseIntStrict(parts[1], "region y"),
|
|
65
|
+
parseIntStrict(parts[2], "region w"),
|
|
66
|
+
parseIntStrict(parts[3], "region h"),
|
|
67
|
+
];
|
|
68
|
+
if (w <= 0 || h <= 0) {
|
|
69
|
+
throw new ScreencastError("region width and height must be positive.");
|
|
70
|
+
}
|
|
71
|
+
return { kind: "region", x, y, w, h };
|
|
72
|
+
}
|
|
73
|
+
throw new ScreencastError(`Unknown target kind "${kind}". Use full | monitor | window | region.`);
|
|
74
|
+
}
|
|
75
|
+
/** Resolve a monitor index to its pixel bounds using the supplied monitor list. */
|
|
76
|
+
export function resolveMonitor(index, monitors) {
|
|
77
|
+
const m = monitors.find((mon) => mon.index === index);
|
|
78
|
+
if (!m) {
|
|
79
|
+
const available = monitors.map((mon) => mon.index).join(", ") || "none";
|
|
80
|
+
throw new ScreencastError(`monitor:${index} not found. Available monitor indexes: ${available}.`);
|
|
81
|
+
}
|
|
82
|
+
return m;
|
|
83
|
+
}
|
|
84
|
+
/** Encoder args for a quality preset (libx264, web-safe pixel format). */
|
|
85
|
+
export function resolveQuality(quality) {
|
|
86
|
+
const q = QUALITY_PRESETS[quality];
|
|
87
|
+
if (!q)
|
|
88
|
+
throw new ScreencastError(`Unknown quality preset "${quality}".`);
|
|
89
|
+
return ["-c:v", "libx264", "-preset", q.preset, "-crf", String(q.crf),
|
|
90
|
+
"-pix_fmt", "yuv420p"];
|
|
91
|
+
}
|
|
92
|
+
/** The gdigrab input args (offset/size/input) for a target. */
|
|
93
|
+
export function targetInputArgs(target, monitors) {
|
|
94
|
+
switch (target.kind) {
|
|
95
|
+
case "full":
|
|
96
|
+
return ["-i", "desktop"];
|
|
97
|
+
case "window":
|
|
98
|
+
// A window target must be resolved to its on-screen rectangle first (see
|
|
99
|
+
// resolveCaptureTarget). gdigrab `title=` grabs a blank surface for
|
|
100
|
+
// GPU-composited windows, so it is never used.
|
|
101
|
+
throw new ScreencastError("Internal: a window target must be resolved to a region before " +
|
|
102
|
+
"building capture args. Call resolveCaptureTarget().");
|
|
103
|
+
case "region":
|
|
104
|
+
return [
|
|
105
|
+
"-offset_x", String(target.x),
|
|
106
|
+
"-offset_y", String(target.y),
|
|
107
|
+
"-video_size", `${target.w}x${target.h}`,
|
|
108
|
+
"-i", "desktop",
|
|
109
|
+
];
|
|
110
|
+
case "monitor": {
|
|
111
|
+
const m = resolveMonitor(target.index, monitors);
|
|
112
|
+
return [
|
|
113
|
+
"-offset_x", String(m.x),
|
|
114
|
+
"-offset_y", String(m.y),
|
|
115
|
+
"-video_size", `${m.width}x${m.height}`,
|
|
116
|
+
"-i", "desktop",
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function validateFps(fps) {
|
|
122
|
+
if (!Number.isInteger(fps) || fps < 1 || fps > 120) {
|
|
123
|
+
throw new ScreencastError("fps must be an integer between 1 and 120.");
|
|
124
|
+
}
|
|
125
|
+
return fps;
|
|
126
|
+
}
|
|
127
|
+
/** Build the full ffmpeg argument vector for a recording (gdigrab -> mp4). */
|
|
128
|
+
export function buildCaptureArgs(target, opts) {
|
|
129
|
+
const fps = validateFps(opts.fps ?? DEFAULT_FPS);
|
|
130
|
+
const quality = opts.quality ?? DEFAULT_QUALITY;
|
|
131
|
+
const monitors = opts.monitors ?? [];
|
|
132
|
+
return [
|
|
133
|
+
"-y",
|
|
134
|
+
"-f", "gdigrab",
|
|
135
|
+
"-framerate", String(fps),
|
|
136
|
+
...targetInputArgs(target, monitors),
|
|
137
|
+
...buildAudioInputArgs(),
|
|
138
|
+
...resolveQuality(quality),
|
|
139
|
+
// Fragmented mp4: keeps the file playable even if the process is killed
|
|
140
|
+
// before the trailing moov atom would normally be written.
|
|
141
|
+
"-movflags", "+frag_keyframe+empty_moov+default_base_moof",
|
|
142
|
+
opts.output,
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
/** Build ffmpeg args for a single-frame screenshot (gdigrab -> png). */
|
|
146
|
+
export function buildScreenshotArgs(target, output, monitors = []) {
|
|
147
|
+
return [
|
|
148
|
+
"-y",
|
|
149
|
+
"-f", "gdigrab",
|
|
150
|
+
"-framerate", "1",
|
|
151
|
+
...targetInputArgs(target, monitors),
|
|
152
|
+
"-frames:v", "1",
|
|
153
|
+
output,
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../src/utils/targets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,CAAC,MAAM,eAAe,GAC1B;IACE,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE;IACvC,QAAQ,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE;IACzC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE;CACpC,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAY,UAAU,CAAC;AAEnD,+EAA+E;AAC/E,+EAA+E;AAC/E,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB;IACjC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,eAAe,CAAC,GAAG,KAAK,6BAA6B,KAAK,IAAI,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,WAAW,C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@@
|
|
|
1
|
+
export interface RawWindow {
|
|
2
|
+
title: string;
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
minimized: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface WindowQuery {
|
|
10
|
+
/** Virtual desktop bounds, used to clamp an over-sized/off-screen window. */
|
|
11
|
+
virtual: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
/** Visible top-level windows with a non-empty title, in Z-order (top first). */
|
|
18
|
+
windows: RawWindow[];
|
|
19
|
+
}
|
|
20
|
+
export interface WindowBounds {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
/** The exact title of the window that was matched. */
|
|
26
|
+
matchedTitle: string;
|
|
27
|
+
/** How many windows matched the requested title (>1 => topmost was chosen). */
|
|
28
|
+
matchCount: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Choose a window by title and reduce it to a clamped, even-sized rectangle.
|
|
32
|
+
*
|
|
33
|
+
* Matching: a case-insensitive EXACT title match wins; if none, a
|
|
34
|
+
* case-insensitive SUBSTRING match is used. With several matches the topmost
|
|
35
|
+
* (first in Z-order) is chosen. Pure: takes the enumerated query, returns the
|
|
36
|
+
* rectangle or throws a ScreencastError the caller can surface verbatim.
|
|
37
|
+
*/
|
|
38
|
+
export declare function selectWindow(query: WindowQuery, wanted: string): WindowBounds;
|
|
39
|
+
/** Enumerate live windows on Windows. Throws on non-Windows or failure. */
|
|
40
|
+
export declare function getRawWindows(): WindowQuery;
|
|
41
|
+
/** Resolve a window title to its current on-screen rectangle (Windows). */
|
|
42
|
+
export declare function resolveWindowBounds(title: string): WindowBounds;
|
|
43
|
+
//# sourceMappingURL=windows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows.d.ts","sourceRoot":"","sources":["../../src/utils/windows.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,gFAAgF;IAChF,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CA0C7E;AA2CD,2EAA2E;AAC3E,wBAAgB,aAAa,IAAI,WAAW,CAyB3C;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAE/D"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window-to-rectangle resolution for the `window:<title>` capture target.
|
|
3
|
+
*
|
|
4
|
+
* gdigrab's own `title=` input grabs the window's GDI surface, which comes back
|
|
5
|
+
* blank/black for GPU- or DirectComposition-composited windows (Chrome,
|
|
6
|
+
* Electron editors, UWP apps) - i.e. most modern software. Instead we resolve
|
|
7
|
+
* the window to the on-screen rectangle it currently occupies and capture that
|
|
8
|
+
* rectangle through the same desktop (monitor/region) path that is known to
|
|
9
|
+
* work. This captures the window "as displayed": it must be visible, on top,
|
|
10
|
+
* and not minimized.
|
|
11
|
+
*
|
|
12
|
+
* Enumeration (getRawWindows) is impure (PowerShell + user32 P/Invoke, DPI
|
|
13
|
+
* aware). The matching, clamping, and even-dimension math (selectWindow) is
|
|
14
|
+
* pure so it is unit-tested without Windows.
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { ScreencastError } from "./errors.js";
|
|
18
|
+
/**
|
|
19
|
+
* Choose a window by title and reduce it to a clamped, even-sized rectangle.
|
|
20
|
+
*
|
|
21
|
+
* Matching: a case-insensitive EXACT title match wins; if none, a
|
|
22
|
+
* case-insensitive SUBSTRING match is used. With several matches the topmost
|
|
23
|
+
* (first in Z-order) is chosen. Pure: takes the enumerated query, returns the
|
|
24
|
+
* rectangle or throws a ScreencastError the caller can surface verbatim.
|
|
25
|
+
*/
|
|
26
|
+
export function selectWindow(query, wanted) {
|
|
27
|
+
const all = Array.isArray(query.windows) ? query.windows : [];
|
|
28
|
+
const needle = wanted.trim().toLowerCase();
|
|
29
|
+
const exact = all.filter((w) => w.title.toLowerCase() === needle);
|
|
30
|
+
const matches = exact.length > 0
|
|
31
|
+
? exact
|
|
32
|
+
: all.filter((w) => w.title.toLowerCase().includes(needle));
|
|
33
|
+
if (matches.length === 0) {
|
|
34
|
+
throw new ScreencastError(`No visible window matching title "${wanted}". Open the window (it must ` +
|
|
35
|
+
`be on screen and not minimized), or use an exact/substring of its title.`);
|
|
36
|
+
}
|
|
37
|
+
const chosen = matches[0]; // EnumWindows Z-order: index 0 is the topmost.
|
|
38
|
+
if (chosen.minimized) {
|
|
39
|
+
throw new ScreencastError(`Window "${chosen.title}" is minimized. Restore it before capturing - ` +
|
|
40
|
+
`window capture grabs whatever is on screen at the window's rectangle.`);
|
|
41
|
+
}
|
|
42
|
+
const v = query.virtual;
|
|
43
|
+
const x = Math.max(chosen.left, v.x);
|
|
44
|
+
const y = Math.max(chosen.top, v.y);
|
|
45
|
+
const right = Math.min(chosen.right, v.x + v.w);
|
|
46
|
+
const bottom = Math.min(chosen.bottom, v.y + v.h);
|
|
47
|
+
let width = right - x;
|
|
48
|
+
let height = bottom - y;
|
|
49
|
+
if (width <= 0 || height <= 0) {
|
|
50
|
+
throw new ScreencastError(`Window "${chosen.title}" has no visible on-screen area to capture ` +
|
|
51
|
+
`(off-screen or fully occluded by the desktop edge).`);
|
|
52
|
+
}
|
|
53
|
+
// libx264 + yuv420p requires even dimensions; gdigrab region must match.
|
|
54
|
+
width -= width % 2;
|
|
55
|
+
height -= height % 2;
|
|
56
|
+
if (width <= 0 || height <= 0) {
|
|
57
|
+
throw new ScreencastError(`Window "${chosen.title}" is too small to capture.`);
|
|
58
|
+
}
|
|
59
|
+
return { x, y, width, height, matchedTitle: chosen.title, matchCount: matches.length };
|
|
60
|
+
}
|
|
61
|
+
// Per-monitor-DPI-aware enumeration of top-level windows + virtual screen
|
|
62
|
+
// bounds. Runs as a single PowerShell process; passed base64 (EncodedCommand)
|
|
63
|
+
// so no quoting of the C# shim is needed. Kept verbatim-small for startup cost.
|
|
64
|
+
const PS_ENUM = `
|
|
65
|
+
$ErrorActionPreference='Stop'
|
|
66
|
+
Add-Type @"
|
|
67
|
+
using System;using System.Text;using System.Collections.Generic;using System.Runtime.InteropServices;
|
|
68
|
+
public class WinShim{
|
|
69
|
+
[DllImport("user32.dll")] public static extern bool EnumWindows(EnumWindowsProc f,IntPtr l);
|
|
70
|
+
public delegate bool EnumWindowsProc(IntPtr h,IntPtr l);
|
|
71
|
+
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
|
|
72
|
+
[DllImport("user32.dll")] public static extern bool IsIconic(IntPtr h);
|
|
73
|
+
[DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr h,StringBuilder s,int n);
|
|
74
|
+
[DllImport("user32.dll")] public static extern int GetWindowTextLength(IntPtr h);
|
|
75
|
+
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h,out RECT r);
|
|
76
|
+
[DllImport("user32.dll")] public static extern int GetSystemMetrics(int i);
|
|
77
|
+
[DllImport("user32.dll")] public static extern IntPtr SetProcessDpiAwarenessContext(IntPtr v);
|
|
78
|
+
public struct RECT{public int Left,Top,Right,Bottom;}
|
|
79
|
+
static List<IntPtr> _h;
|
|
80
|
+
static bool Col(IntPtr h,IntPtr l){_h.Add(h);return true;}
|
|
81
|
+
public static IntPtr[] Z(){_h=new List<IntPtr>();EnumWindows(Col,IntPtr.Zero);return _h.ToArray();}
|
|
82
|
+
public static string T(IntPtr h){int n=GetWindowTextLength(h);if(n==0)return "";var s=new StringBuilder(n+1);GetWindowText(h,s,s.Capacity);return s.ToString();}
|
|
83
|
+
public static int[] R(IntPtr h){RECT r;GetWindowRect(h,out r);return new int[]{r.Left,r.Top,r.Right,r.Bottom};}
|
|
84
|
+
public static bool Ic(IntPtr h){return IsIconic(h);}
|
|
85
|
+
public static bool Vis(IntPtr h){return IsWindowVisible(h);}
|
|
86
|
+
public static int SM(int i){return GetSystemMetrics(i);}
|
|
87
|
+
}
|
|
88
|
+
"@
|
|
89
|
+
try{[void][WinShim]::SetProcessDpiAwarenessContext([IntPtr](-4))}catch{}
|
|
90
|
+
$ws=New-Object System.Collections.ArrayList
|
|
91
|
+
foreach($h in [WinShim]::Z()){
|
|
92
|
+
if(-not [WinShim]::Vis($h)){continue}
|
|
93
|
+
$t=[WinShim]::T($h)
|
|
94
|
+
if([string]::IsNullOrEmpty($t)){continue}
|
|
95
|
+
$r=[WinShim]::R($h)
|
|
96
|
+
[void]$ws.Add([pscustomobject]@{title=$t;left=$r[0];top=$r[1];right=$r[2];bottom=$r[3];minimized=[bool][WinShim]::Ic($h)})
|
|
97
|
+
}
|
|
98
|
+
$v=[pscustomobject]@{x=[WinShim]::SM(76);y=[WinShim]::SM(77);w=[WinShim]::SM(78);h=[WinShim]::SM(79)}
|
|
99
|
+
[pscustomobject]@{virtual=$v;windows=@($ws)}|ConvertTo-Json -Compress -Depth 4
|
|
100
|
+
`;
|
|
101
|
+
/** Enumerate live windows on Windows. Throws on non-Windows or failure. */
|
|
102
|
+
export function getRawWindows() {
|
|
103
|
+
if (process.platform !== "win32") {
|
|
104
|
+
throw new ScreencastError("Window capture is implemented for Windows (gdigrab) only.");
|
|
105
|
+
}
|
|
106
|
+
const encoded = Buffer.from(PS_ENUM, "utf16le").toString("base64");
|
|
107
|
+
const res = spawnSync("powershell", ["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded], { encoding: "utf8", windowsHide: true, maxBuffer: 8 * 1024 * 1024 });
|
|
108
|
+
if (res.status !== 0 || !res.stdout) {
|
|
109
|
+
throw new ScreencastError(`Could not enumerate windows: ${res.stderr?.trim() || "powershell failed"}`);
|
|
110
|
+
}
|
|
111
|
+
let parsed;
|
|
112
|
+
try {
|
|
113
|
+
parsed = JSON.parse(res.stdout);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
throw new ScreencastError(`Could not parse window geometry: ${err.message}`);
|
|
117
|
+
}
|
|
118
|
+
const obj = parsed;
|
|
119
|
+
const windows = Array.isArray(obj.windows) ? obj.windows : obj.windows ? [obj.windows] : [];
|
|
120
|
+
const v = obj.virtual ?? { x: 0, y: 0, w: 0, h: 0 };
|
|
121
|
+
return { virtual: v, windows };
|
|
122
|
+
}
|
|
123
|
+
/** Resolve a window title to its current on-screen rectangle (Windows). */
|
|
124
|
+
export function resolveWindowBounds(title) {
|
|
125
|
+
return selectWindow(getRawWindows(), title);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows.js","sourceRoot":"","sources":["../../src/utils/windows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG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AC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,YAAY,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tmhs/screencast-mcp",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "MCP server for Windows screen recording, frame sampling, and minimal ffmpeg edits",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"screencast-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsx watch src/index.ts",
|
|
21
|
+
"start": "node dist/index.js",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"author": "TMHSDigital",
|
|
27
|
+
"license": "CC-BY-NC-ND-4.0",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/TMHSDigital/screencast-mcp.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/TMHSDigital/screencast-mcp#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/TMHSDigital/screencast-mcp/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"mcp",
|
|
38
|
+
"model-context-protocol",
|
|
39
|
+
"screen-recording",
|
|
40
|
+
"screenshot",
|
|
41
|
+
"ffmpeg",
|
|
42
|
+
"gdigrab",
|
|
43
|
+
"windows",
|
|
44
|
+
"developer-tools"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20.0.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
51
|
+
"zod": "^3.24.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^22.15.3",
|
|
55
|
+
"tsx": "^4.19.4",
|
|
56
|
+
"typescript": "^5.8.3",
|
|
57
|
+
"vitest": "^4.1.2"
|
|
58
|
+
}
|
|
59
|
+
}
|