Drive Google Flow from Claude, Codex or a local control panel, on Mac or Windows — using your Google AI subscription credits instead of the pay-per-use video API. No browser extension.
Flow: always drive Flow in English, whatever the Google account's language
GTAI-160f7854080d6
diff --git a/CLAUDE.md b/CLAUDE.mdindex 7c768fc..398aa73 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -343,3 +343,13 @@ The preview tool could not read the project while it lived in ~/Desktop; check tFLOW_MCP_PORT=8799 and FLOW_MCP_HOME=<scratch dir>. Never reuse the real home for that: a process that owns a portwrites a fresh token to HOME/token, which locks every client of the real owner out (401). Symlink characters.json intothe scratch home when looks must persist. Give the client a 60 s request timeout so the app's limit is reproduced.+- FLOW IN ENGLISH (2026-10-13): every driver step finds a button by its ENGLISH accessible name (~45 labels), so a+ Google account set to another language made the whole MCP fail. Measured on a spare tab: `?hl=es` turned every label+ Spanish ("Inicio", "Menú para añadir contenido multimedia") on an English account, the choice holds through in-app+ navigation (grid -> /edit/ -> back), a plain reload drops it, and a Spanish Accept-Language changes nothing (the+ account's language wins over the browser's). So `?hl=en` overrides the account: launchChrome and getFlowPage load+ `inEnglish(url)`, ensureProjectGrid compares paths (an address ending ?hl=en is already the grid) and reloads with+ hl=en, and getFlowPage calls ensureEnglish, which reloads a non-English Flow page (`<html lang>`) and throws a clear+ message if it stays foreign. Verified: the Flow tab put into Spanish, then a free still through a test MCP ->+ switched to English, generated and downloaded (0 credits, 39 s).+diff --git a/README.md b/README.mdindex 85c7c7e..5b1a9aa 100644--- a/README.md+++ b/README.md@@ -222,6 +222,9 @@ key → Save key**. It's checked with Google before it's saved, and stored onlyinvisible reCAPTCHA; this drives the real interface at human pace and does nothing to evade it.- Before each generation the server reads Flow's own credit quote and skips the scene if it exceeds`max_credits` (default 25).+- Any Google account language works. The server finds Flow's buttons by their English names, so its+ Chrome window always shows Flow in English (it adds `?hl=en` to the address). Your account's own+ language setting is never changed, and prompts can be written in any language.- Environment variables: `GEMINI_API_KEY`, `FLOW_MCP_PORT` (8787), `FLOW_MCP_OUTPUT`,`FLOW_MCP_HOME`, `FLOW_MCP_CDP_PORT` (9333), `FLOW_MCP_CHROME`, `FLOW_MCP_PAUSE_MIN_S`,`FLOW_MCP_PAUSE_MAX_S`.diff --git a/src/chrome.ts b/src/chrome.tsindex a724974..3dd6ca0 100644--- a/src/chrome.ts+++ b/src/chrome.ts@@ -5,6 +5,15 @@ import { join } from "node:path";import { chromium, type Browser, type Page } from "playwright-core";export const FLOW_URL = "https://flow.google.com/";+// Flow's buttons are found by their English names ("Start generation", "Download"...), so Flow has to show in English+// whatever language the Google account uses. `hl=en` on the address does that: `hl=es` turned every label Spanish on+// an English account (2026-10-13), the choice holds through Flow's in-app navigation, and the browser's own language+// changes nothing. It only lasts until the next full page load, so every load adds it and ensureEnglish re-checks.+export const inEnglish = (url: string): string => {+ const u = new URL(url);+ u.searchParams.set("hl", "en");+ return u.toString();+};const FLOW_HOSTS = /^https:\/\/(flow\.google\.com|labs\.google\/fx)/;export const HOME_DIR = process.env.FLOW_MCP_HOME ?? join(homedir(), ".flow-mcp");export const PROFILE_DIR = join(HOME_DIR, "chrome-profile");@@ -47,7 +56,7 @@ async function launchChrome(): Promise<void> {`--remote-debugging-port=${CDP_PORT}`,"--no-first-run","--no-default-browser-check",- FLOW_URL,+ inEnglish(FLOW_URL),],{ detached: true, stdio: "ignore" },);@@ -71,8 +80,30 @@ export async function getFlowPage(): Promise<Page> {const context = b.contexts()[0];if (!context) throw new Error("Chrome has no browser context; restart the Flow Chrome window.");const existing = context.pages().find((p) => FLOW_HOSTS.test(p.url()));- if (existing) return existing;+ if (existing) {+ await ensureEnglish(existing);+ return existing;+ }const page = await context.newPage();- await page.goto(FLOW_URL, { waitUntil: "domcontentloaded" });+ await page.goto(inEnglish(FLOW_URL), { waitUntil: "domcontentloaded" });+ await ensureEnglish(page);return page;}++// Reloads Flow in English when it is showing in another language (a page the user opened by hand, or Flow redirecting+// to an address without hl). Sign-in pages are left alone.+export async function ensureEnglish(page: Page): Promise<void> {+ if (!/^https:\/\/flow\.google\.com\//.test(page.url())) return;+ const lang = () => page.evaluate(() => document.documentElement.lang).catch(() => "");+ const now = await lang();+ if (!now || /^en\b/i.test(now)) return;+ await page.goto(inEnglish(page.url()), { waitUntil: "domcontentloaded" });+ await page.waitForFunction(() => document.documentElement.lang, null, { timeout: 15_000 }).catch(() => {});+ const after = await lang();+ if (after && !/^en\b/i.test(after)) {+ throw new Error(+ `Flow is showing in "${after}" and would not switch to English. flow-mcp finds Flow's buttons by their English names. ` ++ `Add ?hl=en to the end of Flow's address in the Flow Chrome window, or set your Google account's language to English (myaccount.google.com/language).`,+ );+ }+}diff --git a/src/flow.ts b/src/flow.tsindex 8b36c58..8233ab4 100644--- a/src/flow.ts+++ b/src/flow.ts@@ -2,7 +2,7 @@ import { closeSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, openSync,import { homedir, tmpdir } from "node:os";import { basename, extname, join } from "node:path";import type { Locator, Page } from "playwright-core";-import { HOME_DIR, getFlowPage } from "./chrome.js";+import { HOME_DIR, getFlowPage, inEnglish } from "./chrome.js";import type { Job } from "./queue.js";import { extractZip } from "./platform.js";@@ -608,8 +608,9 @@ async function downloadTile(page: Page, target: Locator | TileResolver, targetStasync function ensureProjectGrid(page: Page): Promise<void> {await dismissOverlays(page);const root = page.url().match(/^https:\/\/[^/]+\/project\/[0-9a-f-]{36}/)?.[0];- if (root && page.url() !== root) {- await page.goto(root, { waitUntil: "domcontentloaded" });+ // Compared by path: an address ending in ?hl=en is already the grid.+ if (root && new URL(page.url()).pathname !== new URL(root).pathname) {+ await page.goto(inEnglish(root), { waitUntil: "domcontentloaded" });await pause(page, 2500);}await page.getByRole("navigation", { name: "Project navigation" }).getByText("All media", { exact: true }).click().catch(() => {});@@ -1039,7 +1040,7 @@ export async function createCharacter(c: CharacterParams, job?: Job): Promise<{// Flow labels this "Done editing" or just "Done" depending on the panel state.await page.getByRole("button", { name: /^Done( editing)?$/ }).first().click();- await page.waitForURL((u) => !/\/character/.test(u.pathname), { timeout: 15_000 }).catch(() => page.goto(projectUrl));+ await page.waitForURL((u) => !/\/character/.test(u.pathname), { timeout: 15_000 }).catch(() => page.goto(inEnglish(projectUrl)));await pause(page, 1000);// Flow drops the new character into the composer; leave the composer empty for the next job.const clear = page.getByRole("button", { name: "Clear prompt" });