
Codex / OpenAI Image
io.github.meet30997Published by GitHub account meet30997v0.1.2Updated Oct 30, 2026
Generate, edit and make matching sets of images with the Codex CLI or the OpenAI Images API
Overview
Local MCP server that lets an assistant generate, edit and produce matching sets of images via the Codex CLI or the OpenAI Images API.
- What you can do
- Generate images from a prompt, with size, variant count, transparency and style references
- Edit an existing image with a prompt, optional mask and supporting references, leaving the original untouched
- Create matching sets of named images that share one style, saved into a folder
- Return saved paths plus small previews so the assistant can inspect results and continue
- Write a JSON sidecar with prompt and settings next to each image
- When to use it
- Useful when you want an assistant to create or revise images inside a chat session — blog headers, app icons, sticker sets, or edits like turning a photo into a night scene — and to see the result before iterating.
- Requirements
- Node.js 20.3 or newer, run locally via npx. Choose a backend with IMAGEGEN_PROVIDER: codex-cli needs the Codex CLI signed in with a ChatGPT plan; openai-api needs OPENAI_API_KEY; mock needs nothing. Optional settings include IMAGEGEN_OUT_DIR, IMAGEGEN_READ_ROOT, IMAGEGEN_OPENAI_MODEL and IMAGEGEN_TIMEOUT_SEC.
Installation
In SourceWeft
- Open Codex / OpenAI Image in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
codex-openai-image-mcp
[npm version] [Codex / OpenAI Image MCP on mcprush]
An MCP server that lets Claude (and any other MCP client) generate images, edit them, and make matching sets, then look at the result and keep going.
It works with two image backends:
- Codex CLI: uses the ChatGPT plan you already have through the Codex CLI. No API key, no per-image bill.
- OpenAI Images API: uses an
OPENAI_API_KEY, for people without Codex.
Not affiliated with or endorsed by OpenAI. "OpenAI" and "Codex" are trademarks of OpenAI.
Both examples are real, unretouched output from the Codex backend.
What makes it different
- Matching sets.
generate_setmakes several different images that share one style, each saved under its own name. - Two backends, one interface. Switch between Codex and the OpenAI API with one setting.
- Made for an agent loop. Every call returns small previews that Claude can see, reports
progress during long runs, can be cancelled, and writes a
.jsonsidecar with the prompt and settings next to each image. - Careful with your files. It writes only inside its output folder, never overwrites an existing file, never changes the image you edit, and runs Codex read-only in an empty temporary folder.
Quick start
You need Node.js 20.3 or newer, plus one of:
- the Codex CLI, signed in (
codex login) with a ChatGPT plan that includes Codex image generation, or - an OpenAI API key with credits.
Claude Code
Claude Desktop, Cursor and other clients
Add this to the client's MCP config (for Claude Desktop, claude_desktop_config.json):
For the API backend use "IMAGEGEN_PROVIDER": "openai-api" and add "OPENAI_API_KEY".
Then just ask:
- "Make a watercolour fox for my blog header, 1536x864."
- "Edit photo.png so it looks like a sunset."
- "Make 5 matching app icons: home, search, profile, settings, bell."
Images are saved in ./generated-images in the folder the client was started from.
Tools
generate_image
edit_image
generate_set
All tools crop and resize the result to exactly the size you ask for, and return the saved paths with a 512 px preview of each image.
Backends
mock draws placeholder images, for trying the server out and for tests.
Codex backend. Each call runs
codex exec --json --skip-git-repo-check --sandbox read-only --cd <empty temp folder> [--image=<file>…] -- -
with a prompt that asks Codex to call its built-in image_gen tool and nothing else. The server
reads the session id from Codex's JSON events and collects the images from
$CODEX_HOME/generated_images/<session id>/. Codex never gets write access or sees your project
beyond the images you pass it. Cancelling the request, or hitting the timeout, stops Codex.
Check OpenAI's terms for scripted use of the Codex CLI with your plan.
OpenAI backend. Uses the official openai SDK. The default model is
gpt-image-2.5-sunburst; set IMAGEGEN_OPENAI_MODEL=gpt-image-2.5-flare for faster results. Sizes
are rounded to ones the API accepts, then resized to yours. This backend is covered by automated
tests against a mocked client; it has not yet had a full live test.
Settings
Files and safety
- Output is written only inside
IMAGEGEN_OUT_DIR. Absolute paths,..and symlinks that lead outside are rejected. - Input images (to edit, or as references) must be inside
IMAGEGEN_READ_ROOT. - Existing files are never overwritten: a new file gets
-2,-3, … instead. - Each image gets a
<name>.jsonsidecar with the prompt, backend, model, size, inputs and time. - API keys are read from the environment only and never logged or written to sidecars.
IMAGEGEN_MAX_PER_CALLcaps how many images one call can make.
Images are AI-generated. You are responsible for how you use them, including platform rules on AI-generated content, and for not imitating real people or brands.
Development
To run a local build from Claude Code:
The tests run the Codex backend against a stand-in script (test/fixtures/fake-codex.mjs) and the
OpenAI backend against a fake client, so they are free and quick. PLAN.md has the
design notes and roadmap. Issues and pull requests are welcome.
License
Source: README.md at commit ec83524
Tools
0Version history
1- v0.1.2LatestOct 29, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts