
Generates and edits images through Gemini 3 Pro Image (or OpenAI GPT Image with provider flag). Exposes tools for text-to-image and image-to-image operations with built-in prompt optimization that auto-enhances your input using a Subject-Context-Style framework. The server adds lighting, composition, and atmospheric details without requiring prompt engineering skills. Supports quality presets from fast iteration to 4K output, character consistency across generations, and flexible aspect ratios up to 21:9. Includes Google Search grounding for factual accuracy and multi-image blending. Ships with an optional Agent Skill file that teaches assistants prompt techniques for tools with native image generation. Requires Gemini or OpenAI API key and Node.js 22+. Works with Cursor, Claude Code, Codex, and other MCP clients.
Generate and edit images from Cursor, Claude Code, Codex, or any MCP-compatible tool. Supports Google Gemini, OpenAI GPT Image, and BytePlus Seedream.
This MCP server turns a plain-language request into an image file. It adds relevant photographic details such as lighting, camera angle, materials, and palette, then returns the saved image as an MCP resource.
You: "a roast chicken for a recipe page, partway through
carving so you can see how juicy it is"
↓
Your AI assistant sends the request to mcp-image
↓
Prompt enhancement adds relevant photographic details
(subject, lighting, camera, and palette)
↓
The selected provider generates the image
(using the configured grounding, consistency, and resolution options)
↓
Saved file, returned as an MCP resource
Your AI assistant supplies the style, purpose, and context from your request. mcp-image fills in missing visual details and selects the generation settings.
The prompt optimizer uses a Subject–Context–Style framework. It runs on Gemini 2.5 Flash by default, OpenAI Responses when IMAGE_PROVIDER=openai, or ModelArk Responses when IMAGE_PROVIDER=seedream. It adds missing details about the subject, environment, lighting, and camera work while keeping the details already present in the request. Detailed prompts receive fewer changes.
Example
You write: "a photo of a roast chicken dinner for a recipe site. it should look like it was actually cooked, and it should be partway through being carved so you can tell how juicy it is"
What the server sends to the image model: "...a beautifully roasted whole chicken, golden-brown and glistening, resting on a rustic wooden cutting board. One leg is partially carved, revealing tender, succulent white meat and rich, glistening juices pooling around the carving knife ... shallow depth of field to keep the focus sharply on the carved chicken."

