GenImgMCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GenImgMCP Generate a 16:9 hero image of a futuristic city and save it to ./assets/hero.png"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Node.js 18 or higher
OpenRouter API Key
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:
Environment Variable: Set
OPENROUTER_API_KEYin your environment..envFile: Create a.envfile 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_imagesCommand 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 |
|
| Yes | Detailed description of the image to generate. |
|
| No | File path where the image will be saved (e.g., |
|
| No | Aspect ratio of the image ( |
|
| No | File format ( |
|
| No | Model on OpenRouter (Default: |
2. edit_image
Modifies an existing image provided by local file path.
Parameter | Type | Required | Description |
|
| Yes | Source image path (e.g., |
|
| Yes | Modification instructions or elements to add. |
|
| No | Destination path for the edited image. |
|
| No | Desired aspect ratio for the resulting image. |
|
| No | Output file format ( |
|
| No | Model on OpenRouter (Default: |
π 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.jsThe server will start and wait for JSON-RPC messages on the stdio channel.
π License
MIT
Available Tools
2 toolsedit_imageA
Edits or transforms an existing image from a local file and natural language instructions (add elements, change backgrounds, alter style, etc.).
Inputs: prompt (required), image_path (required), model, output_path, +2 more.
generate_imageA
Generates an image from a detailed text prompt using the Gemini 3.1 Flash Image model via OpenRouter. Saves the image locally and returns the absolute path and metadata.
Inputs: prompt (required), model, output_path, aspect_ratio, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 2 tools
generate_image and edit_image have clearly distinct purposes: one creates new images from a prompt, while the other transforms an existing local image. There is no meaningful overlap or ambiguity between the two tools.
Both tools follow a consistent verb_noun pattern: generate_image and edit_image. The naming is predictable, clear, and uniform.
Two tools is on the thin side for an image generation/editing server, even though both are core operations. The count is borderline but not unreasonable for a minimal focused toolset.
The server covers the two primary image operations: generation and editing. It lacks supporting operations like listing locally saved images or deleting them, but these are minor gaps that agents can work around using file paths.
Maintenance
Related MCP Connectors
AI image + video generation for agents: --flag prompt DSL, async generate/poll, x402 pay-per-use.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Generate and edit images, video, voice, lip-sync and 3D models from your AI agent.
Ask other AI models and generate images, speech, music and video from your coding agent.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables image generation via OpenRouter API, supporting models like Gemini 2.5 Flash Image Preview with options to save files locally.21Do What The F*ck You Want To Public
- AlicenseAqualityDmaintenanceGives AI assistants image generation and editing capabilities through OpenRouter, supporting multiple models, style presets, variations, and batch operations.575 npm2MIT
- AlicenseAqualityCmaintenanceEnables coding agents to generate and edit images using Gemini and OpenAI image models, saving files directly into the project with configurable providers, models, and security restrictions.389 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP-capable agents to generate and edit images through Gemini or OpenAI, returning an absolute file path instead of image bytes to keep context windows clean.1MIT