Skip to main content

Google Flow image generation as an MCP tool for Claude Code

Project description

Google Flow MCP ๐ŸŽจ

Python 3.11+ MCP License: MIT

MCP server for generating images via Google Flow โ€” no daily quota limits.

Claude Code (or any MCP client) can generate images using Google Flow's batchGenerateImages API directly through a Playwright browser context with your saved authentication, bypassing the Flow Agent chat quota (~10 images/day).

Features

  • Text-to-Image โ€” generate images from text prompts
  • Image-to-Image โ€” use a reference image (pass reference_image)
  • No quota limits โ€” calls the API directly, not through the chat
  • Persistent browser pool โ€” reuses Chrome across generations (faster)
  • Auto-retry โ€” refreshes auth token if it expires
  • Progress reporting โ€” shows generation progress in Claude Code
  • No external CLI dependencies โ€” includes its own auth/login
  • Cross-platform โ€” Windows, macOS, Linux (incl. headless)

Requirements

Dependency Notes
Python 3.11+ (or uv)
Google Chrome or Playwright's Chromium For authentication & generation
Xvfb (Linux headless only) For auth login only (MCP server runs headless)

Installation

Prerequisites

  • Python 3.11+
  • Google Chrome (for authentication)
  • Playwright browsers (for generation)

Install from PyPI (recommended)

pip install flow-mcp

# Or with uv:
# uv pip install flow-mcp

# Install Playwright browsers
playwright install chromium

# Authenticate with Google Flow
flow-mcp auth login

Or install from GitHub

git clone https://github.com/alarconcesar/flow-mcp.git
cd flow-mcp
uv pip install -e .
playwright install chromium
flow-mcp auth login

Usage with Claude Code

Add to your .claude/settings.json:

{
  "mcpServers": {
    "flow-image-server": {
      "command": "uv",
      "args": ["run", "flow-mcp"]
    }
  }
}

Restart Claude Code. The generate_image tool will be available.

Parameters

Parameter Type Default Description
prompt string required Text description of the image
model enum nano-pro nano2, nano-pro, narwhal, gem_pix_2
count integer 1 Number of images (1โ€“4)
aspect enum 9:16 9:16, 16:9, 1:1, 4:3, 3:4
reference_image string optional Path to a local image for I2I

Examples

Text-to-Image:

Generate an image of a cyberpunk city at night, neon lights, 16:9

Image-to-Image:

Take this photo and make it cyberpunk style,
reference_image: /Users/me/photo.jpg

CLI commands

flow-mcp                    # Start MCP server (stdio mode)
flow-mcp auth login         # Authenticate with Google Flow
flow-mcp auth list          # List saved profiles
flow-mcp help               # Show help

Environment variables

Variable Default Description
GFLOW_PROFILE auto-detected Profile name
GFLOW_CLI_HOME platform default gflow-cli data directory
GFLOW_OUTPUT_DIR temp directory Where to save generated images

Troubleshooting

Auth expired

flow-mcp auth login

Content filter

Google Flow silently blocks certain prompts (returns None). Try rephrasing โ€” avoid violence, NSFW, or trademarked content.

Linux headless

# Only needed for authentication (the MCP server itself runs headless)
Xvfb :99 -screen 0 1280x720x24 &
DISPLAY=:99 flow-mcp auth login --browser internal

The MCP server (flow-mcp) now runs completely headless โ€” no Xvfb needed for generation.

Profile not found

flow-mcp auth list         # list profiles
flow-mcp auth login        # create a new profile

Project structure

flow-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ flow_mcp/
โ”‚       โ”œโ”€โ”€ __init__.py      # Package metadata & logging config
โ”‚       โ”œโ”€โ”€ __main__.py      # CLI entry point (auth, server)
โ”‚       โ”œโ”€โ”€ server.py        # FastMCP tool definition
โ”‚       โ”œโ”€โ”€ generator.py     # Core generation logic
โ”‚       โ”œโ”€โ”€ browser.py       # Playwright context & token capture
โ”‚       โ”œโ”€โ”€ browser_pool.py  # Persistent browser context pool
โ”‚       โ”œโ”€โ”€ auth.py          # Login, profile list commands
โ”‚       โ”œโ”€โ”€ profile.py       # Profile resolution
โ”‚       โ”œโ”€โ”€ recaptcha.py     # reCAPTCHA token minting
โ”‚       โ”œโ”€โ”€ chrome_helpers.py # Chrome detection
โ”‚       โ””โ”€โ”€ constants.py     # Shared constants
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ LICENSE (MIT)
โ””โ”€โ”€ README.md

License

MIT โ€” see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow_mcp-0.3.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flow_mcp-0.3.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file flow_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: flow_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for flow_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e46368110c3a622ccead4095b8d7668aaa3b578e8d60233d37fd2f7e89e2688c
MD5 40457d522949a8d131055558d39a1d48
BLAKE2b-256 c8db5a13554115d77fdfd58bda3da0425835a938cc1a2f6c9e5d4714f8d0d7a6

See more details on using hashes here.

File details

Details for the file flow_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: flow_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for flow_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d57287aba12dfd063c5e819b03557ffe7433364f78d340c825650b7939099431
MD5 aa3c81767b6a542c5b6cbb3cc7dbe423
BLAKE2b-256 f3aada8a0322aa9f4b79ab5a9cdb5ef50c93931ba86e1aeb329603c5c2f2ab32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page