Skip to main content

PyPI version Python versions License: AGPL-3.0

PixelForge MCP

PixelForge MCP

An MCP server for AI-powered image generation, editing, analysis, and transformation using Google's Gemini image models.

Features

  • 19 MCP tools for image generation, editing, analysis, transformation, and more
  • 4 stable Gemini image models (Nano Banana 2.1, 2 Lite, 2, and Pro) plus configurable analysis models
  • Quality presets (fast/balanced/quality) for simplified model selection
  • Parallel multi-image generation via asyncio.gather
  • Image transforms — crop, resize, rotate, flip, blur, sharpen, grayscale, watermark
  • Prompt template library — 24 curated templates across 10 categories
  • Generation history — full audit trail with search and pagination
  • Batch processing — generate up to 10 images in parallel
  • Generative upscale and mode-driven editing — upscale to the next 1K/2K/4K tier, inpaint, outpaint, background swap, style transfer, product shots
  • Two backends — Gemini API key, or Vertex AI with a service account / Application Default Credentials
  • Thinking mode & grounding — extended reasoning and Google Search for analysis
  • 14 aspect ratios (including panoramic) and temperature control
  • Async-first architecture with full Pydantic validation
  • EXIF metadata embedding (prompt, model, timestamp)

Quick Start

Requirements: Python 3.10+ and a Google API key or a Google Cloud project with Vertex AI (see Authentication)

Install

pipx install pixelforge-mcp

Configure

The examples below use a Gemini API key. To use a Google Cloud service account instead, replace GOOGLE_API_KEY with GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS as shown in Use a service account instead of an API key.

Claude Code

claude mcp add pixelforge --scope user -e GOOGLE_API_KEY="your-key" -- pixelforge-mcp

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "pixelforge": {
      "command": "pixelforge-mcp",
      "env": {
        "GOOGLE_API_KEY": "your-key"
      }
    }
  }
}

VS Code

code --add-mcp '{"name":"pixelforge","command":"pixelforge-mcp","env":{"GOOGLE_API_KEY":"your-key"}}'

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "pixelforge": {
      "command": "pixelforge-mcp",
      "env": {
        "GOOGLE_API_KEY": "your-key"
      }
    }
  }
}

Kiro

kiro-cli mcp add --name pixelforge --scope global --command pixelforge-mcp --env "GOOGLE_API_KEY=your-key"

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "pixelforge": {
      "command": "pixelforge-mcp",
      "env": {
        "GOOGLE_API_KEY": "your-key"
      }
    }
  }
}

Restart Claude Desktop after saving.

Use

Ask Claude to generate, edit, or analyze images — all 19 tools are available automatically.

Authentication

PixelForge talks to Google through one of two backends. Every tool runs on either.

Gemini API key

Set any one of these variables. Get a key at Google AI Studio.

Variable Notes
GOOGLE_API_KEY Standard
GOOGLE_GENERATIVE_AI_API_KEY Alternative
GEMINI_API_KEY Alternative

Vertex AI

Use a Google Cloud project with the Vertex AI API enabled and Application Default Credentials: a service account key file, gcloud auth application-default login, or the attached identity when running on Google Cloud. The identity needs the Vertex AI User role (roles/aiplatform.user). No extra packages are required.

Variable Notes
GOOGLE_CLOUD_PROJECT Project ID. Setting it enables the Vertex AI backend
GOOGLE_APPLICATION_CREDENTIALS Path to a service account key file. Not needed with another ADC source
GOOGLE_CLOUD_LOCATION Vertex AI location. Default global; the current Gemini image and text models are served from the global endpoint
GOOGLE_GENAI_USE_VERTEXAI true to use Vertex AI even when an API key is also set (GOOGLE_GENAI_USE_ENTERPRISE is accepted as well)

Use a service account instead of an API key

A service account runs every tool through Vertex AI, with no Gemini API key. One-time setup with the gcloud CLI, using your own project ID:

PROJECT_ID="YOUR_PROJECT_ID"
SA="pixelforge-sa@${PROJECT_ID}.iam.gserviceaccount.com"

# 1. Enable Vertex AI in the project
gcloud services enable aiplatform.googleapis.com --project="$PROJECT_ID"

# 2. Create the service account and grant it the Vertex AI User role
gcloud iam service-accounts create pixelforge-sa --project="$PROJECT_ID"
gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member="serviceAccount:$SA" --role="roles/aiplatform.user"

