codex-imagegen-mcp

v0.2.3
codex-imagegen-mcp Checked 5 days ago Published 1 month ago

MCP server + Agent Skill that brings OpenAI Codex's image generation to your coding tools, with a one-command installer for opencode, Claude Code, Codex…

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

generate_image Generate image

Generate a new raster image (photo, illustration, texture, sprite, mockup, icon, product shot…) from a text prompt, using the user's ChatGPT plan — the same image service as OpenAI Codex's built-in image tool, no API key. Saves the full-resolution file and returns its path plus a preview. The service chooses resolution and quality; steer orientation with aspect_ratio or in the prompt. Use background="transparent" for assets that need real alpha. Typically takes 15-60 s.

ParameterTypeDescription
prompt *stringFull image description. Structure it: use case, subject, style/medium, composition, lighting, palette, exact text in quotes, constraints/avoid.
aspect_ratiostringCanvas shape: auto (default), 1:1, 4:5, 5:4, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9 or 9:21. The service chooses the exact pixel size from the prompt; this adds an explicit aspect-ratio line to it.
backgroundstringBackground: "transparent" returns a PNG with a real alpha channel (cutouts, sprites, icons, stickers, logos); "opaque" asks for a filled background (a hint — also describe the backdrop in the prompt…
include_previewbooleanAttach a downscaled preview so you can check the result visually (default true). Set false to save tokens.
nintegerNumber of variants of this same prompt, 1-4 (default 1). Each variant is a separate request against the user's ChatGPT image quota. For several different assets make one call per asset instead.
output_formatstringFile format: png (default) or jpeg (converted locally; cannot be transparent). Inferred from output_path's extension when given.
output_pathstringWhere to save: a .png/.jpg/.jpeg file path or a directory, absolute or relative to the workspace root. Omit to save in the server's image library (outside the project). Existing files are never replac…
overwritebooleanReplace an existing file at output_path (default false).

edit_image Edit image

Edit or transform existing images, or create a new image guided by reference images, using the user's ChatGPT plan (no API key). Pass 1-5 images; refer to them in the prompt as Image 1, Image 2… (Image 1 is the primary edit target). State exactly what must change AND what must stay unchanged. Good for background replacement or removal, object removal/insertion, restyling, relighting, text localization, compositing and sketch-to-render. The input file is never modified; the result is saved as a new file.

ParameterTypeDescription
images *array1-5 input images: local file paths (absolute, ~/…, or relative to the workspace root), http(s) URLs, or data:image/…;base64 URLs. PNG, JPEG or WebP, up to 15 MB each.
prompt *stringEdit instructions, e.g. "Image 1: replace only the sky with a warm sunset; keep the building, people and framing unchanged."
aspect_ratiostringCanvas shape: auto (default), 1:1, 4:5, 5:4, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9 or 9:21. The service chooses the exact pixel size from the prompt; this adds an explicit aspect-ratio line to it.
backgroundstringBackground: "transparent" returns a PNG with a real alpha channel (cutouts, sprites, icons, stickers, logos); "opaque" asks for a filled background (a hint — also describe the backdrop in the prompt…
include_previewbooleanAttach a downscaled preview so you can check the result visually (default true). Set false to save tokens.
nintegerNumber of variants of this same prompt, 1-4 (default 1). Each variant is a separate request against the user's ChatGPT image quota. For several different assets make one call per asset instead.
output_formatstringFile format: png (default) or jpeg (converted locally; cannot be transparent). Inferred from output_path's extension when given.
output_pathstringWhere to save: a .png/.jpg/.jpeg file path or a directory, absolute or relative to the workspace root. Omit to save in the server's image library (outside the project). Existing files are never replac…
overwritebooleanReplace an existing file at output_path (default false).

remove_background Remove flat background (chroma key)

Locally remove a flat, solid-color background from a PNG/JPEG and save a transparent PNG — no network, no quota. Use for images with a uniform backdrop (e.g. generated "on a flat pure #00ff00 background"), or to clean up a cutout. The key color is sampled from the image border unless key_color is given. Prefer background="transparent" on generate_image/edit_image when creating new assets.

ParameterTypeDescription
input_path *stringPNG or JPEG to process (absolute or relative to the workspace root).
despillbooleanRemove key-color fringe/spill on edge pixels (default true).
edge_contractintegerShrink the matte by this many pixels before feathering, 0-16 (default 0).
edge_feathernumberBlur radius for softened alpha edges, 0-64 (default 0).
include_previewbooleanAttach a downscaled preview so you can check the result visually (default true). Set false to save tokens.
key_colorstringBackground color to remove as hex, e.g. #00ff00. Default: auto-detected from the image border.
opaque_thresholdnumberSoft matte: color distance at or above which pixels stay fully opaque (default 96).
output_pathstringDestination .png (default: <input>-transparent.png next to the input). Never overwrites unless overwrite=true.
overwritebooleanReplace an existing file at output_path (default false).
soft_mattebooleanSmooth alpha ramp for anti-aliased edges (default true). false = hard key using tolerance.
toleranceintegerHard-key per-channel tolerance 0-255 (default 12; used when soft_matte=false).
transparent_thresholdnumberSoft matte: color distance at or below which pixels become fully transparent (default 12).

auth_status Sign-in and quota status

Show whether image generation is signed in, which ChatGPT account/plan and credential source is used, and the current usage-limit windows. Costs no image quota. Call this when a tool reports an auth or quota problem, or after sign_in.

ParameterTypeDescription
check_usagebooleanAlso fetch current usage/quota from ChatGPT (default true).

sign_in Sign in with ChatGPT

Start signing this image server in to the user's ChatGPT account (required once before generating, unless an existing Codex/opencode ChatGPT sign-in is detected). Returns a link (browser method) or a code (device method) that the USER must open or enter — relay it verbatim. Sign-in completes in the background; afterwards call auth_status to confirm.

ParameterTypeDescription
forcebooleanStart a new sign-in even if already signed in (e.g. to switch accounts). Default false.
methodstring"browser" (default): the user opens a link on THIS machine (redirects to localhost:1455). "device": the user enters a code at auth.openai.com/codex/device from any device — use for remote/headless m…
open_browserbooleanTry to open the link in the local browser automatically (browser method; default true).