google-flow-api-mcp 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +89 -2
- package/auth_lab/mint_token.py +596 -0
- package/bin/google-flow-api +78 -0
- package/cookies.py +246 -0
- package/flow_api/__init__.py +43 -0
- package/flow_api/__main__.py +3 -0
- package/flow_api/cli.py +203 -0
- package/flow_api/client.py +881 -0
- package/flow_api/selftest.py +195 -0
- package/package.json +44 -3
- package/postinstall.js +98 -0
- package/scripts/clean-pycache.js +22 -0
- package/server.py +204 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wael Bousfira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# google-flow-api-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for **Google Flow** (`flow.google.com`): generate images with **Nano Banana Pro**
|
|
4
|
+
(`GEM_PIX_2`) and videos with **Omni 1.2 Flash** (`macaron_cookie_t2v_8s`) through the real
|
|
5
|
+
Flow `batchexecute` RPCs — no browser automation on the generation path, no UI clicking.
|
|
6
|
+
|
|
7
|
+
It also ships a **re-login tool** that pulls a fresh `.google.com` cookie jar straight out of the
|
|
8
|
+
machine's default browser (macOS LaunchServices: Chrome, Edge, Brave, Arc, Safari, Firefox, Opera,
|
|
9
|
+
Vivaldi, Chromium), validates it against Flow, and caches the RPC tokens.
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
- `flow_relogin` — read the browser's Google cookies, write `~/.config/google-flow-api/cookies.json`,
|
|
14
|
+
open the Flow project page, scrape `at/bl/fsid`, return the signed-in email.
|
|
15
|
+
- `flow_health` — config paths, cookie freshness, live session check.
|
|
16
|
+
- `flow_generate_image` — prompt → 1024×1024 JPEG (≈0.5–1.1 MB) in `~/Downloads/google-flow-api/`.
|
|
17
|
+
- `flow_generate_video` — prompt → 8 s, 1280×720 H.264 + AAC MP4, polls until the render finishes.
|
|
18
|
+
- `flow_video_status` — status/URL of an existing video job.
|
|
19
|
+
- `flow_download` — fetch an existing media id (image or video) without spending a generation.
|
|
20
|
+
|
|
21
|
+
Generation needs a single-use reCAPTCHA Enterprise token. The server mints it on demand in a
|
|
22
|
+
headless Chromium (Playwright, ~0.2 s) using the cookie jar — that is why login is a one-click step.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx google-flow-api-mcp
|
|
28
|
+
# or
|
|
29
|
+
npm install -g google-flow-api-mcp
|
|
30
|
+
google-flow-api
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requirements: Node 18+, Python 3.10+, and a Google account already logged into
|
|
34
|
+
<https://flow.google.com> in a local browser. Python deps (`mcp`, `requests`, `browser_cookie3`,
|
|
35
|
+
`playwright`) are installed by the postinstall script. Without Playwright's bundled Chromium the
|
|
36
|
+
token minter falls back to the system Google Chrome.
|
|
37
|
+
|
|
38
|
+
## MCP client config
|
|
39
|
+
|
|
40
|
+
### Cursor / Windsurf / VS Code / Claude Code
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"google-flow-api": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["-y", "google-flow-api-mcp"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Claude Code CLI
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
claude mcp add google-flow-api --scope user -- npx -y google-flow-api-mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## First run
|
|
60
|
+
|
|
61
|
+
1. Log into <https://flow.google.com> in your browser.
|
|
62
|
+
2. Call `flow_relogin` once (or run `google-flow-api` and call it through your client).
|
|
63
|
+
3. Call `flow_generate_image` with a prompt.
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
flow_relogin()
|
|
67
|
+
flow_generate_image(prompt="a blue ceramic mug on a wooden desk, soft morning light")
|
|
68
|
+
flow_download(media_id="4a7ecd4b-f310-4cd8-89b7-831d39119d32", kind="video")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Config
|
|
72
|
+
|
|
73
|
+
- `~/.config/google-flow-api/cookies.json` — cookie jar (mode 0600)
|
|
74
|
+
- `~/.config/google-flow-api/wiz.json` — `at` / `bl` / `f.sid`
|
|
75
|
+
- `~/.config/google-flow-api/tokens/` — minted reCAPTCHA tokens
|
|
76
|
+
- `GOOGLE_FLOW_API_HOME` — override the config dir
|
|
77
|
+
- `GOOGLE_FLOW_API_OUT` — override the output dir (default `~/Downloads/google-flow-api`)
|
|
78
|
+
- `FLOW_PROJECT_ID` — Flow project id (defaults to a working public project)
|
|
79
|
+
|
|
80
|
+
## Notes and limits
|
|
81
|
+
|
|
82
|
+
- A **new** video generation consumes the account's Flow video quota; when it is exhausted the RPC
|
|
83
|
+
returns `PUBLIC_ERROR_USER_QUOTA_REACHED`. `flow_download` and `flow_video_status` never spend quota.
|
|
84
|
+
- reCAPTCHA tokens are single-use and action-scoped (`IMAGE_GENERATION` / `VIDEO_GENERATION`);
|
|
85
|
+
bursts of mints can trip a score flag (`PUBLIC_ERROR_UNUSUAL_ACTIVITY`). The client re-mints with
|
|
86
|
+
5 s → 15 s → 30 s backoff.
|
|
87
|
+
- Cookie extraction is read-only: the browser profile is never modified. macOS may ask for Keychain
|
|
88
|
+
access the first time Chrome cookies are decrypted.
|
|
89
|
+
|
|
90
|
+
MIT licensed. Not affiliated with Google.
|