Skip to main content
Glama

GenImgMCP ๐ŸŽจ

Local MCP (Model Context Protocol) server for image generation and editing using the google/gemini-3.1-flash-image model via OpenRouter.

Designed specifically for coding agents (such as Antigravity, Claude Code, Cursor, and other MCP clients), saving images directly to the project's local file system and returning the file path and structured metadata in a lightweight manner (without cluttering the context window with Base64 strings).


โœจ Features

  • ๐Ÿ–ผ๏ธ Image Generation (generate_image): Create images from detailed text prompts.

  • ๐Ÿ–Œ๏ธ Image Editing and Variations (edit_image): Transform, refine, or add elements to existing images on disk.

  • ๐Ÿ’พ Automatic Local Saving: Saves image files directly to the project directory requested by the agent (or in ./generated_images/).

  • โšก Lightweight & Efficient Response: Returns only the absolute file path and metadata (size, format, aspect ratio), preserving the caller LLM's context tokens.

  • ๐Ÿ“ Aspect Ratio & Format Control: Supports multiple aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9) and file formats (png, webp, jpeg).

  • ๐Ÿ”„ Model Flexibility: Defaults to google/gemini-3.1-flash-image, with support for any multimodal model available on OpenRouter.


Related MCP server: openrouter-imgen-mcp

๐Ÿš€ Installation and Build

1. Prerequisites

2. Install Dependencies and Build

# In the project root:
npm install
npm run build

โš™๏ธ Configuration

You can configure the API key in one of three ways:

  1. Environment Variable: Set OPENROUTER_API_KEY in your environment.

  2. .env File: Create a .env file in the root of the project:

    OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    DEFAULT_IMAGE_MODEL=google/gemini-3.1-flash-image
    DEFAULT_OUTPUT_DIR=./generated_images
  3. Command Line Argument: Pass --api-key <your_key> in arguments when starting the server.


๐Ÿ› ๏ธ Available Tools

1. generate_image

Generates a new image based on a text prompt.

Parameter

Type

Required

Description

prompt

string

Yes

Detailed description of the image to generate.

output_path

string

No

File path where the image will be saved (e.g., ./assets/banner.png).

aspect_ratio

string

No

Aspect ratio of the image (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9). Default: 1:1.

output_format

string

No

File format (png, webp, jpeg). Default: png.

model

string

No

Model on OpenRouter (Default: google/gemini-3.1-flash-image).

2. edit_image

Modifies an existing image provided by local file path.

Parameter

Type

Required

Description

image_path

string

Yes

Source image path (e.g., ./assets/logo.png) or Data URL.

prompt

string

Yes

Modification instructions or elements to add.

output_path

string

No

Destination path for the edited image.

aspect_ratio

string

No

Desired aspect ratio for the resulting image.

output_format

string

No

Output file format (png, webp, jpeg).

model

string

No

Model on OpenRouter (Default: google/gemini-3.1-flash-image).


๐Ÿ”Œ How to Integrate with MCP Clients

Configuration in Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "genimg": {
      "command": "node",
      "args": [
        "D:/MyProjs.Github/GenImgMCP/dist/index.js"
      ],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-key-here"
      }
    }
  }
}

Configuration in Antigravity / Cursor / MCP Config (mcp_config.json)

{
  "mcpServers": {
    "genimg": {
      "command": "node",
      "args": [
        "D:/MyProjs.Github/GenImgMCP/dist/index.js"
      ],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-v1-your-key-here"
      }
    }
  }
}

๐Ÿงช Testing the Server Locally

You can run the server directly in the terminal to verify startup:

node dist/index.js

The server will start and wait for JSON-RPC messages on the stdio channel.


๐Ÿ“„ License

MIT

A
license - permissive license
A
quality
C
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables image generation via OpenRouter API, supporting models like Gemini 2.5 Flash Image Preview with options to save files locally.
    2
    1
    Do What The F*ck You Want To Public
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables image and video generation from text, image editing, and text-to-video workflows using AI models via OpenRouter and fal.ai.
    MIT

View all related MCP servers

Related MCP Connectors

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • Generate images, video, and audio with Glif's media-generation agent

  • Generate images, GIFs, and PDFs from HTML, URLs, or templates โ€” from your AI agent.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fabiojbg/GenImgMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server