Skip to main content
Glama
Image Edit MCP Server
by ShunL12324

Image Edit MCP Server

AI-powered image editing and generation server using the Model Context Protocol (MCP). Provides tools for intelligent image manipulation, cleanup, and generation using Google's Gemini AI models.

Features

  • Image Understanding: Ask questions about images using Gemini 2.5 Pro vision

  • Image Generation: Create photorealistic images from text using Imagen 4.0

  • Product Image Cleanup: Remove watermarks while preserving backgrounds

  • White Background Mode: E-commerce ready product images

  • Smart Crop: Center crop to 1:1 square format

  • Intelligent Expand: Fill borders with AI-matched backgrounds

  • AI Quality Reviews: Automatic quality assessment for generated/edited images

Related MCP server: Nano-Banana MCP Server

Tools

1. understand_image

Ask questions about image content using Gemini 2.5 Pro vision.

Parameters:

  • image_source (required): Local file path or URL

  • question (optional): Your question about the image

Example:

{
  "image_source": "/path/to/image.jpg",
  "question": "What is the main product in this image?"
}

2. generate_image

Generate photorealistic product images from text descriptions using Imagen AI.

Parameters:

  • description (required): Detailed image description (max 480 tokens)

  • aspect_ratio (optional): 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 (default: 1:1)

Example:

{
  "description": "Red ceramic coffee mug, white background, studio lighting, macro lens, sharp focus, professional product photography, 4K",
  "aspect_ratio": "1:1"
}

3. clean_product_image

Remove watermarks and overlays while preserving original background.

Parameters:

  • input_path (required): Local file path or URL

  • aspect_ratio (optional): Output aspect ratio (default: 1:1)

  • additional_instructions (optional): Extra instructions for AI

4. clean_product_image_white_bg

Remove watermarks and replace background with pure white + studio lighting.

Parameters:

  • input_path (required): Local file path or URL

  • aspect_ratio (optional): Output aspect ratio (default: 1:1)

  • additional_instructions (optional): Extra instructions for AI

5. crop_image_to_square

Fast center crop to 1:1 square (1024x1024). No AI processing.

Parameters:

  • input_path (required): Local file path or URL

6. expand_image_to_square

Intelligently fill borders to create 1:1 square while preserving original content.

Parameters:

  • input_path (required): Local file path or URL

Installation

Prerequisites

  • Node.js 18+

  • pnpm (recommended) or npm

  • Google Gemini API key

Setup

  1. Clone or download this repository:

cd ~/projects
git clone <repository-url> image-edit-mcp
cd image-edit-mcp
  1. Install dependencies:

pnpm install
  1. Create .env file:

cp .env.example .env
  1. Add your Gemini API key to .env:

GEMINI_API_KEY=your_api_key_here

# Optional: Use custom Gemini endpoint (e.g., proxy)
# GEMINI_BASE_URL=https://api2.aigcbest.top

Get your API key from: https://aistudio.google.com/app/apikey

Note: The generate_image tool always uses the official Google API as imagen models are not supported by proxy endpoints. Other tools will use GEMINI_BASE_URL if configured.

  1. Build the project:

pnpm build

Configuration

Claude Desktop

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "image-edit": {
      "command": "node",
      "args": ["/Users/shun/projects/image-edit-mcp/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "your_gemini_api_key_here"
      }
    }
  }
}

With custom Gemini endpoint (optional):

{
  "mcpServers": {
    "image-edit": {
      "command": "node",
      "args": ["/Users/shun/projects/image-edit-mcp/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "your_gemini_api_key_here",
        "GEMINI_BASE_URL": "https://api2.aigcbest.top"
      }
    }
  }
}

Note: generate_image always uses official Google API (imagen models not supported by proxies).

Other MCP Clients

The server communicates via stdio and can be used with any MCP-compatible client. Configure according to your client's documentation.

Output

All processed images are saved to your system's temporary directory with unique filenames:

  • macOS/Linux: /tmp/image-edit-mcp/

  • Windows: C:\Users\{user}\AppData\Local\Temp\image-edit-mcp\

Output format: High-quality WebP (lossless, quality 100)

API Keys

Gemini API Key

Note on Imagen

The generate_image tool uses a hardcoded official Google API key for compatibility. For production use, you should obtain your own Imagen API access.

Development

Build

pnpm build

Watch mode

pnpm dev

Project Structure

image-edit-mcp/
├── src/
│   ├── index.ts          # MCP server entry point
│   ├── config.ts         # Environment configuration
│   ├── types.ts          # TypeScript type definitions
│   └── tools/
│       └── images.ts     # Image editing tools
├── prompts/              # AI prompts for image operations
├── dist/                 # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md

Troubleshooting

"GEMINI_API_KEY is required" error

Make sure your .env file contains a valid Gemini API key, or configure it in your MCP client settings.

Build errors

Try clearing the build cache and reinstalling:

rm -rf node_modules dist
pnpm install
pnpm build

Image generation fails

  • Check your API key is valid

  • Verify you haven't exceeded rate limits

  • Ensure your prompt is under 480 tokens

License

MIT

Credits

