Skip to main content

Google Flow image generation as an MCP tool for Claude Code

Project description

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) :99 display

Installation

Prerequisites

  • Python 3.11+ with uv or pip
  • Google Chrome (for authentication)
  • Playwright browsers (for generation)

Install from GitHub

# Clone the repo
git clone https://github.com/alarconcesar/flow-mcp.git
cd flow-mcp

# Create venv and install
uv venv
uv pip install -e .

# Or with pip:
# python -m venv .venv
# .venv\Scripts\activate   (Windows)
# source .venv/bin/activate (Linux/macOS)
# pip install -e .

# Install Playwright browsers
playwright install chromium

# Authenticate with Google Flow
flow-mcp auth login

Or install directly from GitHub (no clone needed)

pip install git+https://github.com/alarconcesar/flow-mcp.git
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

Xvfb :99 -screen 0 1280x720x24 &   # or let flow-mcp auto-start it
flow-mcp auth login --browser internal

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.1.0.tar.gz (18.8 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.1.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flow_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 4319a77523bb6b5e35736cd35cd1bdbc1e17fe24698fc5c276829736d8a05d5b
MD5 de211f7b7ebef5c26cfaf26d06614f81
BLAKE2b-256 4ff25a82ed3da99bfa689139c18f5d7ae85d1a76e17edb610585dfc3348f5f70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e6f076957f6f5ec85c007ad038d68fb2234f1944fd83b40d35b64221a7943d9
MD5 3903492a317697e25f325ddeb1b16d8d
BLAKE2b-256 412bb713818f2df5a72c4da64ebd635cfacb9135e755f50dba5bedcae8bb2220

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