Skip to main content
Glama

Google Flow Editorial Poster Scraper & MCP Server

A powerful Playwright-based automation pipeline and FastMCP server for generating, editing, and converting aspect ratios of sports/editorial graphic posters using Google Flow (labs.google/fx/tools/flow).


⚔ Server Status & Compatibility Notice

IMPORTANT

🟢 Local Server (Stable & Recommended)
Running the server locali (STDIO / Local HTTP) is fully tested, stable, and works properly. Local execution provides fast response times and seamless browser session control.

🟔 Remote Server / VPS Deployment (Beta - In Development)
Remote deployment via VPS / Ngrok streamable HTTP is currently in Beta. While operational, remote operation may experience occasional session/tunnel instability depending on network connectivity and persistent browser locks. Use with caution for production workloads.


Related MCP server: playwright-fixer-mcp

šŸ“ Project Directory Structure

flow-project/
ā”œā”€ā”€ .env                       # Environment variables (PUBLIC_BASE_URL, ports, etc.)
ā”œā”€ā”€ .gitignore                 # Git ignore file
ā”œā”€ā”€ README.md                  # Project documentation & guide
ā”œā”€ā”€ VPS_DEPLOYMENT_GUIDE.md    # Detailed VPS systemd & Ngrok deployment guide
ā”œā”€ā”€ pyproject.toml             # UV / Python project dependencies configuration
ā”œā”€ā”€ requirements.txt           # Standard pip requirements
ā”œā”€ā”€ main.py                    # Direct Playwright automation execution script
ā”œā”€ā”€ chrome_profile/            # Persistent Chrome browser profile (Logged into Google)
ā”œā”€ā”€ db/                        # Local JSON database storage
│   └── projects.json          # Project session state & edit page URLs mapping
ā”œā”€ā”€ downloads/                 # Downloaded high-resolution output posters
ā”œā”€ā”€ input_images/              # Input/reference images folder (organized per session)
ā”œā”€ā”€ screenshots/               # Debug screenshots captured during automation steps
└── app/                       # Core application codebase
    ā”œā”€ā”€ __init__.py
    ā”œā”€ā”€ config.py              # Configuration, selectors, ports, and environment setup
    ā”œā”€ā”€ prompts.py             # Default Google Flow prompt templates
    ā”œā”€ā”€ automation/            # Low-level Playwright UI automation flow
    │   └── flow.py
    ā”œā”€ā”€ boss_functions/        # High-level orchestration functions (create, generate, edit, ratio)
    │   ā”œā”€ā”€ project_creator.py
    │   ā”œā”€ā”€ poster_generator.py
    │   ā”œā”€ā”€ poster_editor.py
    │   └── poster_ratio_editor.py
    ā”œā”€ā”€ mcp/                   # FastMCP Server definition & HTTP/STDIO endpoints
    │   └── server.py
    └── services/              # Helper utilities (browser, clipboard, db, downloads, pasting)
        ā”œā”€ā”€ browser_handler.py
        ā”œā”€ā”€ clipboard_handler.py
        ā”œā”€ā”€ db_handler.py
        ā”œā”€ā”€ image_download.py
        ā”œā”€ā”€ image_pasting.py
        └── prompt_submission.py

šŸ› ļø Prerequisites

  • Python: 3.10 or higher

  • Package Manager: uv (Recommended) or standard pip

  • Browser: Google Chrome installed on host machine

  • Google Account: Google account logged in on Chrome (for access to labs.google/fx/tools/flow)


šŸš€ Local Setup & Installation Guide

Follow these step-by-step instructions to set up and run the project locally.

Step 1: Clone the Repository

git clone https://github.com/rafin0906/google-flow-mcp-server.git
cd google-flow-mcp-server

Step 2: Install Dependencies & Playwright

Using uv (Recommended):

# Create virtual environment and install dependencies
uv sync

# Install Playwright Chromium browser binaries
uv run python -m playwright install chromium

Or using standard pip:

python -m venv .venv
# On Windows PowerShell:
.venv\Scripts\Activate.ps1
# On Linux/macOS:
source .venv/bin/activate

pip install -r requirements.txt
python -m playwright install chromium

Step 3: Create Required Folders

Ensure all essential directories exist in the project root:

# Windows PowerShell:
New-Item -ItemType Directory -Force -Path "input_images", "downloads", "screenshots", "db", "chrome_profile"

# Linux / macOS:
mkdir -p input_images downloads screenshots db chrome_profile

Step 4: Environment Configuration (.env)

Create a .env file in the project root directory:

PUBLIC_BASE_URL=http://localhost:8000
SERVER_HOST=0.0.0.0
SERVER_PORT=8000
MCP_PORT=8001
MCP_TRANSPORT=stdio

Step 5: Initialize Chrome Authentication Profile

To enable Google Flow automation without repeating Google logins:

  1. Launch Chrome using the persistent user data directory (chrome_profile/).

  2. Navigate to Google Flow and log into your Google Account.

  3. Once logged in, close the browser. The session cookies will be saved in chrome_profile/.


šŸ–„ļø Running Locally (3 Execution Modes)

Mode A: Direct Script Execution (main.py)

Run the standard Playwright poster generation pipeline directly without MCP:

# Place your reference images inside input_images/ (or subfolder)
uv run python main.py

Mode B: FastMCP Server (STDIO Mode for Claude Desktop / Cursor)

Start the MCP server locally over STDIO:

uv run python -m app.mcp.server

or via FastMCP CLI:

uv run fastmcp run app/mcp/server.py

