
Image Gen
com.nuverlabs由 nuverlabs.com 發布v0.2.1更新於 Oct 24, 2026
Generate and edit images from your coding agent with Gemini and OpenAI, using your own API keys.
概覽
一個本機 MCP 伺服器,讓程式開發助理使用你自己的 Gemini 或 OpenAI API 金鑰產生與編輯圖片,並把檔案存到專案中。
- 可以做什麼
- 依文字提示產生圖片,可選擇服務商、模型、長寬比、數量、品質、背景與尺寸,存到指定路徑或目錄並回傳絕對路徑。用文字指令編輯或合成既有圖片,最多使用 16 張來源圖,且不會覆寫原圖。回報已設定的服務商、預設模型、輸出目錄的備援順序以及目前生效的目錄限制。
- 適用情境
- 適合讓助理在專案內直接產出部落格封面、標誌、圖示、佔位插畫或圖片變體,再讀取存下的檔案繼續調整。也適合已持有 Gemini 或 OpenAI API 金鑰、希望用同一介面呼叫兩家的使用者。
- 執行需求
- 以 npm 套件形式透過 npx 在本機執行,需要 Node.js。伺服器環境中必須至少設定 GEMINI_API_KEY 或 OPENAI_API_KEY 其中之一,兩者各自可選。選用設定包括預設服務商與模型、輸出目錄、允許目錄、逾時與日誌檔。需要連線至服務商 API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Image Gen,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
image-gen-mcp
Generate and edit images from your coding agent, with your own API keys. Ask for a blog cover, a logo tweak, or a placeholder illustration, and the file lands directly in your project where the agent can read it and iterate.
Google Gemini image models (the Nano Banana family) and OpenAI GPT image models behind one interface. Configure one provider or both.
[A terminal window emitting a gradient ribbon that resolves into three generated image thumbnails]
This banner and the repository's social preview card were both generated by
this server, with gemini-3.1-flash-image at 16:9 2K. Prompts are in
assets/README.md.
Install
Start a new Claude Code session to pick it up, then check claude mcp list.
Three things that trip people up:
- At least one option must sit between the last
--envand the server name. Above,--scopedoes that job. Put the name straight after an--envpair and the CLI reads it as anotherKEY=value. --before the command is mandatory. Without it the server's own arguments get parsed as Claude Code's.- Drop the
--envline for any provider you do not use. You need at least one.
Get keys from Google AI Studio and the OpenAI platform.
Other clients
Same package everywhere. For .mcp.json (project scope, commit it) and Claude
Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
Claude Code also accepts a per-server "timeout": 600000, which Claude Desktop
does not. Cursor uses the same shape in .cursor/mcp.json. On Windows, GUI hosts
cannot always find npx, so use "command": "cmd" with
"args": ["/c", "npx", "-y", "@nuver-labs/image-gen-mcp"].
Use it
Just ask, in plain language:
- "Generate a 16:9 hero image of a lighthouse at dusk and save it to
assets/hero.png" - "Take
public/logo.pngand give it a transparent background" - "Create 3 variations of a flat paper airplane icon, square, into
design/drafts/"
The agent calls generate_image or edit_image with an absolute output_path
inside your project, the file lands on disk, and the agent can then read the saved
path to look at the result and refine it. If a call fails, ask it to run
list_capabilities to see what is actually configured.
Tools
generate_image
edit_image
Everything above, plus:
When output_path is omitted, the result is saved next to the first source image.
list_capabilities
No arguments. Reports configured providers as booleans (never key values), the default provider and models, known model options, the output directory fallback chain, and any directory restriction in force.
Configuration
With no output_path, files go to the first of: IMAGE_GEN_MCP_OUTPUT_DIR,
CLAUDE_PROJECT_DIR (set by Claude Code, points at the current project), the
server working directory.
Security
This server runs locally with your full user privileges and is not sandboxed by the MCP client. Worth understanding before you grant it blanket tool approval.
What it can do. Writes image files to disk. Reads the image files you point
edit_image at. Sends your prompt, and any edit_image source image, to the
provider you selected. Makes billable API calls. That is the whole surface: three
tools, no shell execution, no arbitrary URL fetching, no telemetry.
File access. The model chooses output_path and source_paths, and by
default they are unrestricted, because that is what makes the tool useful: your
agent saves into whichever project you are working in. Note that Claude Code's
working-directory boundary does not extend to MCP servers, and Anthropic
does not security-audit third-party MCP servers.
To draw a hard boundary, set IMAGE_GEN_MCP_ALLOWED_DIRS:
Every output path and every edit_image source must then resolve inside one of
those roots. Paths are compared after realpath resolution, so a symlink pointing
out of a root is refused, and containment uses path segments rather than a string
prefix, so a sibling directory like /Users/you/projects-private does not slip
through. If none of the configured entries exist, the server refuses all file
access rather than silently running unrestricted.
API keys. Keys are read only from the environment, passed to the provider SDK
constructors, and used nowhere else. They are never logged, never written to the
ledger, and never returned by list_capabilities, which reports booleans.
The risk is where you put them, not what this server does with them. Keys inlined
into ~/.claude.json or claude_desktop_config.json sit in plaintext, readable by
any process running as you, and an agent asked to read its own config can print
them into a transcript. Prefer exporting from a shell profile or a secret manager,
chmod 600 the config files, and use a dedicated key with a spend limit rather
than a shared production key.
Spend. There is no built-in rate limit or cap. An agent in a retry loop can generate a lot of images quickly. Set OpenAI hard spend limits and Google Cloud budget alerts.
Local log. The ledger at ~/.image-gen-mcp/images.jsonl contains a truncated
copy of each prompt in plaintext and grows without bound. Disable it with
IMAGE_GEN_MCP_LOG_FILE=none, and do not commit it.
Prompt injection. Tool results re-enter the model's context. Prefer per-call
approval over blanket-allowing this server, and glance at the output path and any
edit_image source path when approving. Pin a version and review the diff before
upgrading.
Found a vulnerability? See SECURITY.md. Please do not open a public issue.
Logging
Every successful call records one structured JSON entry, two ways:
- stderr, always: one
[image-gen-mcp] image {...}line, visible in/mcpoutput and Claude Code logs. - JSONL ledger, on by default: the same JSON appended to
~/.image-gen-mcp/images.jsonl, one line per call. Ledger write failures never break a generation, they warn once on stderr.
Each entry captures the provider, model, requested size, elapsed seconds, a truncated prompt with its full character count, token usage when the provider reports it, and per-image details: saved path, byte size, human-readable size, mime type, and actual pixel dimensions.
Costs
Every call hits a paid API, typically cents per image, varying by provider, model,
quality, and size. Cheap options for drafts: OpenAI quality: low (roughly $0.006
for a low-quality 1024x1024 on gpt-image-2) or gpt-image-1-mini, and Gemini
gemini-3.1-flash-lite-image. Gemini's gemini-2.5-flash-image may have a free
tier on unbilled keys, so IMAGE_GEN_MCP_GEMINI_MODEL=gemini-2.5-flash-image
makes it the default.
Timeouts
Generation takes roughly 10 to 120 seconds depending on model and size. Claude
Code's defaults are generous and this server sends progress notifications during
long calls, so no tuning is normally needed. If you set a tight global
MCP_TOOL_TIMEOUT, add a per-server "timeout": 600000 in .mcp.json.
Troubleshooting
- Server logs go to stderr with an
[image-gen-mcp]prefix. Claude Code surfaces them in/mcpoutput and its logs. - Registered but no tools: start a new session, then check
claude mcp listandclaude mcp get image-gen. Provider 'x' is not configured: that key is missing from the MCP server environment. Re-register with the--envflag or edit your config.- Output is outside the allowed directories:
IMAGE_GEN_MCP_ALLOWED_DIRSis set. Runlist_capabilitiesto see the roots. - Response too large:
return_imageinlines a full image and can exceed the MCP output token limit (MAX_MCP_OUTPUT_TOKENS, default 25k). Leave it off and let the agent read the saved file. - Gemini refusal: the error includes the finish reason and any provider text. Rephrase the prompt.
Build from source
Requires Node 22+ and pnpm.
Then point your client at node /abs/path/to/image-gen-mcp/dist/index.js instead
of npx -y @nuver-labs/image-gen-mcp.
Contributing
Bug reports, provider quirk fixes, and documentation improvements are welcome. See CONTRIBUTING.md. For anything larger, open an issue first.
Planned: OpenAI mask and inpainting support, migration off the legacy Gemini
generateContent image path to the Interactions API, and more providers.
License
Built by Nuver Labs.
來源:README.md,提交 fa70937
工具
0版本歷史
1- v0.2.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