Built with:

Available Tools

13 tools
clean_product_imageA

Remove watermarks, logos, and overlays while preserving original background and lighting. Keeps product features intact, maintains natural photography style. Supports aspect ratio adjustment (default 1:1). Outputs high-res WebP with AI review.

Inputs: input_path (required), aspect_ratio, additional_instructions.

clean_product_image_white_bgA

Remove watermarks/overlays and replace background with pure white (#FFFFFF) + professional studio lighting. E-commerce ready for Amazon/eBay/Shopify. Preserves product shape, colors, features. Supports aspect ratio adjustment (default 1:1). Outputs high-res WebP with AI review.

Inputs: input_path (required), aspect_ratio, additional_instructions.

crop_image_to_squareA

Crop image to 1:1 square using center crop. Uses the shorter edge as crop size, then scales to 1024x1024. Fast, lossless operation without AI. Outputs high-res WebP.

Inputs: input_path (required).

edit_imageA

Edit images based on text instructions using AI with support for multiple reference images. Modify colors, add/remove objects, change backgrounds, adjust lighting, apply artistic effects, or combine multiple images. Uses reference image(s) + text prompt for intelligent editing. Supports various aspect ratios. Outputs high-res WebP with AI quality review.

Inputs: prompt (required), input_paths, aspect_ratio.

expand_image_to_squareA

Convert any aspect ratio to 1:1 square by intelligently filling border areas while preserving original content pixel-perfect. AI matches background style (solid/gradient/textured/environmental), continues lighting and perspective with seamless blending. Outputs 1024x1024 WebP with AI review.

Inputs: input_path (required).

generate_bracelet_model_wearingA

Generate realistic wrist close-up photo showing bracelet worn on model's wrist. Creates authentic luxury brand lifestyle photography helping customers visualize wearing the bracelet. Maintains accurate bead count and structure from references.

Inputs: reference_image_urls (required), aspect_ratio.

generate_bracelet_tabletop_elegantB

Generate elegant minimalist lifestyle photo of a bracelet on pure white tabletop. Creates clean, sophisticated product photography perfect for modern luxury e-commerce. Maintains accurate bead count and structure from references.

Inputs: reference_image_urls (required), aspect_ratio.

generate_bracelet_white_backgroundA

Generate premium white background product photo of a bracelet from reference images. Creates professional studio photography with pure white background, top-down circular layout. Maintains accurate bead count and structure from references.

Inputs: reference_image_urls (required), aspect_ratio.

generate_imageA

Generate photorealistic product images from text descriptions using Imagen AI. Supports 5 aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4), outputs high-res WebP with AI quality review.

Prompt structure: [Subject] + [Background] + [Style/modifiers] Example: 'Red ceramic mug, white background, studio lighting, macro lens, sharp focus, 4K'

Modifiers: camera angles (aerial/45-degree/eye level), lighting (natural/studio/dramatic), focus (sharp/soft/depth of field), lenses (macro/wide-angle), quality enhancers (4K/photorealistic/professional).

Inputs: description (required), aspect_ratio.

generate_necklace_model_wearingA

Generate realistic neck close-up photo showing necklace worn on model. Frame from jawline/chin down to upper chest, focusing on elegant neck area and jewelry. Creates authentic luxury brand campaign photography.

Inputs: reference_image_urls (required), aspect_ratio.

generate_necklace_tabletop_elegantA

Generate elegant minimalist lifestyle photo of a necklace on pure white tabletop. Creates clean, sophisticated product photography perfect for modern luxury e-commerce. Maintains exact product design with accurate chain structure from references.

Inputs: reference_image_urls (required), aspect_ratio.

generate_necklace_white_backgroundA

Generate premium white background product photo of a necklace from reference images. Creates professional studio photography with pure white background, suitable for e-commerce. Maintains exact product design from references while removing watermarks/logos.

Inputs: reference_image_urls (required), aspect_ratio.

understand_imageA

Ask questions about image content using Gemini 2.5 Pro vision. Extract text, identify objects, describe products, check quality, or get detailed descriptions. Accepts local file paths or URLs.

Inputs: image_source (required), question.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 13 tools

    Disambiguation4/5

    Each tool has a clear action and subject, but a few close pairs (clean_product_image vs clean_product_image_white_bg and the white-background/tabletop necklace generators) could be confused if descriptions are skimmed. With careful reading, the targets are distinct enough for an agent to choose correctly.

    Naming Consistency4/5

    Tool names generally follow a consistent verb_noun snake_case pattern and are readable. The minor abbreviation mismatch (white_bg vs white_background) and the mixed specificity of generation tool names prevent a perfect score.

    Tool Count4/5

    13 tools is within a reasonable range and the core editing/analysis tools are well-scoped. The six specialized jewelry-generation tools make the set feel slightly broader than the generic 'image edit' server name suggests, but they do serve distinct output needs.

    Completeness4/5

    Core image workflows are covered: analyze, generate, edit, clean, crop, and expand. Minor gaps remain (e.g., arbitrary aspect-ratio changes and transparent-background output are not exposed as dedicated tools), though edit_image can approximate them.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers