Image Generator MCP Server
Provides image generation through OpenAI-compatible image APIs, supporting text-to-image generation, image editing with optional masks, and image variations, along with local file storage, metadata, and searchable indexing.
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., "@Image Generator MCP ServerCreate a vertical poster of a fire warrior surrounded by flames"
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.
🎨 Image Generator MCP Server
基于 NewAPI 兼容端点的 MCP 图像生成服务器,支持所有标准MCP客户端。提供文生图、图生图编辑和变体生成三种模式。
🌍 跨平台支持: Windows / macOS / Linux
🔌 通用兼容: Claude Code / Cursor / Windsurf / Cline / Continue / Zed 等
功能特性
🎨 三种生成模式
文生图 (
generate_image) - 从文本描述生成图片图生图编辑 (
edit_image) - 编辑现有图片,支持 mask 局部修改图生图变体 (
create_variation) - 保持风格和构图,生成变体
🚀 高质量模型
gpt-image-2.5-flare- 最新最高质量(默认)gpt-image-2.5-sunburstgpt-image-2.5gpt-image-2
📁 自动管理
按年月组织文件(
YYYY-MM/)自动从 prompt 提取标签
保存完整元数据
全局索引支持检索
🔍 图片检索
按标签过滤(AND 逻辑)
按关键词搜索 prompt
按月份筛选
按工具类型筛选
Related MCP server: laozhang-image MCP
安装
快速安装 (推荐)
# 克隆仓库
git clone https://github.com/tanglifu30-blip/mcp-image-generator.git
cd mcp-image-generator
# Windows
./setup.ps1
# macOS/Linux
chmod +x setup.sh
./setup.sh手动安装
cd mcp-servers/image-generator
npm install
cp .env.example .env
# 编辑.env文件,填入你的API密钥配置
支持三种配置方式,任选其一:
方式1: 环境变量 (推荐 - 跨工具通用)
# Windows PowerShell
$env:OPENAI_API_KEY="sk-your-key-here"
$env:OPENAI_API_BASE="https://your-api-endpoint.com"
# macOS/Linux
export OPENAI_API_KEY="sk-your-key-here"
export OPENAI_API_BASE="https://your-api-endpoint.com"方式2: .env文件 (适合开发)
复制.env.example为.env,填入配置:
cp .env.example .env
# 编辑.env文件方式3: JSON配置文件 (传统方式)
创建 ~/生图apikey.txt (或自定义路径):
{
"key": "sk-your-key-here",
"url": "https://your-api-endpoint.com"
}在MCP客户端中使用
Claude Code 配置
编辑 ~/.claude/config.json:
{
"mcpServers": {
"image-generator": {
"command": "node",
"args": ["/path/to/mcp-image-generator/index.js"],
"env": {
"OPENAI_API_KEY": "sk-your-key-here",
"OPENAI_API_BASE": "https://your-api-endpoint.com"
}
}
}
}其他客户端 (Cursor / Windsurf / Cline)
查看详细配置: MCP客户端配置指南
支持的客户端:
✅ Claude Code (CLI / Desktop / Web)
✅ Cursor IDE
✅ Windsurf IDE
✅ VS Code + Cline
✅ Continue.dev
✅ Zed Editor
✅ 所有标准MCP客户端
使用示例
文生图
// 在 Claude Code 中直接使用
帮我生成一张永劫无间火男的海报// MCP 工具调用
{
"tool": "generate_image",
"prompt": "永劫无间火男角色海报,火焰特效",
"model": "gpt-image-2.5-flare",
"size": "1024x1792",
"quality": "hd",
"n": 1
}图生图编辑
{
"tool": "edit_image",
"image": "base64_encoded_image_or_url",
"prompt": "将背景改成火焰场景",
"mask": "optional_base64_mask", // 可选:只修改透明区域
"model": "gpt-image-2.5-flare",
"size": "1024x1024",
"n": 1
}图生图变体
{
"tool": "create_variation",
"image": "base64_encoded_image_or_url",
"model": "gpt-image-2.5-flare",
"size": "1024x1024",
"n": 2 // 生成 2 个变体
}检索图片
{
"tool": "list_images",
"tags": ["火男", "永劫无间"], // 必须同时包含这些标签
"keyword": "海报", // 在 prompt 中搜索
"month": "2026-10", // 筛选 2026 年 10 月
"tool": "generate_image", // 只看文生图的结果
"limit": 20 // 最多返回 20 条
}支持的图片格式
API 响应格式
✅
b64_json- base64 编码(当前支持)✅
url- 图片 URL(兼容支持)
输入图片格式(edit_image / create_variation)
base64 编码的 PNG
图片 URL
输出尺寸
256x256512x5121024x1024- 默认1792x1024- 横版1024x1792- 竖版(海报)
文件组织
A:\Claude使用image出图\
├── index.json # 全局索引
├── 2026-10/ # 按年月组织
│ ├── 火男-海报_a1b2c3.png # 图片文件
│ ├── 火男-海报_a1b2c3.png.json # 元数据
│ ├── 小猫_d4e5f6.png
│ └── 小猫_d4e5f6.png.json
└── 2026-11/
└── ...元数据结构
{
"tool": "generate_image",
"model": "gpt-image-2.5-flare",
"prompt": "永劫无间火男角色海报",
"size": "1024x1792",
"quality": "hd",
"revised_prompt": "...",
"saved_at": "2026-10-29T12:34:56.789Z",
"local_path": "A:\\Claude使用image出图\\2026-10\\火男-海报_a1b2c3.png",
"filename": "火男-海报_a1b2c3.png",
"tags": ["火男", "海报", "永劫无间", "角色"]
}标签系统
自动提取规则
从 prompt 中提取关键词
转换为小写
过滤停用词(的、一张、image、picture 等)
过滤单字符词
去重
最多保留 10 个标签
支持语言
✅ 中文
✅ 英文
✅ 数字
✅ 连字符
故障排查
MCP 服务器无法连接
检查路径是否正确(注意空格 vs 连字符)
检查 Node.js 版本(需要 v18+)
检查依赖是否安装 (
npm install)重启 Claude Code
API 调用失败
检查 API 配置文件是否存在
检查 API key 是否有效
检查网络连接
检查 API 端点是否正常
图片保存失败
检查存储目录权限
检查磁盘空间
确认 API 返回了有效的图片数据
查看日志
MCP 服务器的日志输出到 stderr,可以在 Claude Code 的控制台中查看。
测试
单元测试
# 测试 base64 图片处理
node test-b64.js
# 测试 URL 图片下载
node test-generate.js预期输出
✓ API Config loaded
✓ API call successful
✓ Got b64_json from API
✓ Decoded base64, size: 2305380 bytes
✓ Image saved to: ...
✓ File size on disk: 2305380 bytes
✅ All tests passed!技术栈
MCP SDK -
@modelcontextprotocol/sdk^0.5.0HTTP 客户端 -
axios^1.6.0Node.js - v18+ (推荐 v24+)
协议 - stdio transport
版本历史
v1.0.0 (2026-10-29)
✅ 支持文生图、图生图编辑、图生图变体
✅ 支持 base64 和 URL 两种图片格式
✅ 自动标签提取
✅ 按月份组织文件
✅ 全局索引和检索
✅ 完整元数据保存
许可证
MIT - 详见 LICENSE 文件
贡献
欢迎提交 Issues 和 Pull Requests!
相关链接
Made with ❤️ by Claude Opus 5.5
Available Tools
4 toolscreate_variationB
图生图变体:Create variations of an existing image. Keeps the overall style and composition while generating new versions (保持风格和构图,生成变体).
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of variations to generate. Default: 1 | |
| size | No | Output image size. Default: 1024x1024 | |
| image | Yes | Base64-encoded PNG image or URL to create variations from | |
| model | No | Model to use. Defaults to gpt-image-2.5-sunburst |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations at all, the description carries the full burden, and it does disclose the key behavioral trait — that output preserves style/composition rather than making arbitrary new images, and that multiple variants are produced. It says nothing about return format (URL vs base64), latency, cost, or whether the source image is stored, which are significant gaps for a generation tool with no output schema.
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 core English sentence is front-loaded and useful, but the leading Chinese label and the trailing parenthetical restate the same idea a third time, so roughly half the text is duplication rather than new information.
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 4-parameter generation tool with no annotations and no output schema, the description covers the conceptual purpose and the style-preservation guarantee, which is the essential part. It stops short of describing what comes back and how variants are returned, leaving a real gap that nothing else in the definition fills.
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 four parameters (image, n, size, model) are already fully documented with defaults and enums. The description adds no parameter-level meaning beyond the schema, so the baseline of 3 applies.
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 ("Create variations of an existing image") and adds the defining constraint that the overall style and composition are preserved. That constraint implicitly separates it from generate_image (new image from prompt) and edit_image (targeted modification), though no sibling is named outright.
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?
Usage is only implied: an agent can infer it should call this when it has an existing image and wants alternate versions. There is no explicit when-to-use/when-not, no mention of edit_image or generate_image as alternatives, and no stated prerequisites such as image format or size limits.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
edit_imageB
图生图/局部编辑:Edit an existing image based on a prompt. Can modify specific areas while keeping others unchanged. Supports inpainting with mask (修改指定区域,其他保持不变).
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of variations to generate. Default: 1 | |
| mask | No | Optional: Base64-encoded mask image (transparent areas will be edited). If not provided, entire image context is used for editing. | |
| size | No | Output image size. Default: 1024x1024 | |
| image | Yes | Base64-encoded PNG image or URL to the image to edit | |
| model | No | Model to use. Defaults to gpt-image-2.5-sunburst | |
| prompt | Yes | Description of the edits to make (支持中文) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden; it does disclose the key behavioral trait that unmasked regions stay unchanged, which is genuinely useful. It omits other relevant behavior: what is returned (one image vs n variations), whether the source image is mutated, and any input constraints such as PNG-only or size limits for masked edits.
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 compact sentences with the core action front-loaded, and the mask capability stated immediately after. The bilingual restatement in parentheses is slightly redundant with the surrounding English text, but the whole thing is still short and scannable.
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 six-parameter mutation tool with no annotations and no output schema, the description covers purpose and the mask concept but says nothing about the return value (edited image(s) / URLs), model tradeoffs, or input constraints. An agent could call it, but would be guessing at what comes back.
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 all six parameters are already documented, giving a baseline of 3. The description adds only marginal meaning beyond the schema — that prompts accept Chinese and that the mask restricts the edited region — without clarifying model differences or how n interacts with the edit.
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 ('Edit an existing image based on a prompt') plus the two modes it covers (whole-image edit and masked inpainting). It implicitly contrasts with generate_image by requiring an existing image, but never names the sibling or explicitly draws the line between editing and generation.
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?
Usage is implied by 'Edit an existing image' and 'Supports inpainting with mask', so an agent can infer when a mask is appropriate. There is no explicit guidance on when to prefer generate_image or create_variation instead, and no stated preconditions (image format, size limits, model choice).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_imageB
文生图:Generate an image from a text prompt using high-quality AI models. Uses gpt-image-2.5-sunburst by default (最佳性价比 - 实测噪点最低). Available models: gpt-image-2.5-sunburst, gpt-image-2.5-flare, gpt-image-2
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images to generate. Default: 1 | |
| size | No | Image size. Default: 1024x1024 | |
| model | No | Model to use. Defaults to gpt-image-2.5-sunburst (最高质量). Available: gpt-image-2.5-sunburst, gpt-image-2.5-flare, gpt-image-2 | |
| prompt | Yes | The text prompt describing the image to generate (支持中文) | |
| quality | No | Image quality. Default: high |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations and no output schema, the description carries the full behavioral burden but discloses almost none of it: no return format (URL vs base64), no cost/latency or rate-limit notes, no statement of whether generated images are persisted. The only behavioral shading is a marketing claim about noise levels, which does not help an agent call the tool correctly.
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?
Front-loaded verb and resource, short overall, no filler. The trailing list of available models duplicates the model enum already present in the schema, so one clause is 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?
For a generative tool with no annotations and no output schema, the agent still lacks essential information: what the call returns, whether multiple images (n up to 4) come back as a list, and any cost or timing expectations. The description covers invocation intent but leaves too much unknown.
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 the schema already documents all five parameters and their enums, making 3 the baseline. The description adds a rationale for the default model, but it conflicts with the schema's own rationale (description calls sunburst 'best value / lowest noise' while the schema field says 'highest quality'), mildly muddying rather than clarifying.
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: 'Generate an image from a text prompt using high-quality AI models.' An agent can distinguish it from edit_image/create_variation by the text-to-image framing, though the description never names those siblings to make the boundary explicit.
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?
Usage is implied by 'generate an image from a text prompt', but there is no explicit statement of when to prefer this over edit_image or create_variation, nor any prerequisites or exclusions. The model-selection sentence is parameter guidance, not usage routing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_imagesA
检索图片:Search and list generated images by tags, date, or keywords. Returns matching images with metadata.
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Filter by tags (AND logic - all tags must match) | |
| tool | No | Filter by tool used | |
| limit | No | Maximum number of results to return. Default: 20 | |
| month | No | Filter by month, format: YYYY-MM (e.g., 2026-10) | |
| keyword | No | Search in prompt text (case-insensitive) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden. It does state the return shape ('matching images with metadata'), which signals a safe read, but omits ordering, pagination/truncation behavior, and whether the default limit of 20 is silently applied — relevant for a list tool that can return many rows.
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 compact sentences with the purpose front-loaded before the return statement. The leading Chinese label '检索图片:' is mildly redundant with the English text but does not obstruct scanning.
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 all five optional parameters fully described in the schema and no output schema to explain, the description covers what the tool is and roughly what it returns. The only real gap is list behavior (ordering, pagination), which is minor for a low-risk read tool.
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 every parameter (tags AND-logic, tool enum, limit bounds/default, month format, keyword case-insensitivity) is already fully documented in the schema. The description only restates the filter axes at a high level, adding no syntax or interaction detail beyond it, so the baseline 3 applies.
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 ('Search and list generated images') plus the three filter axes (tags, date, keywords). Against siblings that all generate or mutate images (generate_image, edit_image, create_variation), it is clearly the retrieval counterpart, though it never names them explicitly.
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?
Usage is only implied: the agent can infer this is the tool for finding existing images rather than creating them. There is no explicit when-to-use/when-not statement, no mention of combining filters, and no routing guidance relative to the sibling tools.
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
v1.2.0- First observed
create_variation - First observed
edit_image - First observed
generate_image - First observed
list_images
TDQS
Scored across 4 tools
The four tools mostly target distinct actions: text generation, local editing, variation creation, and image retrieval. The main possible confusion is between edit_image and create_variation, since both operate on an existing image, but their descriptions clarify that one performs targeted/masked edits while the other generates stylistic variants.
All tool names use snake_case and follow a clear verb_noun pattern: edit_image, create_variation, list_images, generate_image. The verbs differ appropriately by action, and the naming is predictable throughout.
Four tools is well-scoped for a focused image generation server. Each tool covers a distinct core operation without excessive surface area.
The server covers the main image lifecycle operations: generate, edit, create variations, and list/search images. Minor gaps exist, such as explicit get_image-by-ID or delete_image operations, but core generation and editing workflows are covered.
Maintenance
Related MCP Connectors
Generate, edit and upscale images with references, batch jobs, cost previews and original downloads.
Upload, generate, organize, search, and transform images, videos, and files with AI-powered tools.
Uncensored image, image-to-video and chat generation for adult apps. OpenAI-compatible, pay per use.
AI-native digital asset management: semantic search, generative image edits, and CDN delivery.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI-powered image analysis using OpenAI's Vision API and image generation with DALL-E models. Supports image description, content analysis, comparison, editing, and creating variations with intelligent caching.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables image generation and editing using laozhang.ai's OpenAI-compatible API, with tools for text-to-image and image-to-image transformations.MIT
- AlicenseCqualityDmaintenanceEnables AI-powered image editing such as upscaling, background removal, restoration, colorization, denoising, and compression through a simple API.99 npmMIT
- AlicenseAqualityBmaintenanceEnables private, one-shot image generation and editing via a self-hosted ComfyUI, with a simple model-agnostic tool surface and results delivered directly to the client without server-side storage.81MIT