image-gen-mcp
Generates and edits images via OpenAI's gpt-image-2, saving them directly to specified file paths for production assets like banners and icons.
README
image-gen-mcp
An MCP server that lets Claude Code generate real images to use in your projects (banners, icons, backgrounds, textures, etc.) with OpenAI gpt-image-2, and save them straight to a path you specify. It is meant for producing production assets — not for mocking up UI designs.
ภาษาไทย: ดู README.th.md
Tools
generate_image
Generate a new image from a text prompt and write it to a file.
| param | values | default |
|---|---|---|
prompt * |
text description of the image | — |
output_path * |
where to save, e.g. public/images/banner.png |
— |
quality |
low | medium | high | auto |
medium |
size |
auto | 1024x1024 | 1536x1024 (landscape) | 1024x1536 (portrait) | 2048x2048 | WxH |
1024x1024 |
format |
png | jpeg | webp |
inferred from output_path extension |
background |
opaque | transparent | auto (transparent needs png/webp) |
auto |
compression |
0-100 (jpeg/webp only) | — |
n |
1-10 (if >1, saves name-1.ext, name-2.ext, ...) |
1 |
model |
override the model | gpt-image-2 |
edit_image
Edit / build on existing images. Pass 1-16 reference images, plus an optional mask for inpainting.
| param | values |
|---|---|
prompt * |
what to edit / create |
image_paths * |
1-16 source (reference) image paths |
output_path * |
where to save the result |
mask_path |
(optional) mask for inpainting — transparent areas of the mask are what gets edited; must match the first image's dimensions |
+ quality / size / format / background / compression / n / model — same as generate_image |
Both tools return only { path, bytes, size, quality, ... } — never the raw image bytes (to avoid flooding the agent's context). A relative output_path is resolved against the calling project's CWD, and parent directories are created automatically.
Install
cd image-gen-mcp
npm install
Connect to Claude Code
Provide the API key via the server's env block in your MCP config (no .env file required) — in a project .mcp.json or a user-scoped config:
{
"mcpServers": {
"image-gen": {
"command": "node",
"args": ["/Users/palm/Desktop/projects/custom-mcp/image-gen-mcp/src/index.mjs"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}
Or add it via the CLI:
claude mcp add image-gen -e OPENAI_API_KEY=sk-... -- node /Users/palm/Desktop/projects/custom-mcp/image-gen-mcp/src/index.mjs
Test
npm run selftest # real in-memory MCP round-trip with a fake client — no key/network needed
OPENAI_API_KEY=sk-... npm run smoke # one real API call (quality low) that verifies a valid PNG
Pricing (approx., gpt-image-2, 1024x1024)
low ~$0.006 · medium ~$0.053 · high ~$0.211 per image — start at medium, use high only for final assets.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。