# 3. Create a key file outside any repository
mkdir -p ~/.config/pixelforge
gcloud iam service-accounts keys create ~/.config/pixelforge/service-account.json \
  --iam-account="$SA"

Then configure your client with the project and the key path in place of GOOGLE_API_KEY. Claude Code:

claude mcp add pixelforge --scope user \
  -e GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" \
  -e GOOGLE_APPLICATION_CREDENTIALS="$HOME/.config/pixelforge/service-account.json" \
  -- pixelforge-mcp

Cursor, Windsurf, Claude Desktop and other JSON-configured clients take the same two variables in the env block:

{
  "mcpServers": {
    "pixelforge": {
      "command": "pixelforge-mcp",
      "env": {
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID",
        "GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account.json"
      }
    }
  }
}

Verify by asking your client for get_server_info: backend.name should be vertex_ai. Commands for every client are in docs/configuration.md.

  • An API key variable set anywhere in the environment (a shell profile, for example) takes precedence, and the service account is ignored. Unset it, or add "GOOGLE_GENAI_USE_VERTEXAI": "true" to the same env block.
  • The key file grants access to your project. Keep it out of version control, give the service account only roles/aiplatform.user, and delete keys you no longer use (gcloud iam service-accounts keys list --iam-account="$SA").
  • No key file is needed when credentials come from gcloud auth application-default login (optionally with --impersonate-service-account="$SA") or from the attached identity on Google Cloud. Set only GOOGLE_CLOUD_PROJECT in that case.

Backend selection

  • An API key selects the Gemini API.
  • GOOGLE_CLOUD_PROJECT with no API key selects Vertex AI.
  • Both set: the API key wins unless GOOGLE_GENAI_USE_VERTEXAI=true.

get_server_info reports the active backend under backend.name.

Available Tools

Generation

Tool Description
generate_image Generate images from text (4 models, 14 aspect ratios, quality presets, parallel multi-image)
edit_image Modify existing images with text prompts
remove_background Remove image background (transparent or white)
transform_image Crop, resize, rotate, flip, blur, sharpen, grayscale, or watermark
batch_generate Generate up to 10 images in parallel from multiple prompts
upscale_image Generative upscale to the next 1K/2K/4K tier (re-render with a Gemini image model)
advanced_edit Inpainting, outpainting, background swap, style transfer, product shots (prompt-driven, optional mask guidance)

Analysis

Tool Description
analyze_image AI-powered image description with optional grounding and model override
extract_text OCR — extract text with confidence levels
detect_objects Detect objects with bounding boxes
compare_images Compare 2-10 images for differences

Analysis tools and optimize_prompt accept a model override. The default is gemini-3.5-flash-lite; use gemini-3.8-flash for harder OCR or reasoning.

Utility

Tool Description
optimize_prompt Enhance prompts for better image generation (14 styles)
estimate_cost Calculate generation costs per model/operation
list_templates Browse 24 curated prompt templates across 10 categories
apply_template Fill a template with your subject for a ready-to-use prompt
list_available_models Model capabilities, speed, quality, and selection guidance
get_server_info Server configuration and status

History

Tool Description
list_history Browse generation history with pagination and filtering
get_generation_details Get full details of a specific generation

Model Selection

PixelForge supports per-request model switching with 4 stable Gemini image models:

Image Models

Use case Model Why
General use (default) gemini-nano-banana-2.1 1K/2K/4K, web+image grounding, thinking levels, 1:4/4:1/1:8/8:1, up to 14 references. $0.0336/img at 1K
Fastest, cheapest gemini-3.1-flash-lite-image 1K only, no panoramic, no grounding. $0.0336/img
Previous-gen workhorse gemini-3.1-flash-image 0.5K/1K/2K/4K, panoramic, grounding. $0.067/img at 1K
Max text fidelity gemini-3-pro-image Best text rendering, complex multi-turn edits. $0.134/img at 1K/2K

gemini-2.5-flash-image is deprecated (Google has announced its shutdown) and remains only for existing setups. Use gemini-3.1-flash-lite-image instead.

0.5K is gemini-3.1-flash-image only and is sent to the API as 512px. generate_image rejects a size the chosen model cannot output.

upscale_image and advanced_edit re-render with gemini-nano-banana-2.1 unless model is set. upscale_image outputs the smallest of 1K/2K/4K that covers the source times the factor (capped at 4K) and needs a model with 2K/4K output (gemini-nano-banana-2.1, gemini-3.1-flash-image, or gemini-3-pro-image); gemini-3.1-flash-lite-image is rejected. Both tools pin the nearest aspect ratio the model supports; models without panoramic output get a standard ratio and a warning.

