codex-imagegen-mcp
Generates images through OpenAI's ChatGPT subscription via the Codex CLI, providing tools to create and edit images, check job status, cancel jobs, and retrieve generated artifact URLs.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
codex-imagegen-mcp
An MCP server that generates images with the Codex CLI, so the work is billed to a ChatGPT subscription you already pay for instead of the per-image OpenAI API.
Why this exists
Claude Design can ask for images, but every image API call costs money on top of whatever you already pay OpenAI. A ChatGPT subscription can already generate images, and the official Codex CLI can drive it. What was missing was a way for an MCP client to reach that.
So: sign in to Codex once with your ChatGPT account, run one container, and
point any MCP client at it. Images come back as URLs. Nothing here ever reads
OPENAI_API_KEY — the Codex process's environment is built from an allowlist,
so even if that variable is set on the host it is never forwarded. Spending
the subscription is the entire point.
What you should know before relying on it:
One sign-in means one job at a time. A single ChatGPT session drives a single Codex process. The queue absorbs the backlog; it does not make the account faster.
An image takes 30 to 140 seconds. The MCP tool waits for you and reports progress, so clients do not have to poll.
Your account's terms and quotas apply. This automates the official CLI with your own credentials. It does not bypass anything, and it gives you no more capacity than your plan already has.
Related MCP server: codex-mcp-system
Quick start
One container. No database, no object storage, no message broker: with neither Redis nor S3 configured the process keeps its queue in memory and writes images to a volume, serving them from the same port it serves MCP on.
Requires Docker with the Compose plugin, and a ChatGPT account that can use Codex.
git clone https://github.com/tinyorbitvn/codex-imagegen-mcp.git
cd codex-imagegen-mcp
docker compose up -dOne step is left, because no image ships with credentials:
docker compose exec codex-imagegen-mcp codex login --device-authFollow the printed URL and code to sign in with your ChatGPT account. The container reports ready within a few seconds:
docker compose exec codex-imagegen-mcp codex login statusNow connect a client. For Claude Code:
claude mcp add --transport http imagegen http://localhost:8080/mcpAny MCP client that speaks Streamable HTTP works the same way; the endpoint is
POST /mcp and there is no session handshake.
Ask for an image and you get back a URL served by the same container. Stop it
with docker compose down; add -v to throw away the sign-in and the images
too.
The tools
Tool | What it does |
| Generates one image. Waits by default and reports progress; |
| Applies a change to an existing artifact as a NEW version. Never overwrites. |
| Turns a still artifact into a looping animated WebP plus a GIF fallback (spin, pulse, shake, bounce, float) as a NEW version. No Codex run, no quota. |
| Stores an image of your own for the other tools: inline base64 up to 700 KB, or a presigned POST target for up to 20 MB. Pass the |
| queued, running, completed, failed or cancelled, plus the artifact URL when done. |
| Artifact metadata and URL. Omit the version for the latest. |
| Cancels a queued or running job. |
For animated web graphics, ask for each independently moving object in its own
create_image call with isolated_object: true. A single combined scene
cannot be split into layers afterwards.
Growing beyond one container
The same image runs three ways, chosen by the ROLE environment variable.
all is the default and does everything in one process. mcp and worker
split the endpoint from the Codex process, which lets you restart or scale the
endpoint without touching the session that holds your ChatGPT sign-in.
Splitting needs a shared queue and shared storage, because two processes share
neither memory nor a local disk. Set REDIS_URL and the S3_* variables and
they replace the in-process queue and the local artifact directory. Each is
independent: storage can move to S3 while the queue stays in the process.
Kubernetes
helm install imagegen ./charts/codex-imagegen-mcp \
--namespace imagegen --create-namespace \
--set publicBaseUrl=https://mcp.example.comThat is one pod, one volume for the sign-in and one for the images. Then sign in once inside the pod, the same way as above. See charts/codex-imagegen-mcp/README.md and docs/deployment-kubernetes.md.
The MCP endpoint authenticates nobody. Anything that can reach it can spend your ChatGPT quota. Keep it inside your network, or put an authenticating proxy in front.
Image
Published to GitHub Packages on every v* tag, public, no login needed:
docker pull ghcr.io/tinyorbitvn/codex-imagegen-mcp:latestDocumentation
Architecture — what runs where, and why it can be one process
Configuration — every environment variable
Codex authentication — the sign-in, where it lives, how to renew it
Development
One npm package, no workspaces.
npm ci
npm run typecheck
npm test
docker build -t codex-imagegen-mcp:dev .License
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models and 10 tools: up to 4 images per call, SVG vectorization, editing and more. Remote MCP with OAuth, no API keys. Pay per image, no subscription.
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models. Up to 4 images per call, SVG vectorization, background removal, upscaling and image-to-video. Remote MCP with OAuth, no API keys.
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.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceThis MCP server enables image generation via Codex CLI and an OpenAI-compatible relay API, with job queue, status polling, and preview/download endpoints. It is a single-user local demo without authentication or persistence.-
- AlicenseAqualityCmaintenanceEnables MCP clients to generate and edit images through Codex's built-in image generation using a ChatGPT login, returning final files with metadata and optional inline previews.4MIT
- AlicenseAqualityAmaintenanceEnables any MCP client to generate and edit images through ChatGPT's Codex backend, saving them locally with no API key or per-image billing.5150 npm8Apache 2.0
- AlicenseAqualityCmaintenanceLets Claude Code or any MCP client generate images through the official Codex CLI using an existing ChatGPT plan login, with no API key or separate billing. Supports prompt-driven generation with base and reference images, writing results to a chosen path.1MIT