Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(mcp): record the window an in-app take names, even where Apple's picker owns sources

Etienne Lescot6bfbcb3b5fc5
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts
index 70d94c36c..cf9f4c196 100644
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@ -83,6 +83,7 @@ import {
import { createAppRecorder, pickTakePrefs, takePrefs } from "../mcp/app-recorder";
import { EditorDocumentHost } from "../mcp/editor-document-host";
import { openVideoInHiddenWindow } from "../mcp/hidden-video";
+import { NAMED_TAKE_NEEDS_SCREEN_ACCESS, namedTakeMayEnumerate } from "../mcp/macNamedTake";
import { McpController } from "../mcp/mcp-controller";
import { McpSettingsStore } from "../mcp/mcp-settings-store";
import { createMediaTools, type MediaToolDeps, type RecordRequest } from "../mcp/media-tools";
@@ -116,6 +117,7 @@ import {
macSystemPickerEnabled,
markMacSystemPickerUnavailable,
} from "../native-bridge/screen/macPickerSession";
+import { readMacScreenCaptureAccess } from "../native-bridge/screen/macScreenAccess";
import { CompositorViewService } from "../native-bridge/services/compositorViewService";
import { getMacPermissions, showPermissionsWindow } from "../permissions";
import { scoreDeviceNameMatch } from "../recording/deviceNameMatching";
@@ -5104,12 +5106,15 @@ export function registerIpcHandlers(
};
if (process.platform === "linux" && findPipeWireCursorHelperPath()) {
// The portal asks the user once the take starts: nothing here to select.
- } else if (macPickerOwnsSources()) {
- // Apple's picker asks for this take: an earlier pick must not stand in for it.
- selectedSource = null;
- selectedDesktopSource = null;
- broadcastSelectedSource(null);
} else {
+ // Where Apple's picker owns the bar's sources, a named take still records what it
+ // names: the picker would wait for a person (#1232, see macNamedTake.ts).
+ if (macPickerOwnsSources()) {
+ const access = await readMacScreenCaptureAccess();
+ if (!namedTakeMayEnumerate(access.status)) {
+ throw new Error(NAMED_TAKE_NEEDS_SCREEN_ACCESS);
+ }
+ }
try {
// The list listSources shows, in its order: its display indexes are this list's.
const sources = await getSourcesForPickers({
diff --git a/electron/mcp/macNamedTake.test.ts b/electron/mcp/macNamedTake.test.ts
new file mode 100644
index 000000000..3ac50e980
--- /dev/null
+++ b/electron/mcp/macNamedTake.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import { NAMED_TAKE_NEEDS_SCREEN_ACCESS, namedTakeMayEnumerate } from "./macNamedTake";
+
+describe("namedTakeMayEnumerate", () => {
+ it("records the named source when Screen Recording is granted", () => {
+ expect(namedTakeMayEnumerate("granted")).toBe(true);
+ });
+
+ it("refuses only on a refusal the probe read", () => {
+ expect(namedTakeMayEnumerate("denied")).toBe(false);
+ });
+
+ it("does not take a probe that could not answer for a refusal", () => {
+ for (const status of ["missing-helper", "error", "exited", "timeout"] as const) {
+ expect(namedTakeMayEnumerate(status)).toBe(true);
+ }
+ });
+
+ it("tells the client where the user grants the permission", () => {
+ expect(NAMED_TAKE_NEEDS_SCREEN_ACCESS).toContain("Screen & System Audio Recording");
+ });
+});
diff --git a/electron/mcp/macNamedTake.ts b/electron/mcp/macNamedTake.ts
new file mode 100644
index 000000000..9d23b84c2
--- /dev/null
+++ b/electron/mcp/macNamedTake.ts
@@ -0,0 +1,22 @@
+// How the in-app MCP server records the window or display a client names, on a Mac where
+// the recording bar picks its sources in Apple's picker (macOS 15.2+).
+//
+// The picker waits for a person to choose. An MCP client is not one: handing its take to the
+// picker left the call waiting 120 s and the picker on screen afterwards (#1232). So a named
+// take records its source directly, the way the stdio server and the legacy picker do. That
+// needs the Screen Recording grant the picker otherwise makes unnecessary, so a Mac that
+// refused it gets an answer saying so instead of a picker.
+
+import type { MacScreenAccessStatus } from "../native-bridge/screen/macScreenAccess";
+
+export const NAMED_TAKE_NEEDS_SCREEN_ACCESS =
+ "OpenScreen needs the Screen Recording permission to record a window or display it is told to, without asking which one. Ask the user to turn OpenScreen on under System Settings > Privacy & Security > Screen & System Audio Recording, then try again.";
+
+/**
+ * Whether a named take may enumerate its source. Only a refusal the probe actually read
+ * stops it: a probe that could not answer (no helper, a crash, a timeout) is not a "no",
+ * and the enumeration that follows says for itself whether it can see the source.
+ */
+export function namedTakeMayEnumerate(screenAccess: MacScreenAccessStatus): boolean {
+ return screenAccess !== "denied";
+}
diff --git a/electron/mcp/media-tools.ts b/electron/mcp/media-tools.ts
index 1cb156a57..eb45333aa 100644
--- a/electron/mcp/media-tools.ts
+++ b/electron/mcp/media-tools.ts
@@ -225,7 +225,7 @@ export interface MediaTools {
}
const START_RECORDING_NOTES: Record<McpTransport, string> = {
- http: "It goes through OpenScreen's recording bar, as the editor's Record button does: the editor closes for the take, so this is refused while the editor has unsaved changes, and the bar's countdown applies. Where OpenScreen leaves the choice to the system's picker (Linux, macOS 15.2 or later), that picker asks the user what to record, whatever window or display says. The bar records with these settings, and gets the user's own back once the take ends.",
+ http: "It goes through OpenScreen's recording bar, as the editor's Record button does: the editor closes for the take, so this is refused while the editor has unsaved changes, and the bar's countdown applies. On Linux the system's portal asks the user what to record, whatever window or display says. On macOS the take records the window or display named here, even where the bar otherwise asks in Apple's picker (macOS 15.2 or later); that needs OpenScreen's Screen Recording permission, and without it the call is refused. The bar records with these settings, and gets the user's own back once the take ends.",
stdio: "On Linux the desktop's own picker asks the user which window to record.",
};