Analysis Models (text)

Used by analyze_image, extract_text, detect_objects, compare_images, and optimize_prompt. Override per request with model=.

Model Notes
gemini-3.5-flash-lite (default) $0.30 in / $2.50 out per 1M tokens
gemini-3.8-flash Strongest. $0.75 in / $3.75 out per 1M tokens

Quality Presets

Instead of choosing a model manually, use quality presets:

generate_image(prompt="...", quality="fast")      # gemini-3.1-flash-lite-image
generate_image(prompt="...", quality="balanced")   # gemini-nano-banana-2.1 + 1K
generate_image(prompt="...", quality="quality")    # gemini-3-pro-image + 2K

Supported Aspect Ratios

Ratio Description
1:1 Square (default)
16:9 Widescreen landscape
9:16 Mobile portrait
2:3 Classic portrait
3:2 Classic landscape
3:4 Portrait
4:3 Traditional landscape
4:5 Instagram portrait
5:4 Medium format
21:9 Ultrawide
1:4 Tall panoramic*
4:1 Wide panoramic*
1:8 Extra tall panoramic*
8:1 Extra wide panoramic*

* Panoramic ratios require gemini-nano-banana-2.1 or gemini-3.1-flash-image

Troubleshooting

"Invalid API key" or "Authentication failed"

Double-check your Google API key is correct and has access to the Gemini API. Get a key at Google AI Studio. If you meant to use a service account, an API key variable set anywhere in the environment takes precedence: unset it or set GOOGLE_GENAI_USE_VERTEXAI=true.

"Command not found: pixelforge-mcp"

Ensure the pipx bin directory is in your PATH:

export PATH="$HOME/.local/bin:$PATH"

"Server not starting"

Check that pixelforge-mcp is installed:

pipx list | grep pixelforge

"Publisher model ... was not found" (Vertex AI)

With a regional location in the message, the request went to a regional Vertex AI endpoint. The current Gemini image and text models are served from the global endpoint: set GOOGLE_CLOUD_LOCATION=global (the default) or remove a regional override. With locations/global in the message, the model ID is unknown or retired on Vertex AI (list_available_models lists current IDs), or the project cannot access it yet. The same 404 is returned for retired Imagen model IDs, which PixelForge no longer calls.

"Rate limit exceeded" or "Permission denied"

The message carries Google's own text. A quota limit: 0, or "has not been used in project ... or it is disabled", is a project setup limit rather than a model problem: enable the Vertex AI API (or the Generative Language API for an API key), grant roles/aiplatform.user, or request a quota increase.

"No credentials found"

Set an API key, or GOOGLE_CLOUD_PROJECT with Application Default Credentials. See Authentication.

Documentation

Contributing

See CONTRIBUTING.md for development setup, code standards, and pull request guidelines.

License

AGPL-3.0

Acknowledgments

Built with FastMCP, Pydantic, and google-genai.

Author

Ahmed Al-Eryani @ Tehnolabs


PixelForge MCP - Forging pixels with AI

Metadata

Release files for pixelforge-mcp 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pixelforge-mcp 0.7.0
File Size Uploaded Provenance Actions
pixelforge_mcp-0.7.0.tar.gz 61.3 kB Without provenance Details for pixelforge_mcp-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pixelforge-mcp 0.7.0
File Interpreter ABI Platform Actions
pixelforge_mcp-0.7.0-py3-none-any.whl Python 3 none any Details for pixelforge_mcp-0.7.0-py3-none-any.whl

Total release size: 119.8 kB

Release files / pixelforge_mcp-0.7.0.tar.gz

Download URL pixelforge_mcp-0.7.0.tar.gz
Size 61.3 kB
Tags Source
SHA-256 checksum
How to use checksums
672506217a13ba26abbe6503c083141c679a8f25752ffe3f9da59002a157302d
BLAKE2b-256 checksum
How to use checksums
02d91d8f6513c826e0acc46979667472d44885004e71e83ba9e2d26c74e8d3c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pixelforge_mcp-0.7.0-py3-none-any.whl

Download URL pixelforge_mcp-0.7.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c30b7d2d66dd78caf0d2cf7c288398a79f8e5e487b73db5b9be6952002e05cb0
BLAKE2b-256 checksum
How to use checksums
d8ca736330025390c13f77388087c9f440e61420ad13ae24bfd8662d37d799c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pixelforge-mcp 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page