openai-image
Provides tools to generate and edit images through the OpenAI Images API, including still images, animated GIFs, SVG generation, and image editing or composition with optional masks or markup overlays.
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., "@openai-image Generate a watercolor sunset over mountains and save it to /Users/me/Pictures"
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.
openai-image is a stdio Model Context Protocol server. It calls the official OpenAI Images API, writes the files to an absolute output_dir, and returns paths plus metadata. Tool results never include base64.
npx -y @felixpy/openai-image@latestQuick start
1. API key
The server reads OPENAI_API_KEY from the environment. It is required for a tool call and is never logged. A missing key does not stop the process from starting.
export OPENAI_API_KEY=sk-...Variable | Default | Role |
| required for tool calls | Sent by the OpenAI SDK. Never commit it. |
|
| Model used when a call omits |
| OpenAI default | Optional. Read by the OpenAI SDK. |
2. Register the server
Every snippet starts the published package over stdio. Replace sk-... locally. Do not commit a real key.
Bare npx -y <pkg> can keep reusing a cached older version, while @latest makes npx check npm on each start; pin a version like @0.2.0 instead if you want reproducible behavior.
Cursor
~/.cursor/mcp.json or .cursor/mcp.json:
{
"mcpServers": {
"openai-image": {
"command": "npx",
"args": ["-y", "@felixpy/openai-image@latest"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"openai-image": {
"command": "npx",
"args": ["-y", "@felixpy/openai-image@latest"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}Claude Code
claude mcp add openai-image \
-e OPENAI_API_KEY=sk-... \
-- npx -y @felixpy/openai-image@latestCodex
~/.codex/config.toml:
[mcp_servers.openai-image]
command = "npx"
args = ["-y", "@felixpy/openai-image@latest"]
env = { OPENAI_API_KEY = "sk-..." }Related MCP server: image-generation-mcp
Tools
Tool | API | Required | Also accepts |
|
|
| Shared image fields, plus |
|
|
| Shared image fields, plus |
openai_image_generate creates still images, animated GIFs (output_format=gif), or SVG. openai_image_edit edits or composes up to 16 reference images, optionally guided by a mask or a markup overlay. Both save files under output_dir and return their paths.
A successful result is text JSON. URLs and revised_prompt are included only when the API sends them.
{
"model": "gpt-image-2.6-flare",
"files": ["/absolute/path/image-2026-11-05T00-00-00-000Z-0.png"],
"usage": null,
"size": "1024x1024",
"quality": "auto",
"output_format": "png"
}API failures, including moderation_blocked, come back as tool errors with status, code, type, param, message, request_id, and the raw error body. The client uses maxRetries: 2 and a 180 second timeout.
Parameters
Schemas are loose strings on purpose. The API validates values, so a new option usually needs no code change. Unknown fields can go through extra, which is shallow-merged last.
Shared
Parameter | Required | Range and notes |
| yes | Absolute directory. A relative path is rejected. The directory is created if needed. |
| no | Default is |
| no |
|
| no |
|
| no | Planning effort, separate from quality: |
| no | Integer from 1 to 10. |
| no |
|
| no |
|
| no | Integer from 0 to 100. |
| no | GIF only. Integer, minimum 2, default 9. The SDK documents 2–16 and the image guide documents 2–64. Describe the motion and a return to the starting pose so the loop is smooth. |
| no | GIF only. Integer from 20 to 2000, rounded to 10. Default 200. |
| no |
|
| no | Optional stable hashed end-user id for OpenAI abuse monitoring. |
| no | Object shallow-merged into the request last, for example |
openai_image_generate
Parameter | Required | Range and notes |
| yes | Text prompt. Maximum 32000 characters. |
| no | SVG only, with |
openai_image_edit
Parameter | Required | Range and notes |
| yes | Edit instructions. |
| yes | Local paths. Minimum 1. The API accepts up to 16 reference images. |
| no | PNG mask, same size as the first image. Transparent pixels are the area to edit. Cannot be combined with |
| no | Transparent PNG overlay with marks, arrows, or notes, same size as the first image. Cannot be combined with |
| no |
|
Edit accepts the shared fields, including output_format. GIF output from edit was verified on 2026-11-05.
Notes
GIF. Set
output_formattogifon generate or edit. Useframe_countandframe_duration_msto shape the loop. Edit GIF output was verified on 2026-11-05.Absolute
output_dir. The path must be absolute. Relative paths are rejected before the API is called.No base64 in tool results. Bytes are written to disk. The tool returns file paths, the model,
usage, andrevised_promptwhen the API provides one.Pass-through.
extrais shallow-merged last, so new API fields work without a release.
Development
Node.js 20 or newer.
npm ci
npm test
npm run build
npm startnpm test builds dist/ and completes an MCP initialize plus tools/list handshake. It does not call the OpenAI API and does not need OPENAI_API_KEY.
See CONTRIBUTING.md for commit style and pull requests, and docs/publishing.md for the one-time npm setup.
Project
Available Tools
2 toolsopenai_image_editB
Edit images or compose from up to 16 reference images (OpenAI images.edit), optionally guided by a mask or markup overlay. Saves files to output_dir and returns their paths.
Inputs: prompt (required), output_dir (required), image_paths (required), n, +15 more.
openai_image_generateB
Generate images (OpenAI images.generate): still images, animated GIF (output_format=gif) or SVG. Saves files to output_dir and returns their paths.
Inputs: prompt (required), output_dir (required), n, svg, +12 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
The two tools are cleanly separated by OpenAI endpoint semantics: generate creates new images, edit modifies or composes from existing references. Descriptions make the boundary explicit (new content vs. reference-based modification), so an agent cannot reasonably confuse them.
Both names follow the same predictable pattern: openai_image_<verb> in snake_case, with the shared prefix mirroring the provider and resource. No mixing of conventions or stylistic outliers.
Two tools is minimal but well matched to a single-provider image server where generate and edit are the two real operations. Each earns its place; the surface is small by design rather than arbitrarily truncated.
Generation and reference-based editing cover the core image lifecycle, including GIF/SVG output and multi-reference composition. Minor gaps remain (e.g. no image variations endpoint, no listing or retrieval of previously saved outputs), but agents can work around these via the returned file paths.
Maintenance
Related MCP Connectors
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Generate AI images and videos from any compatible MCP client.
Generate and edit images and generate videos with Nanobananana's remote MCP server.
Generate on-brand images from your AI agent: design, edit, and render templates over MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceGenerates and edits images using OpenAI image models via MCP tools.MIT
- 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
- AlicenseAqualityBmaintenanceEnables MCP clients to generate and edit images through any OpenAI-compatible image API, saving results as local files and returning absolute paths for immediate use.3MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to generate images and iteratively edit them using OpenAI's gpt-image-2 models, with session management, background job polling, and local file saving.8556 npmMIT