Gemini provider, default fast preset.
What carried through:
for a recipe site → one subject, with everything else kept subordinateactually cooked → juices spread across the board, uneven browningpartway through being carved → the cut face, with slices laid beside ithow juicy it is → close framing and shallow depth of field on the cut
Set SKIP_PROMPT_ENHANCEMENT=true to send your prompt through unchanged.
IMAGE_PROVIDER=openai for OpenAI GPT Image or IMAGE_PROVIDER=seedream for BytePlus Seedream through ModelArk. Pass provider on a single request to switch providers without changing the server configuration.fast, balanced, or quality. Each provider maps these values to a supported model route. See Quality Presets.IMAGE_PROVIDER=openaiIMAGE_PROVIDER=seedreamGet your API key from Google AI Studio
To use OpenAI instead, get an OpenAI API key and set:
IMAGE_PROVIDER=openai
OPENAI_API_KEY=your_openai_api_key_here
OpenAI mode requires organization verification. See Using the OpenAI provider for setup details and feature differences.
To use BytePlus Seedream instead, create an API key in the ModelArk AP region and set:
IMAGE_PROVIDER=seedream
ARK_API_KEY=<your-api-key>
See Using the BytePlus Seedream provider for compatibility details.
Add to ~/.codex/config.toml:
[mcp_servers.mcp-image]
command = "npx"
args = ["-y", "mcp-image"]
[mcp_servers.mcp-image.env]
GEMINI_API_KEY = "your_gemini_api_key_here"
IMAGE_OUTPUT_DIR = "/absolute/path/to/images"
For OpenAI GPT Image from a local fork:
[mcp_servers.mcp-image]
command = "node"
args = ["/absolute/path/to/mcp-image/dist/index.js"]
[mcp_servers.mcp-image.env]
IMAGE_PROVIDER = "openai"
OPENAI_API_KEY = "your_openai_api_key_here"
IMAGE_OUTPUT_DIR = "/absolute/path/to/images"
Add to your Cursor settings:
~/.cursor/mcp.json.cursor/mcp.json in your project root{
"mcpServers": {
"mcp-image": {
"command": "npx",
"args": ["-y", "mcp-image"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key_here",
"IMAGE_OUTPUT_DIR": "/absolute/path/to/images"
}
}
}
}
For OpenAI GPT Image from a local fork:
{
"mcpServers": {
"mcp-image": {
"command": "node",
"args": ["/absolute/path/to/mcp-image/dist/index.js"],
"env": {
"IMAGE_PROVIDER": "openai",
"OPENAI_API_KEY": "your_openai_api_key_here",
"IMAGE_OUTPUT_DIR": "/absolute/path/to/images"
}
}
}
}
Run in your project directory to enable for that project:
cd /path/to/your/project
claude mcp add mcp-image --env GEMINI_API_KEY=your-api-key --env IMAGE_OUTPUT_DIR=/absolute/path/to/images -- npx -y mcp-image
Or add globally for all projects:
claude mcp add mcp-image --scope user --env GEMINI_API_KEY=your-api-key --env IMAGE_OUTPUT_DIR=/absolute/path/to/images -- npx -y mcp-image
For OpenAI GPT Image from a local fork:
npm install
npm run build
claude mcp add mcp-image --scope user \
--env IMAGE_PROVIDER=openai \
--env OPENAI_API_KEY=your-openai-api-key \
--env IMAGE_OUTPUT_DIR=/absolute/path/to/images \
-- node /absolute/path/to/mcp-image/dist/index.js
Security: Never commit API keys to version control. Use environment-specific configuration.
Path requirements:
IMAGE_OUTPUT_DIR must be an absolute path (e.g., /Users/username/images, not ./images)./output in the current working directory if not specifiedThe presets trade off speed, quality, and cost:
| Preset | Model | Best for | Speed |
|---|---|---|---|
fast (default) | Nano Banana 2 (Gemini 3.1 Flash Image) | Quick iterations, drafts, high-volume generation | ~30–40s |
balanced | Nano Banana 2 + Thinking | Production images, good quality with reasonable speed | Medium |
quality | Nano Banana Pro (Gemini 3 Pro Image) | Final deliverables, maximum fidelity, critical visuals | Slow |
Set the default via IMAGE_QUALITY environment variable:
IMAGE_QUALITY=fast # (default) Fastest generation
IMAGE_QUALITY=balanced # Enhanced thinking for better quality
IMAGE_QUALITY=quality # Maximum quality output
To override the preset for one request, tell your AI assistant to "generate in high quality" or "use balanced quality." The assistant passes the corresponding quality parameter.
Codex:
[mcp_servers.mcp-image.env]
GEMINI_API_KEY = "your_gemini_api_key_here"
IMAGE_QUALITY = "balanced"
Cursor:
Add "IMAGE_QUALITY": "balanced" to the env section in your config.
Claude Code:
claude mcp add mcp-image --env GEMINI_API_KEY=your-api-key --env IMAGE_QUALITY=balanced --env IMAGE_OUTPUT_DIR=/absolute/path/to/images -- npx -y mcp-image
Set SKIP_PROMPT_ENHANCEMENT=true to send prompts directly to the image generator. Use this when the exact prompt wording needs to remain unchanged.
| Variable | Default | Description |
|---|---|---|
IMAGE_PROVIDER | gemini | gemini, openai, or seedream. Used when a request does not set provider |
GEMINI_API_KEY | - | Required to use the gemini provider |
OPENAI_API_KEY | - | Required to use the openai provider |
ARK_API_KEY | - | Required to use the seedream provider; use a ModelArk AP region key |
A request-level provider takes precedence over IMAGE_PROVIDER; if neither is set, gemini is
used. The server can start without any API keys, but generate_image requires a key for the
selected provider. If a key is missing, the error identifies the environment variable to configure.
As of July 29, 2026, Seedream 5.0 Pro is available only in ModelArk AP (ap-southeast-1). Create an
API key in the ModelArk AP region console.
mcp-image uses seed-2-0-lite-260428 for prompt enhancement and Seedream 5.0 Pro for image generation. These model choices are fixed by the server and are not configurable through environment variables.
Seedream quality routing is fixed:
| Public preset | Seedream route | Native image optimizer | Supported imageSize | Default when omitted |
|---|---|---|---|---|
fast | Seedream 5.0 Pro | fast | 1K, 2K | 1K |
balanced | Seedream 5.0 Pro | standard | 1K, 2K | 1K |
quality | Seedream 5.0 Pro | standard | 1K, 2K | 1K |
All supported aspect ratios use BytePlus Method 1, so final pixel dimensions are model-selected.
Seedream rejects imageSize: "4K" and useGoogleSearch: true. Image requests have a fixed
300-second timeout. Seedream image editing accepts PNG and JPEG input images only.
Set IMAGE_PROVIDER=openai to use OpenAI for both prompt enhancement and image generation. mcp-image currently uses gpt-5.4-nano for prompt enhancement and gpt-image-2 for image generation. These model choices are fixed by the server and are not configurable through environment variables.
OpenAI may require organization verification before allowing access to gpt-image-2. If image generation fails with a 403 permission or verification error, check your organization settings: https://platform.openai.com/settings/organization/general
OpenAI provider behavior:
aspectRatio, mapped to the closest supported OpenAI image size.imageSize values 1K, 2K, and 4K.quality as fast -> low, balanced -> medium, and quality -> high. For anything beyond simple subjects, balanced or quality is recommended.useGoogleSearch; that option is only available with the Gemini provider.Prompt enhancement uses a separate OpenAI Responses API call. Set SKIP_PROMPT_ENHANCEMENT=true to send prompts directly to the image model.
Once configured, describe the image in natural language:
"Generate a serene mountain landscape at sunset with a lake reflection"
Prompt enhancement fills in relevant details about lighting, materials, composition, and atmosphere.
"Edit this image to make the person face right"
(with inputImagePath: "/path/to/image.jpg")
Character Consistency:
"Generate a portrait of a medieval knight, maintaining character consistency for future variations"
(with maintainCharacterConsistency: true)
High-Resolution 4K with Text Rendering:
"Generate a professional product photo of a smartphone with clear text on the screen"
(with imageSize: "4K")
Custom Aspect Ratio:
"Generate a cinematic landscape of a desert at golden hour"
(with aspectRatio: "21:9")
generate_image ToolThe server uses a separate model for each of its two stages:
gpt-5.4-nano via OpenAI Responses in OpenAI mode, or seed-2-0-lite-260428 via ModelArk Responses in Seedream mode): Refines your prompt using the Subject–Context–Style framework. Skippable via SKIP_PROMPT_ENHANCEMENT.gpt-image-2 in OpenAI mode, or Seedream 5.0 Pro in Seedream mode): Creates the final image. Provider-specific quality mappings are described above.| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | ✅ | Text description or editing instruction |
quality | string | - | Quality preset: fast (default), balanced, quality. Overrides IMAGE_QUALITY env var for this request |
provider | string | - | Image provider: gemini, openai, seedream. Overrides IMAGE_PROVIDER env var for this request; the provider's API key must be configured |
inputImagePath | string | - | Absolute path to input image for image-to-image editing |
fileName | string | - | .png, .jpg, or .jpeg selects that output format for OpenAI/Seedream. Other or absent suffixes use the provider default, and the saved name is corrected to the actual image extension |
aspectRatio | string | - | 1:1 (default), 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 1:8, 4:1, 8:1 |
imageSize | string | - | 1K, 2K, 4K. Leave unspecified for standard quality |
blendImages | boolean | - | Enable multi-image blending for combining multiple visual elements naturally |
maintainCharacterConsistency | boolean | - | Maintain character appearance consistency across different poses and scenes |
useWorldKnowledge | boolean | - | Use real-world knowledge for accurate context (historical figures, landmarks, factual scenarios) |
useGoogleSearch | boolean | - | Enable Google Search grounding with Gemini. OpenAI and Seedream reject true |
purpose | string | - | Intended use (e.g., "cookbook cover", "social media post"). Helps tailor visual style and details |
{
"type": "resource",
"resource": {
"uri": "file:///path/to/generated/image.png",
"name": "image-filename.png",
"mimeType": "image/png"
},
"metadata": {
"model": "gemini-3.1-flash-image",
"provider": "gemini",
"processingTime": 5000,
"timestamp": "2026-01-01T12:00:00.000Z"
}
}
"API key not found"
GEMINI_API_KEY is set when using Gemini, OPENAI_API_KEY is set when IMAGE_PROVIDER=openai, or ARK_API_KEY is set when IMAGE_PROVIDER=seedream"Input image file not found"
"No image data found in Gemini API response"
fast preset typically takes ~30–40 seconds including prompt optimizationbalanced uses additional thinking and quality selects Nano Banana Profast selecting native fast
optimization and balanced/quality selecting standarduseWorldKnowledge for historical or factual subjectsimageSize: "4K" when the selected provider supports it; Seedream accepts 1K and 2Kfast / balanced: Nano Banana 2 (Gemini 3.1 Flash Image, lower cost)quality: Nano Banana Pro (Gemini 3 Pro Image, higher cost)balanced uses additional thinking tokens (slightly higher cost than fast)This project also includes a standalone Agent Skill (SKILL.md). Use it to help an AI assistant write prompts for a tool that already supports image generation. The skill is separate from the MCP server, does not call it, and does not require an API key.
The skill covers the Subject-Context-Style framework, lighting, textures, camera angles, character consistency, composition, and image editing. It works with Gemini, GPT Image, Flux, Stable Diffusion, Midjourney, and other image models.
npx mcp-image skills install --path <skills-directory>
The skill will be placed at <skills-directory>/image-generation/SKILL.md. For example: ~/.cursor/skills (Cursor), ~/.codex/skills (Codex), or ~/.claude/skills (Claude Code).
MIT License - see LICENSE for details.
Need help? Open an issue or check the troubleshooting section above.
IMAGE_PROVIDERImage provider to use: 'gemini' (default) or 'openai'
GEMINI_API_KEYsecretGoogle Gemini API key for image generation when IMAGE_PROVIDER=gemini (get from https://aistudio.google.com/apikey)
OPENAI_API_KEYsecretOpenAI API key for image generation when IMAGE_PROVIDER=openai. Requires OpenAI organization verification to access gpt-image-2 (https://platform.openai.com/settings/organization/general)
IMAGE_OUTPUT_DIRAbsolute path to directory where generated images will be saved (defaults to ./output)
IMAGE_QUALITYDefault quality preset: 'fast' (Nano Banana 2, default), 'balanced' (Nano Banana 2 + thinking), 'quality' (Nano Banana Pro)
SKIP_PROMPT_ENHANCEMENTSet to 'true' to disable automatic prompt optimization and use direct prompts