Connecting to Claude Desktop (Local STDIO)

Add the following snippet to your %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "google-flow": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "C:\\MCP Servers\\flow-project",
        "python",
        "-m",
        "app.mcp.server"
      ]
    }
  }
}

Mode C: Interactive MCP Inspector

Test and debug MCP tools via a local web GUI:

uv run fastmcp dev inspector app/mcp/server.py

🌐 Remote Deployment Guide (VPS & Ngrok) [BETA]

WARNING

Remote server mode is currently inBeta. You may experience occasional session locks or browser disconnects depending on network conditions.

Step 1: Start MCP Server in HTTP Mode

On your VPS or remote machine:

uv run python -m app.mcp.server http

(Server listens on port 8001 with endpoint /mcp)

Step 2: Expose via Ngrok Tunnel

In a separate terminal window, launch Ngrok on port 8001:

npx ngrok http 8001

Ngrok will generate a secure HTTPS forwarding URL, e.g., https://xxxx-xxxx.ngrok-free.app.

Step 3: Connect Remote Client

In Claude Desktop / MCP Client:

  • Remote Server URL: https://xxxx-xxxx.ngrok-free.app/mcp

Step 4: Web Image Uploader UI (Token-Free Uploads)

For remote users, uploading large image files as Base64 strings can consume substantial LLM context tokens. To solve this, the server provides a built-in Web Uploader UI:

  • Open https://<your-ngrok-url>/upload?session_id=<your_session_id> in any browser.

  • Drag & drop your input images.

  • Images are saved directly to input_images/<session_id>/ on the server and are automatically picked up by tool_generate_poster.

For detailed 24/7 background systemd service setup on Ubuntu VPS, refer to VPS_DEPLOYMENT_GUIDE.md.


🧰 Available MCP Tools Reference

MCP Tool Name

Description

Key Parameters

tool_create_project

Creates a new Google Flow canvas project and selects aspect ratio.

ratio ('16:9', '4:3', '1:1', '3:4', '9:16'), session_id, headless

tool_get_upload_link

Generates a Web Uploader URL for token-free image uploading.

session_id

tool_input_images

Saves base64 reference images directly into server's session folder.

images_b64, session_id

tool_generate_poster

Generates a poster by pasting reference images and prompt into Google Flow canvas.

project_url, prompt, session_id, headless

tool_edit_poster

Refines/edits an existing poster image with an edit prompt.

image_edit_page_url, edit_prompt, headless

tool_poster_ratio_editor

Changes aspect ratio of an existing generated poster image.

edit_url, ratio, prompt, headless


āš™ļø Key Configuration Settings (app/config.py)

  • HEADLESS (default: False): Set to True for headless execution (required on headless VPS), or False to see browser UI steps during local execution.

  • PUBLIC_BASE_URL: Used to generate public image download links when operating in remote HTTP mode.

  • USER_DATA_DIR: Path to persistent Chrome user profile directory (chrome_profile/).


šŸ“„ License

This project is licensed under the MIT License.

Available Tools

4 tools
tool_create_projectA

Boss Function 1: Creates a new Google Flow project page, saves the project URL to DB (db/projects.json), and selects the desired aspect ratio.

Inputs: ratio, headless. Returns: object

tool_edit_posterB

Boss Function 3: Edits/refines an existing poster image using the image_edit_page_url stored in DB, submits the editing prompt, captures the updated image edit URL, and downloads the new variation.

Inputs: headless, edit_prompt, image_edit_page_url. Returns: object

tool_generate_posterA

Boss Function 2: Generates a poster in Google Flow: pastes input images and prompt onto the canvas, clicks Send, opens the generated image edit page, records the image_edit_page_url in DB, and downloads 1K output.

Inputs: prompt, headless, image_paths, project_url. Returns: object

tool_poster_ratio_editorA

Boss Function 4: Opens the latest image edit page from DB (db/projects.json), selects the target model aspect ratio, submits the ratio change prompt, captures the updated edit URL, and downloads the output image.

Inputs: ratio, prompt, edit_url, headless. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool targets a distinct step in the poster workflow: create_project sets up a project, generate_poster creates from scratch, edit_poster refines an existing image, and poster_ratio_editor specifically adjusts aspect ratio. There is minor overlap between edit_poster and ratio_editor, but descriptions clarify the difference.

    Naming Consistency4/5

    Three tools follow a verb_noun pattern (create_project, generate_poster, edit_poster), while poster_ratio_editor uses a noun_noun pattern with 'editor' at the end. The tool_ prefix is consistent, but the deviation in the last tool's pattern makes it slightly inconsistent.

    Tool Count5/5

    With only 4 tools, the server is well-scoped for a specific poster generation and editing workflow. Each tool serves a distinct purpose in the pipeline, and the count feels appropriate without being excessive or thin.

    Completeness4/5

    The tool set covers the core lifecycle of creating a project, generating a poster, editing it, and adjusting its ratio. Minor gaps exist (e.g., no delete or listing tool), but the primary workflow is fully supported and agents can complete the intended tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Automated Playwright E2E test repair powered by a self-improving, governed MCP server that runs failing tests, collects failure artifacts, reasons about root causes, validates and applies fixes, and re-runs to verify.
      12
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that assembles CapCut International projects by reading and writing local project files, adding captions, subtitles, overlays, and more so editors start with a mostly-done timeline. It includes tools for inspecting projects, restyling captions, importing subtitles, and rendering alpha-channel overlays via Remotion.
      8
      3
      MIT