codex-image-gen++
Provides tools for interacting with an OpenAI-compatible Images API, enabling model listing, image generation from prompts, image editing with reference images and optional masks, and job status retrieval via OpenAI-style endpoints.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-image-gen++list the image models, then make a square watercolor fox and save it to output/imagegen/fox.png"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codex-image-gen++
中文 · English
A small, local MCP server that connects Codex to your own OpenAI-compatible Image API. Configure the provider once; let Codex choose the model, prompt, parameters and workspace output filename for each task.
Windows · macOS · Linux | 中文 / English setup | MIT
Install
Requires Node.js 22.13 or newer (Node.js 24 LTS recommended), npm, and the Codex CLI. The desktop app can use the registered stdio MCP too. Install the CLI if you want automatic registration.
Install the built package from GitHub Releases:
npm install -g https://github.com/Anti2077/codex-image-gen-plus-plus/releases/latest/download/codex-image-gen-plus-plus.tgz
codex-image-gen-plus-plus initThe npm package registry is not required. The display name is codex-image-gen++; the repository, executable and MCP entry use codex-image-gen-plus-plus for naming compatibility.
Or build from source (Git required):
git clone https://github.com/Anti2077/codex-image-gen-plus-plus.git
cd codex-image-gen-plus-plus
npm ci
npm run build
npm link
codex-image-gen-plus-plus initKeep the source directory if installing with npm link. Registration uses absolute Node and CLI paths; rerun init if you move the installation or replace Node.
Related MCP server: smartapi-images
Setup
Choose 中文 / English.
Choose Import from CC Switch or enter an API base URL and hidden key manually. A root URL such as
https://api.example.combecomeshttps://api.example.com/v1; a custom path such as/gateway/v1is preserved.Fetch
/modelsto check connection and authentication. This step does not generate an image or incur image-generation charges. The provider may charge for API requests under its own policy.Choose whether to register with Codex. Setup invokes the official
codex mcp addcommand and updates the entry with this name. If Codex cannot be found, it prints a manual TOML entry.Copy the supplied paragraph into your Codex personalization instructions to prefer this MCP for images. Setup does not edit those instructions automatically.
Restart Codex or open a new chat after registration. No model or output directory is fixed in configuration.
Import the current CC Switch provider
Choose this option in init and accept the default ~/.cc-switch data directory, or enter your custom CC Switch directory. CODEX_IMAGE_GEN_CCS_DIR can override that default. The importer reads settings.json and opens cc-switch.db read-only. The local currentProviderCodex selection takes priority; if missing/stale, a single database is_current Codex provider is used. It parses only the selected provider's settings_config, using the active TOML model-provider table for the base URL and its API key configuration. It does not guess another table or select the first saved provider.
The key is imported without displaying it, then the normal /models connection check runs. This is a one-time copy into this tool's own private config: later CC Switch changes do not automatically switch your image provider. Rerun init to import again. No CC Switch files are changed. API-key providers are supported; ChatGPT OAuth tokens and proxy placeholder keys are not imported. If import fails, setup offers manual entry. Older JSON-only CC Switch databases are not supported. Node.js 22 may print its built-in SQLite experimental notice during import.
Example request to Codex:
Use codex-image-gen++ to list the available image models, choose one, and create a square watercolor fox illustration. Save it in this workspace's output/imagegen/ directory and show the result.
Codex should call list_models and pass the exact model ID. Provider-visible model IDs and name hints do not establish generation permission, pricing, quality or speed. Names such as flare and sunburst are passed through without assumed rankings or aliases.
MCP tools
Tool | Purpose |
| Fetch visible model IDs, with an optional substring filter and image-name hints. |
| Submit a generation request and save the result to an absolute local filename. |
| Submit local reference images and an optional mask as multipart data. |
| Retrieve an existing job; optionally wait up to 20 seconds. Never submits another request. |
Generation/edit arguments: model, prompt, output_path; optional size, quality, background, n (1–4). Edits also take input_paths (1–16) and optional mask_path. Provider limits may be lower.
Output extension .png, .jpg / .jpeg, or .webp sets output_format. Existing files are never overwritten. With n: 2 and output_path: /absolute/workspace/output/imagegen/fox.png, files are fox-1.png and fox-2.png. Output reports measured dimensions, bytes, SHA-256, and whether a requested explicit size matches. Dimensions come from image headers, not a complete image-decoding check; Codex should inspect the saved image.
Use absolute paths inside the current workspace. The MCP process's working directory may differ from the chat's workspace. Codex chooses the destination and the server writes the bytes directly, returning paths and metadata instead of large Base64 blobs. This local MCP has the filesystem permissions of the account running it; absolute paths are required, but workspace containment is an agent instruction, not an enforced filesystem sandbox.
Long requests and failures
Images run in a detached local Node worker. The initial tool call waits up to 15 seconds, then returns a job ID if still pending, keeping ordinary MCP calls below the default timeout. Use get_job rather than submitting again. Jobs continue through an MCP disconnect while the worker and computer remain running.
No automatic request retries, model fallback, or protocol guessing. A network timeout may occur after the provider accepted a paid request; inspect the job, output files and provider logs before deciding to submit again. Failed jobs include a code, outcome_unknown, provider request ID when available, and any successfully saved partial files. A worker interrupted by shutdown/crash is reported as interrupted; it is not resumed automatically. A hard worker crash can leave empty reserved files that need manual inspection/removal.
Provider compatibility
The initial implementation supports the OpenAI-compatible Images API:
GET {baseUrl}/modelsPOST {baseUrl}/images/generationswith JSONPOST {baseUrl}/images/editswith multipart (imagefor one input,image[]for multiple inputs)data[].b64_json,data[].url, ordata[].image_urlstring responses
It is not a universal adapter for every image provider. APIs requiring Responses-only tools, custom job/polling endpoints, OAuth, or proprietary request bodies need a future adapter. Providers must support output_format or return an image format that matches the requested extension. Optional size/quality fields are sent only when supplied; quality values are not limited to an old fixed model list.
API URLs require HTTPS, with HTTP allowed for loopback development. API authentication never follows redirects. Returned image URLs may contain signed queries and follow up to five redirects, without forwarding your provider API key. Response limits are 50 MiB per image and 192 MiB per generation JSON response.
Configuration and privacy
System | Default config file |
Windows |
|
macOS |
|
Linux |
|
The API key is stored as plaintext in the local config file, not in the project or Codex TOML. POSIX directories/files are created with modes 700/600; Windows uses inherited user-directory ACLs. There is no keychain integration. Keep the file private.
Optional environment overrides: CODEX_IMAGE_GEN_CONFIG (absolute config path recommended), CODEX_IMAGE_GEN_BASE_URL, CODEX_IMAGE_GEN_API_KEY. Do not put keys in terminal command arguments, source control, or chat. The default provider timeout is 600 seconds; timeoutSeconds in config accepts 1–3600.
Jobs are stored beside config under jobs/, containing prompts, input/output paths, status and metadata, without copying the API key. They persist until you delete them; remove completed job JSON files when no longer needed. Images and prompts are sent to your configured provider; signed result URLs are fetched locally. This project has no analytics endpoint.
Commands
codex-image-gen-plus-plus init
codex-image-gen-plus-plus models image
codex-image-gen-plus-plus doctor
codex-image-gen-plus-plus instructions zh-CN
codex-image-gen-plus-plus instructions en
codex-image-gen-plus-plus job <job-id>doctor checks /models, not a paid generation. Rerun init to change the provider or key. On PowerShell, if script execution policy prevents npm command shims, use codex-image-gen-plus-plus.cmd init instead.
To disconnect, run codex mcp remove codex-image-gen-plus-plus. Remove the config/jobs directory separately if you want to delete the stored key and history. Uninstall a global package with npm uninstall -g codex-image-gen-plus-plus.
Development
npm ci
npm run check
npm run build
npm packCI builds and checks the CLI/package on Windows, macOS and Linux with Node.js 22 and 24. This does not establish compatibility with every third-party provider. Real generation consumes your provider credits and is not part of setup or CI.
Acknowledgements
See THIRD_PARTY_NOTICES.md for related open-source projects and the official MCP SDK. Original implementation; MIT licensed.
Available Tools
4 toolsedit_imageA
Edit local images using the provider multipart Images Edits API. Saves to a new absolute path; preserves originals. Optional mask follows provider semantics. Poll returned job ID with get_job.
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images; defaults to 1. May increase provider charges. | |
| size | No | Provider-supported size: auto or WIDTHxHEIGHT. Omit to use the provider default. Actual dimensions are returned. | |
| model | Yes | Exact model ID from list_models. Never invent or silently replace it. | |
| prompt | Yes | ||
| quality | No | Provider-supported quality, e.g. auto, low, medium, high, xhigh, max. Omit unless needed; availability varies by model. | |
| mask_path | No | Absolute local mask path. Follow provider requirements for transparency, dimensions and format. | |
| background | No | ||
| input_paths | Yes | Absolute paths to 1–16 local PNG/JPEG/WebP reference images; provider limits may be lower. | |
| output_path | Yes | Absolute output filename inside the current user workspace. Prefer output/imagegen/. Extension .png, .jpg, .jpeg or .webp selects output_format. Existing files are never overwritten. For n>1, -1, -2, etc. are appended. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Adds real behavioral context beyond annotations: originals are preserved, output goes to a new absolute path, and the call returns a job ID requiring polling via get_job. Annotations already cover readOnly/destructive/idempotent, so the description's job is supplementary and it delivers async-job and non-overwrite behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four tightly packed sentences, each carrying a distinct fact (API used, output/preservation behavior, mask note, polling instruction). Fully front-loaded with no waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For an async, 9-parameter, open-world image-edit tool with no output schema, the description covers the key agent needs: it is async, results come via job ID, originals are safe, and where output lands. It could mention cost/charge implications (n increases charges, per schema) but the essentials are present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 78%, above the threshold where the schema does the heavy lifting. The description adds only a hint about mask semantics, not compensating detail beyond the schema's already-rich parameter docs.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (Edit) and resource (local images), names the underlying API used, and distinguishes itself from generate_image by the editing/mask semantics. An agent can tell precisely what this does.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description routes the agent forward: 'Poll returned job ID with get_job' tells the agent what to do after invocation, and mentions optional mask usage. It does not explicitly contrast with generate_image (when to edit vs generate), which is the main gap.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_imageA
Submit one paid image-generation request and save bytes locally. Returns paths/metadata or a job ID to poll with get_job. Never automatically resubmit after timeout/failure. Existing files are protected.
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images; defaults to 1. May increase provider charges. | |
| size | No | Provider-supported size: auto or WIDTHxHEIGHT. Omit to use the provider default. Actual dimensions are returned. | |
| model | Yes | Exact model ID from list_models. Never invent or silently replace it. | |
| prompt | Yes | ||
| quality | No | Provider-supported quality, e.g. auto, low, medium, high, xhigh, max. Omit unless needed; availability varies by model. | |
| background | No | ||
| output_path | Yes | Absolute output filename inside the current user workspace. Prefer output/imagegen/. Extension .png, .jpg, .jpeg or .webp selects output_format. Existing files are never overwritten. For n>1, -1, -2, etc. are appended. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnly=false, idempotent=false, openWorld=true and destructive=false, so the safety profile is covered. The description adds genuinely new context beyond that: the request is paid, retries are not automatic after timeout/failure, and 'existing files are protected'. It does not cover auth/permission requirements, but the marginal behavioral value is solid.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four short sentences, front-loaded with the action and cost implication, then output behavior, then the retry rule and file-protection guarantee. Nothing is padded or redundant.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description helpfully characterizes the return ('paths/metadata or a job ID to poll with get_job') and covers cost, non-resubmission and file safety. For a 7-parameter paid mutation tool this is close to complete; the only gap is explicit prerequisite/alternative routing relative to edit_image and list_models.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 71%, so the schema already documents model, prompt, output_path, n, size and quality in meaningful detail (format constraints, charge implications, provider defaults). The description adds no parameter-level syntax or defaults of its own. Baseline 3 is appropriate when the schema is doing the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Submit one paid image-generation request and save bytes locally', which an agent can distinguish from a sibling like edit_image by the generation-vs-edit framing. It also routes polling to get_job. It stops short of explicitly naming the alternatives it is not (edit_image, list_models), so it is clear but not fully sibling-differentiating.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
'Returns paths/metadata or a job ID to poll with get_job' gives real routing guidance, and 'Never automatically resubmit after timeout/failure' bounds retry behavior. However, there is no explicit statement of when to choose this over edit_image, nor any precondition (e.g., model must first come from list_models). Usage is implied rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_jobARead-only
Query an existing image job without submitting or retrying. Jobs survive MCP disconnects while the local worker is alive. On interrupted/unknown outcome, inspect output paths/provider logs before considering another paid request.
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | ||
| wait_seconds | No | Wait up to 20 seconds for completion; defaults to 0. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already establish the safety profile (readOnlyHint=true, destructiveHint=false, openWorldHint=false), so the bar is lower. The description adds genuine non-obvious behavior: jobs persist across MCP disconnects while the local worker lives, and interrupted jobs may still have usable outputs on disk. It omits what an invalid or expired job_id yields and how status is reported.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences with the purpose front-loaded and no filler; each sentence carries a distinct payload (scope, durability, failure handling). Minor cost: the durability and failure-handling sentences blend behavioral fact with procedural advice, which slightly muddies the structure.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema exists, so the description is the only source for return shape, yet it never enumerates what a job query returns (status values, output paths, error fields) beyond alluding to 'output paths/provider logs'. For a two-parameter read tool with annotations covering safety, the coverage is adequate but leaves the agent guessing at response interpretation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is exactly 50%: wait_seconds carries a full description, job_id carries none, and the tool description adds no parameter guidance for either. The undocumented parameter is a self-evident required identifier and the description's 'existing image job' framing gives it meaning, so this lands at the baseline rather than below it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Query an existing image job') and immediately bounds the scope with 'without submitting or retrying', which implicitly separates it from the submit-style siblings generate_image and edit_image. It stops short of naming those siblings, so an agent must infer the contrast rather than being told it.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives clear when-to-use context (polling an already-submitted job) and a concrete decision rule for the hard case: on interrupted/unknown outcome, inspect output paths/provider logs 'before considering another paid request'. It does not explicitly say 'use generate_image to start a job', but the exclusion of submitting/retrying covers the alternative in practice.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_modelsARead-only
List models visible to the configured provider API key. Does not generate images or prove generation permission. image_candidate is only a name heuristic.
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Optional case-insensitive substring filter. Omit to see all IDs. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already cover the safety profile (readOnlyHint, destructiveHint=false, openWorldHint), so the bar is lower, and the description adds real context: results are scoped by the configured API key, listing models does not establish generation entitlement, and image_candidate is only a name heuristic rather than a verified capability.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences, front-loaded with the tool's action and scope, with no redundant restatement of the name. Slightly telegraphic in the second and third sentences, but each contributes a distinct caveat.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description usefully discloses that returned models carry an image_candidate field and that it is a name-based heuristic only. Scope, auth dependency, and the generation caveat are covered; pagination or result-size behavior is not mentioned, a minor gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The single filter parameter is fully documented in the schema (100% coverage, including case-insensitivity and the omit-to-see-all behavior), so the schema carries the meaning. The description adds no syntax or format detail about filtering; its only field-level remark concerns image_candidate, which is a returned value, not an input.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('List models') plus the scope that governs the result set ('visible to the configured provider API key'). It explicitly distinguishes itself from the sibling generate_image by stating it 'does not generate images,' so an agent can separate discovery from generation without opening either schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The negative clause 'does not generate images or prove generation permission' tells the agent when NOT to reach for this tool and points the task toward generate_image. There is no positive framing such as 'use this first to discover model IDs before calling generate_image,' so the routing is inferable rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
edit_image - First observed
generate_image - First observed
get_job - First observed
list_models
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: list_models (discovery), generate_image (create), edit_image (modify), and get_job (poll). The descriptions explicitly disambiguate similar-sounding operations, e.g. generate_image vs. get_job and the warning that list_models doesn't prove generation permission.
All four tools follow a consistent verb_noun snake_case pattern (list_models, generate_image, edit_image, get_job). No mixing of conventions or vague verbs.
Four tools is a tight, well-scoped set for an image generation/editing server, with each tool earning its place. It's slightly lean, as there's no cancel or list-jobs operation.
The core lifecycle is covered: discover models, generate, poll job status, and edit images. Minor gaps remain around job management (no cancel_job or list_jobs), but agents can work around them.
Maintenance
Related MCP Connectors
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
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.
- MorphedOAuthapp.morphed
Create AI images and videos, manage projects and credits, and use workspace campaign context.
The image pipeline for agents: presets, assets and jobs. Answers with asset ids and stable URLs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables generating images from text prompts using OpenAI's GPT-Image-2 model within Claude Code and Codex conversations.1-
- AlicenseAqualityCmaintenanceEnables generating images through SmartAPI's image generation endpoint directly from Codex, saving files locally.1MIT
- FlicenseAqualityCmaintenanceEnables generating and editing images through OpenAI image models, with configurable output as saved files or returned URLs.2-
- FlicenseNot gradedqualityCmaintenanceEnables AI image generation, editing, upload, and local download through CloseAI's gpt-image-2 service, allowing MCP-compatible clients like Codex to manage images with configurable models, sizes, and quality.-