codex-imagegen-mcp
Codex's image generation in every coding agent: an MCP server + Agent Skill with a one-command installer for opencode, Claude Code, Codex, Cursor, VS Code, Gemini CLI and 20 more tools. Runs on your ChatGPT plan with no API key.
Install / Use
claude mcp add ShalomObongo -- npx -y github:ShalomObongo/codex-imagegen-mcpIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of codex-imagegen-mcp
codex-imagegen-mcp scores 83/100 on our quality scale, 614th of 932 AI & Machine Learning skills we index.
Its MCP Server is 21 KB long, well organised into 13 sections with 12 code examples: a thorough specification that gives an agent plenty to work with.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated yesterday, so codex-imagegen-mcp is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
codex-imagegen-mcp compared with similar skills
All 4 of these similar skills score higher than codex-imagegen-mcp; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| codex-imagegen-mcp (this skill)by ShalomObongo | 83 | 3 | 1d ago | MCP Server |
| claude-memby thedotmack | 100 | 95.1k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 87.5k | 16d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 84.9k | 3d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.2k | today | CLAUDE.md |
Frequently asked questions
- How do I install codex-imagegen-mcp?
- Run
claude mcp add ShalomObongo -- npx -y github:ShalomObongo/codex-imagegen-mcp. The install tabs above show the steps for each supported agent. - Which AI agents does codex-imagegen-mcp work with?
- It is written for Claude Code, Claude Desktop, Cursor, GitHub Copilot, Gemini CLI and OpenAI Codex, as a MCP Server file. Other agents that read the same format can often use it too.
- Is codex-imagegen-mcp safe to use?
- It is Apache-2.0-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is codex-imagegen-mcp still maintained?
- The repository was last updated yesterday, so codex-imagegen-mcp is actively maintained.
Skill content
View source on GitHubWhat it does
<table> <tr> <td width="33%" valign="top"> <img src="docs/assets/badges/signin.png" width="76" alt=""><br> <b>Your ChatGPT plan, not an API bill</b><br> Sign in once with ChatGPT, or reuse the sign-in Codex or opencode already has. Every image counts against the plan you already pay for. </td> <td width="33%" valign="top"> <img src="docs/assets/badges/clients.png" width="76" alt=""><br> <b>One installer, 25+ tools</b><br> <code>npx -y codex-imagegen-mcp install</code> finds your coding tools, shows every file it will touch, and edits only its own entry, keeping your comments. </td> <td width="33%" valign="top"> <img src="docs/assets/badges/transparency.png" width="76" alt=""><br> <b>Real transparent PNGs</b><br> Ask for <code>background: "transparent"</code> and get genuine alpha, checked on every file. A local chroma-key tool handles the rest. </td> </tr> <tr> <td width="33%" valign="top"> <img src="docs/assets/badges/aspect.png" width="76" alt=""><br> <b>Any canvas shape</b><br> Eleven aspect ratios from 21:9 to 9:21, and up to four variants of a prompt in parallel. </td> <td width="33%" valign="top"> <img src="docs/assets/badges/versions.png" width="76" alt=""><br> <b>Saves into your project, safely</b><br> Paths resolve to your workspace. An existing file is never overwritten; you get <code>hero-2.png</code> instead. </td> <td width="33%" valign="top"> <img src="docs/assets/badges/skill.png" width="76" alt=""><br> <b>Codex's own playbook</b><br> Ships the Codex app's <code>imagegen</code> skill as <code>imagegen-mcp</code>, adapted to these tools: prompt structure, edit invariants, save rules. </td> </tr> </table>See it work
Two real opencode sessions in a scratch project. The images are exactly what came back:
<p align="center"> <img src="docs/assets/examples/real-session.jpg" width="100%" alt="Three real outputs: a transparent cartoon cactus sticker, the same sticker edited to wear a straw hat, and a 16:9 photographic hero of a cactus shop at sunset"> </p>You: I need a sticker-style illustration of a cute cartoon cactus with a transparent background for this project. Save it as
assets/cactus-sticker.png.opencode ·
openai/gpt-5.5loads the skill →imagegen_generate_imagewithbackground: "transparent"→ "Savedassets/cactus-sticker.png, 1254×1254 PNG with a transparent background."You: Make a 16:9 hero banner for the Cactus Shop landing page, and a variant of the sticker where the cactus wears a tiny straw hat. Keep everything else identical.
opencode ·
github-copilot/claude-sonnet-5→imagegen_auth_status→imagegen_generate_image(aspect_ratio: "16:9") andimagegen_edit_image(images: ["assets/cactus-sticker.png"]) in parallel → both saved, the edit with "transparent background (alpha verified)".
One prompt, three canvases. aspect_ratio doesn't crop. The service composes a new picture for each shape:
A green screen becomes alpha on your machine. remove_background keys out a flat backdrop locally, with no network call and no quota:
[!TIP] Every image in this repository was made with codex-imagegen-mcp itself. That covers the posters, the badges, the logo and the examples; the installer screenshots are real terminal output. The prompts and the art-direction record are in docs/assets.
Quick start
[!NOTE] You need Node.js 22+ and a ChatGPT plan that includes Codex (Plus, Pro, Business, Enterprise, Edu…). Codex image generation isn't available on the Free plan.
1 · Run the installer. npx fetches the latest release, so there's nothing to install first. The installer finds the coding tools on this machine, shows exactly which files it will create or change, and writes nothing until you confirm. Each config keeps its comments and formatting.
npx -y codex-imagegen-mcp install
<p align="center">
<img src="docs/assets/screens/installer-pick.png" width="100%" alt="The interactive installer: it found 10 of 25 supported tools and lists them grouped as terminal agents and editors, with the detected ones pre-selected">
</p>
The configs it writes start the server through npx as well; npm downloads it on first use and caches it. The installer also runs without questions, for scripts and dotfiles:
npx -y codex-imagegen-mcp install opencode cursor claude-code # named tools (see --list)
npx -y codex-imagegen-mcp install --all --dry-run # every detected tool, preview only
<details>
<summary>Prefer a global install, the GitHub release, or a source checkout?</summary>
<br>
A global install gives you the short codex-imagegen-mcp command. The installer then writes an absolute Node path instead of npx, which starts faster and doesn't depend on npx. That suits GUI apps like Claude Desktop and Cursor best:
npm install --global codex-imagegen-mcp
codex-imagegen-mcp install
The same package is attached to every GitHub release with a signed build-provenance attestation:
npm install --global https://github.com/ShalomObongo/codex-imagegen-mcp/releases/latest/download/codex-imagegen-mcp.tgz
From source:
git clone https://github.com/ShalomObongo/codex-imagegen-mcp.git && cd codex-imagegen-mcp
npm ci && npm run build
npm link # puts `codex-imagegen-mcp` on your PATH
</details>
2 · Sign in with ChatGPT. The installer offers this at the end. Skip it if Codex or opencode is already signed in with ChatGPT.
npx -y codex-imagegen-mcp login # opens the browser; use --device on a headless machine
3 · Check, then ask for pictures
npx -y codex-imagegen-mcp doctor # Node, credentials, quota, and every tool it's installed in
you › Make a 16:9 hero image of a lighthouse at dusk and save it to assets/hero.png
[!TIP] From here on, commands use the short
codex-imagegen-mcpfrom a global install. Without one, run them through npx the same way, for examplenpx -y codex-imagegen-mcp status.
How it works
sequenceDiagram
autonumber
participant A as Your agent<br/>(opencode, Claude Code…)
participant M as imagegen MCP server<br/>(local · stdio)
participant O as auth.openai.com
participant C as chatgpt.com<br/>/backend-api/codex
A->>M: generate_image {prompt, aspect_ratio, background}
M->>M: pick credentials: own sign-in → Codex → opencode
opt token expires within 5 minutes
M->>O: refresh (under a cross-process lock)
O-->>M: new access token + rotated refresh token
end
M->>C: POST /images/generations · Bearer token · ChatGPT-Account-ID
loop every 5 s while the image renders
M-->>A: progress notification (keeps the client's timeout alive)
end
C-->>M: PNG + usage headers
M->>M: save without overwriting · verify alpha · build preview
M-->>A: path, size, background + a 1024 px preview
It sends the same request as the image tool built into the Codex app, byte for byte. As OpenAI improves Codex's image model on the server, this server gets the same upgrade. How that was reverse-engineered →
Signing in
| You already have… | What happens |
|---|---|
| Codex (CLI or desktop app) signed in with ChatGPT | Works immediately. The server borrows ~/.codex/auth.json read-only. |
| opencode signed in with OpenAI → ChatGPT Plus/Pro | Works immediately. It borrows ~/.local/share/opencode/auth.json read-only. |
| Neither, or you want an independent sign-in | Run codex-imagegen-mcp login, or ask your agent to call the sign_in tool. |
codex-imagegen-mcp login # browser → sign in → "You're signed in to Codex ImageGen MCP"
codex-imagegen-mcp login --device # SSH/headless: enter a code at auth.openai.com/codex/device
codex-imagegen-mcp status # account, plan, credential source and usage windows
codex-imagegen-mcp logout # remove and revoke this tool's own sign-in
[!IMPORTANT] OpenAI refresh tokens are single-use. Borrowed sign-ins are therefore never refreshed or modified, so this server can't sign you out of Codex or opencode. Its own tokens are stored
0600and refreshed under a lock shared by every server process. Authentication in depth →
Tools
| Tool | What it does | Key parameters |
|---|---|---|
| generate_image | A new image from a prompt | prompt · aspect_ratio · background · n · output_path |
| edit_image | Edit images, or generate from 1–5 references | images · prompt · same options |
| remove_background | Cut a flat backdrop out locally (no quota) | input_path · key_color (auto) · output_path |
| auth_status | Sign-in, plan, credential source, usage windows | check_usage |
| sign_in | Start a ChatGPT sign-in and return a link or code for you | method (browser · device) |
The server also exposes the resources imagegen://history, imagegen://images/{id} and imagegen://skill/*, and the prompts generate and edit. In opencode the prompts appear as /imagegen:generate and /imagegen:edit. Full reference →
From the terminal
The CLI uses the same engine as the MCP tools:
codex-imagegen-mcp generate "a watercolor fox in a snowy forest" -a 16:9 -o art/fox.png
Truncated for display — read the full file on GitHub.
Related Skills
claude-mem
95.1kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
87.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
84.9kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
74.2kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
