Skip to main content

codex-images-mcp

Generate and edit images from any MCP client with gpt-image-2 on the ChatGPT plan you already pay for. No OpenAI API key, no per-image bill.

codex-images-mcp is an MCP server for the Codex Images endpoint. It runs locally over stdio, or as a self-hosted HTTP server that your laptop, your VPS agents and your Pi / Gentle Shell sessions can share. Every image comes back as a verifiable artifact: SHA-256, byte count, MIME type and real dimensions.

Unofficial. Not affiliated with or endorsed by OpenAI. It signs in with your own ChatGPT account and uses the same endpoint as the Codex CLI. You are bound by OpenAI's terms for your account, and image generation counts against your plan's limits.

What you get

  • Two tools: codex_images (generate/edit) and codex_images_artifact (fetch an image by URI, inline or through a short-lived signed download).
  • Batches: parallel, variants, chain and branded-parallel (every image references a shared anchor for brand-consistent sets).
  • Edits with references and masks: up to five references per request, HTTPS URLs or inline images.
  • Native transparency: real alpha PNGs from the model, with a warning when a result comes back opaque.
  • Exact output sizes: native, exact, fit or cover post-processing, so a 1200×630 card is 1200×630.
  • Prompts sent verbatim: no hidden rewriting model in between.
  • Optional API-key engine: set CODEX_IMAGES_ENGINE=api with an OPENAI_API_KEY to choose the model yourself (Images 2.6 gpt-image-2.6-sunburst / -flare), with quality up to max and complexity control. This engine is billed to your API account. On the default ChatGPT plan route OpenAI chooses the model, and the API selectors (model, quality, complexity) are ignored.
  • Self-hosting that is safe by default: built-in bearer auth, refuses to listen publicly without a token, SSRF-hardened URL fetching (HTTPS, public addresses only, pinned IP, no redirects), no server paths in results.
  • Its own ChatGPT session: codex-images-mcp login uses a device code and keeps a separate session, so it never rotates (and breaks) your Codex app's sign-in.

Quick start (local, stdio)

uvx --from codex-images-mcp codex-images-mcp login     # sign in once (device code)
uvx --from codex-images-mcp codex-images-mcp setup     # register in Claude Code, Claude Desktop, Codex, Cursor, OpenCode

Or try it from the terminal:

uvx --from codex-images-mcp codex-images-mcp generate "a ceramic mug, studio light" --transparent --pretty

Already signed in to the Codex CLI? codex-images-mcp can use that login read-only until its token expires. It never refreshes it; run login for a session of its own.

Self-hosted (HTTP)

export CODEX_IMAGES_HTTP_TOKEN=$(openssl rand -hex 32)
docker compose up -d
docker compose run --rm codex-images codex-images-mcp login

Then point your clients at https://your-host/mcp/ with Authorization: Bearer $CODEX_IMAGES_HTTP_TOKEN. See docs/self-hosting.md for the reverse proxy, signed downloads and every setting.

Pi and Gentle Shell

pi-codex-images is a Pi extension for a self-hosted server. It reads the local files you authorize, sends them inline, and writes verified results atomically into your project:

pi install npm:pi-codex-images

Documentation

  • MCP tools reference: inputs, results, error codes.
  • CLI: generate, login, logout, setup, status, uninstall.
  • Self-hosting: Docker, reverse proxy, configuration, security model.
  • Examples: batches, edits, masks, transparency, exact sizes.
  • Comparison: how this differs from similar projects.

Credits

codex-images-mcp started as a fork of VelmoAI/codex-imagen by wauwa. The installer and much of the original structure come from there. The OAuth token handling derives from codex-image-gen by Small Turtle 2. The generation engine was replaced with the native Codex Images endpoint, and the prompt-rewriting and chroma-key layers were removed.

License

MIT. See LICENSE and NOTICE.

Metadata

Release files for codex-images-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codex-images-mcp 0.1.0
File Size Uploaded Provenance Actions
codex_images_mcp-0.1.0.tar.gz 85.9 kB With provenance Details for codex_images_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codex-images-mcp 0.1.0
File Interpreter ABI Platform Actions
codex_images_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for codex_images_mcp-0.1.0-py3-none-any.whl

Total release size: 130.3 kB

Release files / codex_images_mcp-0.1.0.tar.gz

Download URL codex_images_mcp-0.1.0.tar.gz
Size 85.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8e6c69dcc1a8b982e71b1ff12746c0b4b0caba1eff83b1158ebe1935911533c9
BLAKE2b-256 checksum
How to use checksums
1fc988569475668294af33d88a50d829a9c70ba6d2d4ba99f2cf2a23e4617006
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / codex_images_mcp-0.1.0-py3-none-any.whl

Download URL codex_images_mcp-0.1.0-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
535cdd4a1d563593de269e0b310f1a807ea6f7c041cd03a8c9e04d5a5077a9b8
BLAKE2b-256 checksum
How to use checksums
22f965ac2da16f5a053dd5b5dfbbe9abe5833da55eba80689836e19de942b465
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for codex-images-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codex_images_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page