
Codex / OpenAI Image
io.github.meet30997由 GitHub 帳號 meet30997 發布v0.1.2更新於 Oct 30, 2026
Generate, edit and make matching sets of images with the Codex CLI or the OpenAI Images API
概覽
本機 MCP 伺服器,讓助理透過 Codex CLI 或 OpenAI Images API 生成、編輯圖片,並製作風格一致的成套圖片。
- 可以做什麼
- 依提示詞生成圖片,可指定尺寸、變體數量、透明背景與風格參考圖
- 依提示詞編輯既有圖片,支援遮罩與輔助參考圖,原圖不會被修改
- 一次呼叫產生多張共用同一風格的具名圖片,存到指定資料夾
- 回傳儲存路徑與縮圖預覽,方便助理查看結果後繼續調整
- 為每張圖片寫入記錄提示詞與設定的 JSON 附屬檔
- 適用情境
- 適合在對話中請助理建立或修改圖片,例如部落格首圖、應用程式圖示、貼紙套組,或把照片改成夜景之類的編輯,並在反覆調整前先看到結果。
- 執行需求
- 需要 Node.js 20.3 或更新版本,透過 npx 在本機執行。以 IMAGEGEN_PROVIDER 選擇後端:codex-cli 需已登入的 Codex CLI 與含圖像生成的 ChatGPT 方案;openai-api 需 OPENAI_API_KEY;mock 不需任何條件。選用設定包括 IMAGEGEN_OUT_DIR、IMAGEGEN_READ_ROOT、IMAGEGEN_OPENAI_MODEL 與 IMAGEGEN_TIMEOUT_SEC。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codex / OpenAI Image,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
codex-openai-image-mcp
[npm version] [Codex / OpenAI Image MCP on mcprush]
An MCP server that lets Claude (and any other MCP client) generate images, edit them, and make matching sets, then look at the result and keep going.
It works with two image backends:
- Codex CLI: uses the ChatGPT plan you already have through the Codex CLI. No API key, no per-image bill.
- OpenAI Images API: uses an
OPENAI_API_KEY, for people without Codex.
Not affiliated with or endorsed by OpenAI. "OpenAI" and "Codex" are trademarks of OpenAI.
Both examples are real, unretouched output from the Codex backend.
What makes it different
- Matching sets.
generate_setmakes several different images that share one style, each saved under its own name. - Two backends, one interface. Switch between Codex and the OpenAI API with one setting.
- Made for an agent loop. Every call returns small previews that Claude can see, reports
progress during long runs, can be cancelled, and writes a
.jsonsidecar with the prompt and settings next to each image. - Careful with your files. It writes only inside its output folder, never overwrites an existing file, never changes the image you edit, and runs Codex read-only in an empty temporary folder.
Quick start
You need Node.js 20.3 or newer, plus one of:
- the Codex CLI, signed in (
codex login) with a ChatGPT plan that includes Codex image generation, or - an OpenAI API key with credits.
Claude Code
Claude Desktop, Cursor and other clients
Add this to the client's MCP config (for Claude Desktop, claude_desktop_config.json):
For the API backend use "IMAGEGEN_PROVIDER": "openai-api" and add "OPENAI_API_KEY".
Then just ask:
- "Make a watercolour fox for my blog header, 1536x864."
- "Edit photo.png so it looks like a sunset."
- "Make 5 matching app icons: home, search, profile, settings, bell."
Images are saved in ./generated-images in the folder the client was started from.
Tools
generate_image
edit_image
generate_set
All tools crop and resize the result to exactly the size you ask for, and return the saved paths with a 512 px preview of each image.
Backends
mock draws placeholder images, for trying the server out and for tests.
Codex backend. Each call runs
codex exec --json --skip-git-repo-check --sandbox read-only --cd <empty temp folder> [--image=<file>…] -- -
with a prompt that asks Codex to call its built-in image_gen tool and nothing else. The server
reads the session id from Codex's JSON events and collects the images from
$CODEX_HOME/generated_images/<session id>/. Codex never gets write access or sees your project
beyond the images you pass it. Cancelling the request, or hitting the timeout, stops Codex.
Check OpenAI's terms for scripted use of the Codex CLI with your plan.
OpenAI backend. Uses the official openai SDK. The default model is
gpt-image-2.5-sunburst; set IMAGEGEN_OPENAI_MODEL=gpt-image-2.5-flare for faster results. Sizes
are rounded to ones the API accepts, then resized to yours. This backend is covered by automated
tests against a mocked client; it has not yet had a full live test.
Settings
Files and safety
- Output is written only inside
IMAGEGEN_OUT_DIR. Absolute paths,..and symlinks that lead outside are rejected. - Input images (to edit, or as references) must be inside
IMAGEGEN_READ_ROOT. - Existing files are never overwritten: a new file gets
-2,-3, … instead. - Each image gets a
<name>.jsonsidecar with the prompt, backend, model, size, inputs and time. - API keys are read from the environment only and never logged or written to sidecars.
IMAGEGEN_MAX_PER_CALLcaps how many images one call can make.
Images are AI-generated. You are responsible for how you use them, including platform rules on AI-generated content, and for not imitating real people or brands.
Development
To run a local build from Claude Code:
The tests run the Codex backend against a stand-in script (test/fixtures/fake-codex.mjs) and the
OpenAI backend against a fake client, so they are free and quick. PLAN.md has the
design notes and roadmap. Issues and pull requests are welcome.
License
來源:README.md,提交 ec83524
工具
0版本歷史
1- v0.1.2最新Oct 29, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分