openai-image-mcp-server
v2.1.0MCP server for OpenAI image generation using gpt-image models (GPT Image 2.6 / 2.5 Sunburst and Flare, gpt-image-2)
An MCP server for OpenAI image generation. Generate, edit, animate, and create variations of images using the gpt-image model family (GPT Image 2.6 / 2.5 Sunburst and Flare, gpt-image-2) — directly from any MCP-compatible client like Claude Desktop, Cursor, or VS Code. Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows): Add to your Cursor MCP settings (~/.cursor/mcp.json):
Summary extracted from the README.
openai-image-mcp-server
An MCP server for OpenAI image generation. Generate, edit, animate, and create variations of images using the gpt-image model family (GPT Image 2.6 / 2.5 Sunburst and Flare, gpt-image-2) — directly from any MCP-compatible client like Claude Desktop, Cursor, or VS Code.
Model lifecycle.
gpt-image-1was shut down on 2026-10-23 and is no longer accepted.gpt-image-1.5andgpt-image-1-minishut down on 2026-12-01 — move to agpt-image-2.6-*model before then. Until then they keep working, and every result produced with one of them starts with a deprecation notice so the assistant can tell you about the upcoming replacement.DALL-E 2 / DALL-E 3 removed. OpenAI retired both DALL-E models on 2026-05-12. This server now targets only the gpt-image family. The
gpt_image_create_variationtool is re-implemented on top of the edit endpoint because the legacy/v1/images/variationsendpoint went away with DALL-E 2.
Tools
| Tool | Description |
|---|---|
gpt_image_generate |
Generate images from a text prompt (png / jpeg / webp / svg) |
gpt_image_edit |
Edit an existing image with a mask, a markup layer, or extra reference images |
gpt_image_create_variation |
Create stylistic variations of an image (via edit endpoint) |
gpt_image_generate_animation |
Generate a short looping animated GIF from a prompt or source images |
gpt_image_create_character_reference |
Generate a base reference image for a game character |
gpt_image_generate_pose |
Generate any pose/action from a character reference image |
gpt_image_generate_sprite_sheet |
Generate a multi-frame sprite sheet (convenience wrapper) |
Requirements
- Node.js 18+
- An OpenAI API key
Installation
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"gpt-image-gen": {
"command": "npx",
"args": ["-y", "openai-image-mcp-server@latest"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
Cursor
Add to your Cursor MCP settings (~/.cursor/mcp.json):
{
"mcpServers": {
"gpt-image-gen": {
"command": "npx",
"args": ["-y", "openai-image-mcp-server@latest"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
VS Code (with Copilot MCP extension)
Add to your VS Code settings.json:
{
"mcp.servers": {
"gpt-image-gen": {
"command": "npx",
"args": ["-y", "openai-image-mcp-server@latest"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
Claude Code
Add to ~/.claude/settings.json:
{
"env": {
"OPENAI_API_KEY": "sk-..."
},
"mcpServers": {
"openai-image": {
"command": "npx",
"args": ["-y", "openai-image-mcp-server"]
}
}
}
Or via CLI:
claude mcp add openai-image -e OPENAI_API_KEY=sk-... -- npx -y openai-image-mcp-server@latest
Manual (from source)
git clone https://github.com/YOUR_USERNAME/openai-image-mcp-server
cd openai-image-mcp-server
npm install
npm run build
OPENAI_API_KEY=sk-... node dist/index.js
Tool Reference
gpt_image_generate
Generate one or more images from a text prompt.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string | required | Text description of the image |
model |
gpt-image-2.6-flare | gpt-image-2.6-sunburst | gpt-image-2.5-flare | gpt-image-2.5-sunburst | gpt-image-2 | gpt-image-1.5 | gpt-image-1-mini |
gpt-image-2.6-flare |
Model to use |
n |
number (1–10) | 1 |
Number of images |
size |
auto or WIDTHxHEIGHT |
1024x1024 |
Output dimensions — see Sizes |
quality |
low | medium | high | xhigh | max | auto |
— | Render quality. xhigh/max need a 2.5/2.6 model |
complexity |
low | medium | high |
— | Planning effort before rendering (model default high). low is faster and cheaper |
moderation |
auto | low |
— | Content filtering level |
background |
transparent | opaque | auto |
— | Transparent requires png/webp. On gpt-image-2 it needs preview access |
output_format |
png | jpeg | webp | svg |
png |
Output file format. svg requires n=1 and no output_compression |
output_compression |
number (0–100) | — | Compression for jpeg/webp |
svg_model |
string | gpt-6-astra |
Text model that authors the SVG markup (only with output_format: svg) |
output_directory |
string | ./openai-image-gen |
Directory for saved files |
Images are always written to disk and returned as base64 data (SVG is saved to disk only). gpt-image models do not produce URLs. The result also reports token usage.
Examples:
Generate a photorealistic portrait of a tabby cat sitting on a windowsill
Generate a wide cinematic shot of a foggy mountain valley at sunrise
→ model: gpt-image-2.6-sunburst, size: 2048x1152, quality: xhigh
Generate a glowing magic crystal with transparent background
→ background: transparent, output_format: png
Generate a minimal flat icon of a red apple as vector art
→ output_format: svg
gpt_image_edit
Edit an existing image using a text prompt. Three optional ways to guide the edit:
- Mask — transparent pixels in the mask define the region to edit (inpainting). Masking is prompt-guided, so the model may not follow the exact shape.
- Markup — a separate transparent PNG with circles, arrows or sketches pointing at what to change (GPT Image 2.5/2.6). Must be the same size as the image; cannot be combined with a mask.
- Reference images — extra images to take style or content from. Mask and markup always apply to
image_path.
| Parameter | Type | Default | Description |
|---|---|---|---|
image_path |
string | required | Absolute path to the image to edit (png/jpeg/webp, < 50 MB, auto-resized) |
prompt |
string | required | Description of the desired edit |
reference_image_paths |
string[] (max 15) | — | Additional reference images |
mask_path |
string | — | Absolute path to mask PNG (transparent = edit zone) |
markup_path |
string | — | Absolute path to a transparent PNG annotation layer, same size as image_path |
model |
gpt-image-2.6-flare | gpt-image-2.6-sunburst | gpt-image-2.5-flare | gpt-image-2.5-sunburst | gpt-image-2 | gpt-image-1.5 | gpt-image-1-mini |
gpt-image-2.6-sunburst |
Model to use |
n |
number (1–10) | 1 |
Number of results |
size |
auto or WIDTHxHEIGHT |
1024x1024 |
Output dimensions — see Sizes |
quality |
low | medium | high | xhigh | max | auto |
— | Render quality. xhigh/max need a 2.5/2.6 model |
complexity |
low | medium | high |
— | Planning effort before rendering (model default high). low is faster and cheaper |
moderation |
auto | low |
— | Content filtering level |
background |
transparent | opaque | auto |
— | Transparent requires png/webp |
output_format |
png | jpeg | webp |
png |
Output file format |
output_compression |
number (0–100) | — | Compression for jpeg/webp |
output_directory |
string | ./openai-image-gen |
Directory for saved files |
Examples:
Edit /photos/room.png → "Add a potted plant near the window"
Edit /photos/portrait.png with mask /photos/mask.png → "Replace background with a sunny beach"
Edit /art/vase.png with markup /art/vase_marks.png → "Change the circled flower to a tulip"
Edit /shop/mug.png with reference /brand/logo.png → "Print the logo on the mug"
→ reference_image_paths: ["/brand/logo.png"]
gpt_image_create_variation
Create artistic variations of an existing image.
Implemented on top of the edit endpoint because the legacy /v1/images/variations endpoint was retired with DALL-E 2 on 2026-05-12. Pass variation_prompt for targeted variations or rely on the default "stylistic variation" prompt.
| Parameter | Type | Default | Description |
|---|---|---|---|
image_path |
string | required | Absolute path to the source image (png/jpeg/webp, < 50 MB) |
variation_prompt |
string | built-in default | Custom instruction describing the variation |
model |
gpt-image-2.6-flare | gpt-image-2.6-sunburst | gpt-image-2.5-flare | gpt-image-2.5-sunburst | gpt-image-2 | gpt-image-1.5 | gpt-image-1-mini |
gpt-image-2.6-sunburst |
Model to use |
n |
number (1–10) | 1 |
Number of variations |
size |
auto or WIDTHxHEIGHT |
1024x1024 |
Output dimensions — see Sizes |
quality |
low | medium | high | xhigh | max | auto |
— | Render quality. xhigh/max need a 2.5/2.6 model |
complexity |
low | medium | high |
— | Planning effort before rendering (model default high). low is faster and cheaper |
moderation |
auto | low |
— | Content filtering level |
output_format |
png | jpeg | webp |
png |
Output file format |
output_compression |
number (0–100) | — | Compression for jpeg/webp |
output_directory |
string | ./openai-image-gen |
Directory for saved files |
Examples:
Create 3 variations of /art/original.png
→ n: 3, output_directory: /art/variations
Reinterpret /photo.png as oil painting with warm sunset tones
→ variation_prompt: "Reinterpret as oil painting with warm sunset tones"
gpt_image_generate_animation
Generate a short looping animated GIF, either from a prompt alone or by animating source images. Requires a GPT Image 2.6 model.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string | required | The subject and how it moves |
image_paths |
string[] | — | Source/reference images to animate |
model |
same list as gpt_image_generate |
gpt-image-2.6-flare |
Model to use |
frame_count |
number (2–16) | 9 |
Number of frames |
frame_duration_ms |
number (20–2000) | 200 |
Display time per frame, rounded to 10 ms |
size |
auto or WIDTHxHEIGHT |
auto |
Frame dimensions (multiples of 16) |
quality |
low | medium | high | xhigh | max | auto |
— | Render quality |
complexity |
low | medium | high |
— | Planning effort |
moderation |
auto | low |
— | Content filtering level |
output_directory |
string | ./openai-image-gen |
Directory for the saved GIF |
Examples:
Animate a tiny pixel-art campfire flickering
→ frame_count: 6
Animate /sprites/hero_ref.png → "This character waving hello"
→ image_paths: ["/sprites/hero_ref.png"], frame_duration_ms: 120
gpt_image_create_character_reference
Generate a base reference image for a game character on a transparent background. Use this as the first step before generating any poses.
| Parameter | Type | Default | Description |
|---|---|---|---|
character_description |
string | required | Full appearance description. Max 3000 chars. |
output_path |
string | required | Absolute path for the output PNG |
quality |
low | medium | high |
high |
Render quality |
complexity |
low | medium | high |
— | Planning effort; low makes each frame faster and cheaper |
bg_threshold |
number (0–255) | 240 |
Fallback white-background removal threshold (only used if the model returns an opaque image) |
Example:
Create a character reference for a cute chibi goose
→ character_description: "cute chibi goose, white feathers, orange beak, blue sailor hat, red bow tie"
output_path: /project/assets/sprites/goose_ref.png
gpt_image_generate_pose
Generate a specific pose or action frame using a reference image for visual consistency.
| Parameter | Type | Default | Description |
|---|---|---|---|
reference_image_path |
string | required | Path to reference PNG from gpt_image_create_character_reference |
character_description |
string | required | Same description used for the reference |
pose_description |
string | required | Free-text pose or action. Max 1000 chars. |
output_path |
string | required | Absolute path for the output PNG |
quality |
low | medium | high |
high |
Render quality |
complexity |
low | medium | high |
— | Planning effort; low makes each frame faster and cheaper |
bg_threshold |
number (0–255) | 240 |
Fallback white-background removal threshold (only used if the model returns an opaque image) |
Example poses:
"walking with left foot forward""crying, tears streaming down face""jumping with both arms raised""attacking, swinging sword to the right""sitting cross-legged""waving hello"
gpt_image_generate_sprite_sheet
Convenience wrapper: generates a reference internally, then produces all requested poses and assembles them into a single sprite sheet. For more control, use gpt_image_create_character_reference + gpt_image_generate_pose directly.
| Parameter | Type | Default | Description |
|---|---|---|---|
character_description |
string | required | Appearance of the character. Max 3000 chars. |
poses |
string[] | 3-frame walk cycle | List of pose descriptions for each frame |
output_path |
string | required | Absolute path for the output sprite sheet PNG |
quality |
low | medium | high |
high |
Render quality |
complexity |
low | medium | high |
— | Planning effort; low makes each frame faster and cheaper |
bg_threshold |
number (0–255) | 240 |
Fallback white-background removal threshold (only used if the model returns an opaque image) |
frame_gap |
number | 0 |
Pixel gap between frames |
How it works:
- Generates a neutral reference frame with
gpt-image-2.6-sunburst, requesting a native transparent background - Uses the edit API with the reference to generate each requested pose
- If a frame comes back opaque, removes the white background as a fallback (flood-fill from edges, preserves white character parts)
- Crops each frame to content and pads to uniform dimensions
- Composites all frames horizontally into a single transparent PNG
Examples:
3-frame walk cycle (default)
→ character_description: "chibi knight in silver armor with red cape"
output_path: /sprites/knight_walk.png
Custom poses
→ character_description: "cute chibi goose, white feathers, blue sailor hat, red bow tie"
poses: ["walking left foot forward", "waving hello", "sitting down"]
output_path: /sprites/goose_actions.png
Cost: one API call per pose plus one for the reference. Use
quality: low/complexity: lowfor drafts. For a ready-made looping GIF instead of separate frames, usegpt_image_generate_animation.
Tip: The more specific your
character_description, the more consistent the 3 frames will be. Include art style (e.g. "pixel art", "chibi", "flat cartoon"), color details, and any distinctive accessories.
Model Comparison
| gpt-image-2.6-sunburst / flare | gpt-image-2.5-sunburst / flare | gpt-image-2 | gpt-image-1.5 / 1-mini | |
|---|---|---|---|---|
| Status | Current | Previous generation | Older | Shut down 2026-12-01 |
| Generate / edit / variation | ✓ | ✓ | ✓ | ✓ |
| Transparent background | ✓ | ✓ | Preview access only | ✓ |
| Sizes | flexible | flexible | flexible | 1024² / 1024×1536 / 1536×1024 |
| Quality | up to max |
up to max |
up to high |
up to high |
| Markup-guided edit | ✓ | ✓ | ✗ | ✗ |
| SVG / animated GIF output | ✓ | — | ✗ | ✗ |
Sunburst vs. Flare: Sunburst is for detailed work where editing precision matters most (default for edit, variation and character tools). Flare is for fast, high-quality everyday generation (default for generate and animation).
Feature support per model is ultimately decided by the OpenAI API; an unsupported combination returns the API's error message.
Sizes
size accepts auto or any WIDTHxHEIGHT string that satisfies:
- both edges are multiples of 16 and at most 3840 px
- aspect ratio between 1:3 and 3:1
- total pixels between 655,360 and 8,294,400 (anything above 2560x1440 is experimental)
Common choices: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160. gpt-image-1.5 and gpt-image-1-mini accept only the first three.
Saving Images to Disk
All gpt-image models return base64 data (no URLs). Generated images are automatically written to disk — pass output_directory to customize the location, otherwise files land in ./openai-image-gen.
Generate a sunset landscape and save it
→ output_directory: /Users/me/Desktop
Files are saved as generated_<timestamp>_<n>.<ext>, edited_<timestamp>_<n>.<ext>, variation_<timestamp>_<n>.<ext>, or animation_<timestamp>_<n>.gif where <ext> matches output_format (default png).
License
MIT