gen-image MCP
This MCP server generates and edits images locally via OpenAI-compatible or Gemini image APIs, saving files directly to your project directory.
Generate images from text using the
generate_imagetool (OpenAI Images API, e.g., gpt-image-2), with options for size, quality, count (1–4), output format (png/jpeg/webp), and model selection.Edit or combine local images using the
edit_imagetool (OpenAI Images edits endpoint, multipart), accepting up to 16 input images and an optional mask, with size/quality/model options.Generate or edit images via Gemini models using
generate_gemini_image(chat completions endpoint), supporting text-to-image or reference-image generation, optional aspect ratios (e.g., 16:9, 1:1), and up to 16 input images.List configured models with
list_models— returns available models per API group (images/gemini), default model, associated tools, and global auto-fallback setting (no network request).Customizable output paths — save to files or directories; supports AI-provided filenames with automatic conflict avoidance (numbered suffixes), auto-creates parent directories.
Automatic model fallback — configurable retry and switch to next model on capacity/rate-limit errors (with backoff) or other upstream failures; can be overridden per call.
Rich result metadata — returns saved paths, previews (≤2 MiB), resource URIs, model used, elapsed time, attempt counts, and structured content for programmatic handling.
Local resource access — list and read generated images via MCP resources (
resources/list,resources/read), without size limits.Input validation — rejects invalid model names, oversized files (max 50 MiB each, 16 images), and invalid output paths before making upstream requests.
Generates and edits images through OpenAI-compatible image generation and editing APIs, with support for multiple models and local file output.
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., "@gen-image MCPGenerate a red cube on a white desk with soft natural light and save it to exports/cube.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.
gen-image MCP
中文 | English
GitHub 项目:yuluo688/gen-image-mcp | 已登记 官方 MCP Registry
在 Claude Code、Cursor、VS Code 里一句话调用 GPT Image 或 Gemini(Nano Banana)生图、改图,图片直接存进项目目录;模型挂了自动切换到下一个。
为什么用它
图片直接落到项目里:保存在运行 MCP 的机器上,代码马上就能引用。
用自己的服务和 Key:任意 OpenAI 兼容的 Images 接口(
gpt-image-2、gpt-image-1.5等),或经 OpenAI 兼容网关提供的 Gemini 图像模型(Nano Banana 系列)。本项目不托管任何模型。失败自动切换:容量不足、限流先有限退避重试,再按顺序换下一个模型。
生图、参考图、改图全覆盖:文生图、参考图生成、多图编辑和蒙版,返回内联预览和
structuredContent。
Related MCP server: jgkme/kilo-image-gen-mcp
30 秒上手
需要 Node.js ≥ 20(推荐 24 LTS)。准备好 服务根地址(不带 /v1,服务会自动拼接 /v1/images/* 和 /v1/chat/completions)、API Key,以及至少一组模型。下面的模型名只是示例,请填写你的服务商实际提供的模型 ID;不用的那组请删掉对应变量,不要留空字符串。
Claude Code
claude mcp add --env GEN_IMAGE_BASE_URL=https://your-gateway.example \
--env GEN_IMAGE_API_KEY=your-api-key \
--env GEN_IMAGE_MODEL=gpt-image-2,gpt-image-1.5 \
--env GEN_IMAGE_GEMINI_MODEL=gemini-3.1-flash-image,gemini-2.5-flash-image \
--env GEN_IMAGE_AUTO_FALLBACK=true \
--transport stdio gen-image -- npx -y gen-image-mcp加 --scope user 可在所有项目中使用。注意最后一个 --env 和服务名之间要隔一个其他参数(如 --transport stdio)。
Cursor:
,安装后在
~/.cursor/mcp.json里把占位地址和 Key 换成真实值。VS Code:
(会弹窗让你输入地址和 Key)。
Claude Desktop / Cline / Windsurf 等使用 mcpServers 的客户端
{
"mcpServers": {
"gen-image": {
"command": "npx",
"args": ["-y", "gen-image-mcp"],
"env": {
"GEN_IMAGE_BASE_URL": "https://your-gateway.example",
"GEN_IMAGE_API_KEY": "your-api-key",
"GEN_IMAGE_MODEL": "gpt-image-2,gpt-image-1.5",
"GEN_IMAGE_GEMINI_MODEL": "gemini-3.1-flash-image,gemini-2.5-flash-image",
"GEN_IMAGE_AUTO_FALLBACK": "true"
}
}
}
}OpenCode(项目里的 opencode.json 或全局 ~/.config/opencode/opencode.json;Windows 上改为 "command": ["cmd", "/c", "npx", "-y", "gen-image-mcp"])
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"gen-image": {
"type": "local",
"command": ["npx", "-y", "gen-image-mcp"],
"enabled": true,
"environment": {
"GEN_IMAGE_BASE_URL": "https://your-gateway.example",
"GEN_IMAGE_API_KEY": "your-api-key",
"GEN_IMAGE_MODEL": "gpt-image-2,gpt-image-1.5",
"GEN_IMAGE_GEMINI_MODEL": "gemini-3.1-flash-image,gemini-2.5-flash-image",
"GEN_IMAGE_AUTO_FALLBACK": "true"
}
}
}
}各客户端字段名不同:
env还是environment,command+args还是单个command数组,mcpServers还是mcp/servers,请按你的客户端文档的格式填写。Windows 原生环境:如果服务起不来(Connection closed、ENOENT),请通过 cmd 启动 npx,例如"command": "cmd", "args": ["/c", "npx", "-y", "gen-image-mcp"]。
重启客户端,应能看到 4 个工具。然后直接说:“生成一张 16:9 的落地页头图,保存到 public/hero.png。”
工具一览
工具 | 用途 | 上游端点 |
| 文生图(尺寸、质量、1–4 张、png/jpeg/webp) |
|
| 编辑或合并 1–16 张本地图片,可加蒙版 |
|
| Gemini 文生图或参考图生成,支持 10 种宽高比 |
|
| 查看已配置的模型组和默认模型(不联网) | 无 |
详细文档
配置说明 · 模型选择、失败切换与重试 · 工具参数参考 · 文件、输出与 structuredContent · 常见问题 · 参与开发
许可证:MIT © 2026 yuluo688。不替代上游模型服务条款,也不约定生成图片的权利归属。
Available Tools
4 toolsedit_imageB
Edit or combine local images with POST /v1/images/edits (multipart). Use for gpt-image-2 image-to-image. Do not set input_fidelity for gpt-image-2.
| Name | Required | Description | Default |
|---|---|---|---|
| mask | No | Optional local mask image path | |
| size | No | Output size, e.g. auto or 1024x1024. Defaults to auto. | |
| model | No | Configured model to start with. Defaults to the first model configured for this tool. | |
| images | Yes | Local image file paths to send as repeated multipart field `image` (max 16). | |
| prompt | Yes | Edit instruction | |
| quality | No | Image quality | |
| filename | No | Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten. | |
| output_path | Yes | File or directory to write. Relative paths resolve against process.cwd(). | |
| auto_fallback | No | Try the next configured model after an upstream failure. Overrides GEN_IMAGE_AUTO_FALLBACK. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description is the only source of behavioral info. It discloses the API endpoint and multipart format, and warns about a specific parameter conflict, adding value. However, it doesn't mention error handling, permissions, or output behavior beyond writing to output_path.
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?
The description is two sentences, reasonably concise and front-loaded with the main purpose. The warning about input_fidelity is valuable. Could be slightly more efficient by integrating the API endpoint into the first sentence, but 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?
Given 9 parameters, some complex (filename, output_path), the description doesn't provide additional context beyond the schema, which is quite detailed. The absence of output schema and annotations means the description does not clarify what the tool returns, but the schema covers most parameters. It's adequate but could hint at typical use cases or error scenarios.
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 100%, so parameter descriptions are thorough. The tool description adds minimal extra semantics beyond the schema, only noting that images are sent as repeated multipart field `image` (in schema) and the input_fidelity warning. It doesn't clarify relationships between parameters or edge cases beyond what's already in schema.
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?
The description clearly states the tool edits or combines local images via a specific API endpoint and mentions a specific model. It distinguishes itself from generate_image and generate_gemini_image by focusing on image-to-image editing rather than generation. However, it doesn't explicitly name the alternative tools for clarity.
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 says 'Use for gpt-image-2 image-to-image', which provides clear context for when to use this tool, and warns against setting input_fidelity for gpt-image-2. It doesn't explicitly state when not to use it or mention alternatives, but the context implies generation tools are for other cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_gemini_imageA
Generate or edit images with POST /v1/chat/completions using a Gemini image model. Do not call /v1/images/* for Gemini image models.
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Configured model to start with. Defaults to the first model configured for this tool. | |
| images | No | Optional local image paths sent as user content image_url data URLs (max 16). | |
| prompt | Yes | Text prompt | |
| filename | No | Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten. | |
| output_path | Yes | File or directory to write. Relative paths resolve against process.cwd(). | |
| aspect_ratio | No | Optional image_config.aspect_ratio | |
| auto_fallback | No | Try the next configured model after an upstream failure. Overrides GEN_IMAGE_AUTO_FALLBACK. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. It discloses the endpoint used (POST /v1/chat/completions) and the model family, which is useful. However, it doesn't disclose output behavior, file-writing semantics, or failure modes beyond the schema's filename notes. The description adds some context but not rich behavioral detail.
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?
Two sentences, front-loaded with the core action and the critical endpoint exclusion. The second sentence is a clear directive. No wasted words, though it could have named sibling tools for extra routing value.
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 a tool with 7 parameters, 100% schema coverage, and no output schema, the description is adequate but thin. It explains the endpoint and model family, but doesn't clarify when to prefer this over generate_image/edit_image, nor what the tool returns. The schema covers parameters, but the tool-level context is incomplete.
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 100%, so the schema already documents all 7 parameters. The description adds the endpoint context and the model-family constraint, but doesn't add parameter-level meaning beyond the schema. Baseline 3 is appropriate.
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?
The description states a specific verb ('Generate or edit images') and resource ('Gemini image model'), and explicitly distinguishes from the /v1/images/* endpoint family. It doesn't fully differentiate from sibling tools generate_image and edit_image, but the endpoint guidance and model family naming provide reasonable clarity.
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 gives an explicit 'Do not call /v1/images/* for Gemini image models' exclusion, which is a clear when-not-to-use signal. It doesn't name sibling tools generate_image or edit_image as alternatives, but the endpoint-level guidance is actionable and contextually useful.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_imageA
Generate images with POST /v1/images/generations (OpenAI Images API). Use for gpt-image-2 and other Images-only models. Do not send those models to chat completions.
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images, 1-4. Default 1. | |
| size | No | Output size, e.g. auto or 1024x1024. Defaults to auto. | |
| model | No | Configured model to start with. Defaults to the first model configured for this tool. | |
| prompt | Yes | Text prompt for image generation | |
| quality | No | Image quality | |
| filename | No | Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten. | |
| output_path | Yes | File or directory to write. Relative paths resolve against process.cwd(). | |
| auto_fallback | No | Try the next configured model after an upstream failure. Overrides GEN_IMAGE_AUTO_FALLBACK. | |
| output_format | No | Output encoding. Omit to let the upstream service decide the format. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral disclosure burden. It only states the endpoint and intended models, and does not disclose that the tool writes files to output_path, how overwrites or filenames behave, or what the response contains. Those details live in the schema, not in the behavioral description.
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?
Two sentences with no filler. The core action and endpoint are front-loaded, followed by the important routing guidance about Images-only models and the chat-completions exclusion.
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?
This is a 9-parameter tool with no annotations and no output schema, yet the description does not explain return values, file-writing behavior, or how it relates to edit_image. It is enough to identify the tool, but not enough to invoke it confidently without relying heavily on schema inspection.
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 100%, so the baseline of 3 applies. The description adds no parameter-level meaning; all parameter semantics are already provided by the input schema.
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?
The description names a specific operation (generate images), the exact endpoint (POST /v1/images/generations), and scopes which models it applies to (gpt-image-2 and other Images-only models). This clearly separates it from generate_gemini_image and edit_image.
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?
It gives a clear usage context: use for Images-only models, not for chat completions. It does not explicitly compare against the sibling image tools, but the model and endpoint guidance largely disambiguates when this tool should be selected.
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 configured model groups and the tools that use them. Returns configuration only — not live availability. Does not use network, credentials, or base URL.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark readOnly=true and destructive=false; the description adds useful behavior beyond that by stating it is configuration-only, not live availability, and requires no network, credentials, or base URL. This gives an agent confidence that the call is safe and offline.
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?
Two tightly packed sentences with no filler; the core purpose is stated first and the behavioral scope follows. Every clause earns its place.
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 a zero-parameter read-only tool, the description covers what the tool returns, what it does not include, and its execution context. No output schema or parameter details are needed for an agent to call this correctly.
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 tool has zero parameters, so the description cannot meaningfully add parameter-level detail. The baseline of 4 applies because there are no parameter semantics to document, and the description confirms the call takes no external inputs.
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?
The description states a specific verb ('List'), a clear resource ('configured model groups and the tools that use them'), and immediately scopes the result to configuration only. This clearly distinguishes it from the image-generation siblings.
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 gives clear context: use it to inspect configuration, and it explicitly says it does not report live availability or use network, credentials, or base URL. It doesn't name an alternative because no sibling performs this function, but the guidance is otherwise sufficient.
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.2.2- Changed
edit_image7 fields changed- changed
Input schema / $schemaPrevious value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema" - removed
Input schema / additionalPropertiesRemoved value: -false - added
Input schema / properties / filenameAdded value: +{ + "description": "Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten.", + "type": "string" +} - added
Input schema / properties / images / items / minLengthAdded value: +1 - added
Input schema / properties / mask / minLengthAdded value: +1 - changed
Input schema / properties / size / descriptionPrevious value: -"Output size"New value: +"Output size, e.g. auto or 1024x1024. Defaults to auto." - added
Input schema / properties / size / patternAdded value: +"^(auto|[1-9]\\d*x[1-9]\\d*)$"
- Changed
generate_gemini_image4 fields changed- changed
Input schema / $schemaPrevious value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema" - removed
Input schema / additionalPropertiesRemoved value: -false - added
Input schema / properties / filenameAdded value: +{ + "description": "Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten.", + "type": "string" +} - added
Input schema / properties / images / items / minLengthAdded value: +1
- Changed
generate_image5 fields changed- changed
Input schema / $schemaPrevious value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema" - removed
Input schema / additionalPropertiesRemoved value: -false - added
Input schema / properties / filenameAdded value: +{ + "description": "Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten.", + "type": "string" +} - changed
Input schema / properties / output_format / descriptionPrevious value: -"Output encoding. Default png."New value: +"Output encoding. Omit to let the upstream service decide the format." - added
Input schema / properties / size / patternAdded value: +"^(auto|[1-9]\\d*x[1-9]\\d*)$"
- Added
list_models
3 tool updates
v0.1.0- First observed
edit_image - First observed
generate_gemini_image - First observed
generate_image
TDQS
Scored across 4 tools
Each tool is tied to a specific API/model family: generate_image/edit_image for OpenAI image endpoints, generate_gemini_image for Gemini chat-completions, and list_models for configuration. There is slight functional overlap between generate_gemini_image and generate_image, but the usage rules make selection clear.
All tool names follow a consistent snake_case verb_noun pattern: list_models, generate_image, edit_image, generate_gemini_image. The model qualifier in generate_gemini_image is informative rather than inconsistent.
Four tools cover the core image generation and editing workflows plus model discovery. This is a well-scoped set with no redundant or filler tools.
The set covers generation and editing for both Gemini and OpenAI image models, plus model listing. Missing image variation functionality is a minor gap, but the main workflows have no dead ends.
Maintenance
Related MCP Connectors
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
MCP server for Qwen Image 3 AI image generation
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for Flux AI image generation
Related MCP Servers
- AlicenseBqualityDmaintenanceA local MCP server for generating and editing images using OpenAI-compatible APIs. It provides text-to-image generation and image editing capabilities with configurable endpoints and saves output directly to local files.26 npmMIT
- AlicenseNot gradedqualityCmaintenanceMCP server for generating, editing, and processing images via multiple providers including Kilo, OpenRouter, OpenAI, and Gemini, with local tools for background removal, resizing, and cropping.19 npm3MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server for AI-powered image processing (generate, edit, vary, analyze) supporting OpenAI, Gemini, Ideogram, and custom relay endpoints.-
- FlicenseAqualityDmaintenanceMCP server for AI image generation supporting text-to-image and image-to-image editing via any OpenAI-compatible service, with configurable models, aspect ratios, and sizes.2-