Skip to main content
Glama

PyPI version Python versions License: AGPL-3.0

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)

Related MCP server: Gemini Gen MCP

Quick Start

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

Install

The quickest route in Claude Code, Codex or Cursor is the plugin, which starts the server with uvx pixelforge-mcp@latest (needs uv) and adds seven workflow skills:

# Claude Code
/plugin install pixelforge --marketplace Tehnolabs/pixelforge-mcp

# Codex
codex plugin marketplace add Tehnolabs/pixelforge-mcp && codex plugin add pixelforge@pixelforge

# Cursor: Customize -> From GitHub Repository -> https://github.com/Tehnolabs/pixelforge-mcp

See plugins/pixelforge/README.md for credentials per client and the skill list. For any other client, or a manual setup, install the server once:

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

Available Tools

19 tools
advanced_editAdvanced EditA

Edit an image with a specialized mode using a Gemini image model.

Each mode wraps the prompt in an instruction tuned for that edit. An optional mask (white = region to change) is passed to the model as guidance; the boundary is interpreted semantically, not pixel-exactly.

Inputs: prompt (required), edit_mode (required), image_path (required), model, +3 more. Returns: object

analyze_imageAnalyze ImageC

Analyze an image and get a detailed description.

Inputs: image_path (required), model, prompt, use_grounding. Returns: object

apply_templateApply TemplateC

Apply a prompt template with a subject to generate a ready-to-use prompt.

Inputs: subject (required), template_name (required). Returns: object

batch_generateBatch GenerateA

Generate multiple images in parallel from a list of prompts.

Inputs: prompts (required), model, quality, aspect_ratio, +1 more. Returns: object

compare_imagesCompare ImagesB

Compare two or more images and analyze differences.

Useful for A/B testing, design review, before/after comparison, and change detection.

Inputs: image_paths (required), model, prompt, use_grounding. Returns: object

detect_objectsDetect ObjectsA

Detect objects in an image with bounding boxes.

Uses Gemini's zero-shot object detection. Returns bounding box coordinates normalized to 0-1000 scale as [y_min, x_min, y_max, x_max].

Inputs: image_path (required), model, objects, use_grounding. Returns: object

edit_imageEdit ImageC

Edit an existing image using a text prompt.

Inputs: prompt (required), input_image_path (required), model, temperature, +2 more. Returns: object

estimate_costEstimate CostA

Estimate the cost of an image operation.

Shows pricing per model per operation to help with budgeting.

Inputs: operation (required), model, number_of_images. Returns: object

extract_textExtract TextB

Extract text from an image using OCR.

Uses Gemini's vision capabilities for high-quality text extraction. Works with screenshots, documents, signs, handwriting, etc.

Inputs: image_path (required), model, use_grounding. Returns: object

generate_imageGenerate ImageC

Generate an image from a text prompt using Google Gemini.

Inputs: prompt (required), model, quality, image_size, +9 more. Returns: object

get_generation_detailsGet Generation DetailsC

Get details of a specific generation by ID.

Inputs: generation_id (required). Returns: object

get_server_infoGet Server InfoA

Get MCP server configuration, capabilities, and available tools.

Inputs: no named parameters. Returns: object

list_available_modelsList Available ModelsA

List all available image generation models with capabilities.

Returns model details including speed, quality, resolution support, and best use cases. Use this to pick the right model for your task.

Inputs: no named parameters. Returns: object

list_historyList HistoryC

List recent generation history.

Inputs: limit, offset, tool_filter. Returns: object

list_templatesList TemplatesB

List available prompt templates for image generation.

Inputs: category. Returns: object

optimize_promptOptimize PromptA

Enhance a basic prompt for dramatically better image results.

Uses AI to add details about lighting, composition, colors, textures, and artistic techniques. The #1 way to improve generation quality.

Inputs: prompt (required), model, style. Returns: object

remove_backgroundRemove BackgroundA

Remove the background from an image.

Uses AI to isolate the main subject and remove the background. Best results with clear subjects against distinct backgrounds.

Inputs: image_path (required), output_format, output_filename. Returns: object

transform_imageTransform ImageC

Transform an image using Pillow operations.

Inputs: operation (required), image_path (required), x, y, +12 more. Returns: object

upscale_imageUpscale ImageA

Upscale an image to a higher 1K/2K/4K size tier with a Gemini image model.

The source is re-rendered at a higher size tier with an instruction to reproduce it exactly. Fine details can differ from the source; for exact pixel scaling use transform_image(operation="resize").

Inputs: image_path (required), model, output_format, upscale_factor, +1 more. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes: generate_image vs batch_generate, analyze_image vs detect_objects vs extract_text, and transform_image vs upscale_image are well differentiated. Some mild overlap remains between edit_image and advanced_edit, and between list_available_models and get_server_info, though descriptions provide enough guidance.

    Naming Consistency4/5

    All tool names use snake_case, which is consistent throughout. Most follow a verb_noun pattern, but a few are adjective/noun-first or otherwise nonstandard, such as advanced_edit and batch_generate, keeping it from being perfectly predictable.

    Tool Count4/5

    Nineteen tools is slightly above the ideal range, but the server covers a broad image platform spanning generation, editing, analysis, utilities, prompt assistance, cost estimation, and history. The count is defensible overall, though the surface is on the heavy side.

    Completeness4/5

    The server covers the core image lifecycle well: generation, batching, editing, upscaling, Pillow transforms, background removal, analysis, OCR, object detection, comparison, prompt templates, cost estimation, and history. Minor gaps exist around template/history management, such as no create/delete template or delete history operations.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers