GPT-Image MCP Server
Integrates with OpenAI's GPT-Image API to generate images from text prompts or transform existing images using text descriptions, supporting configurable size and quality.
Click on "Install 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., "@GPT-Image MCP Servergenerate a photo of a sunset over the ocean and save to ~/Pictures/sunset.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.
GPT-Image MCP Server
一个用于调用 GPT-Image 兼容 API 生成图片的 MCP 服务器,支持文生图和图生图功能。
兼容 Agnes AI 和 OpenAI GPT-Image 等标准接口。
✨ 功能特性
🎨 文生图:根据文本描述生成图片
🖼️ 图生图:基于参考图片和描述生成新图片
⚙️ 灵活配置:支持环境变量和配置文件,环境变量优先
🔌 标准协议:基于 MCP 协议,可集成到各种 AI 工具
📁 自动创建目录:保存图片时自动创建不存在的目录
🌐 多后端兼容:支持 Agnes AI、OpenAI 及其他兼容接口
Related MCP server: openai-gpt-image-1-mcp
📦 安装
方式一:使用 uvx 直接运行(推荐)
无需安装,直接运行:
uvx --from git+https://github.com/IronManCantFix/image-mcp.git image-mcp方式二:使用 pip 安装
pip install git+https://github.com/IronManCantFix/image-mcp.git安装后可直接使用 image-mcp 命令。
方式三:从源码安装
git clone https://github.com/IronManCantFix/image-mcp.git
cd image-mcp
pip install .⚙️ 配置
Agnes AI(推荐)
export IMAGE_API_URL="https://apihub.agnes-ai.com/v1/images/generations"
export IMAGE_API_KEY="your-agnes-api-key"
export IMAGE_MODEL="agnes-image-2.0-flash"OpenAI
export IMAGE_API_URL="https://api.openai.com/v1/images/generations"
export IMAGE_API_KEY="sk-your-openai-api-key"
export IMAGE_MODEL="gpt-image-2"配置文件
也可以使用配置文件(默认路径 ~/.config/image-mcp/config.json):
{
"api_url": "https://api.openai.com/v1/images/generations",
"api_key": "sk-your-api-key",
"model": "gpt-image-2"
}💡 提示:配置文件路径可通过
IMAGE_CONFIG_PATH环境变量覆盖。
代理配置
如需通过 HTTP 代理访问 API,可设置 IMAGE_PROXY 环境变量或在配置文件中添加 proxy 字段:
export IMAGE_PROXY="http://127.0.0.1:7890"配置文件方式:
{
"api_url": "https://api.openai.com/v1/images/generations",
"api_key": "sk-your-api-key",
"model": "gpt-image-2",
"proxy": "http://127.0.0.1:7890"
}未配置时默认不使用代理,同时也会尊重系统环境变量 HTTP_PROXY / HTTPS_PROXY。
配置优先级
环境变量 > 配置文件 > 默认值
🚀 使用方法
启动 MCP 服务器
# 使用 uvx
uvx --from git+https://github.com/IronManCantFix/image-mcp.git image-mcp
# 使用 pip 安装后
image-mcp
# 从源码运行
python server.py集成到 Cursor
在项目根目录创建 .cursor/mcp.json 文件:
{
"mcpServers": {
"image-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/IronManCantFix/image-mcp.git", "image-mcp"],
"env": {
"IMAGE_API_URL": "https://apihub.agnes-ai.com/v1/images/generations",
"IMAGE_API_KEY": "your-agnes-api-key",
"IMAGE_MODEL": "agnes-image-2.0-flash"
}
}
}
}或者使用 pip 安装后:
{
"mcpServers": {
"image-mcp": {
"command": "image-mcp",
"env": {
"IMAGE_API_URL": "https://apihub.agnes-ai.com/v1/images/generations",
"IMAGE_API_KEY": "your-agnes-api-key",
"IMAGE_MODEL": "agnes-image-2.0-flash"
}
}
}
}集成到 Claude Desktop
在 Claude Desktop 配置文件中添加:
{
"mcpServers": {
"image-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/IronManCantFix/image-mcp.git", "image-mcp"],
"env": {
"IMAGE_API_URL": "https://apihub.agnes-ai.com/v1/images/generations",
"IMAGE_API_KEY": "your-agnes-api-key",
"IMAGE_MODEL": "agnes-image-2.0-flash"
}
}
}
}🛠️ 工具说明
text_to_image
根据文本描述生成图片。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 图片描述文本 |
| string | ✅ | 保存的本地文件路径 |
| string | ❌ | 图片尺寸,如 |
| string | ❌ | 图片质量: |
示例:
{
"prompt": "a cute cat sitting on a windowsill",
"save_path": "/Users/me/images/cat.png",
"size": "1024x1024",
"quality": "high"
}image_to_image
基于参考图片和文本描述生成新图片。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 变换描述文本 |
| string | ✅ | 输入图片的本地文件路径 |
| string | ✅ | 保存的本地文件路径 |
| string | ❌ | 输出图片尺寸 |
| string | ❌ | 图片质量 |
示例:
{
"prompt": "make it in anime style",
"input_image": "/Users/me/images/original.png",
"save_path": "/Users/me/images/anime_version.png",
"size": "1024x1024",
"quality": "high"
}📤 返回格式
所有工具返回统一的 JSON 格式:
成功
{
"success": true,
"file_path": "/absolute/path/to/image.png",
"message": "图片已保存"
}失败
{
"success": false,
"error": "错误描述"
}❓ 常见问题
Q: 如何获取 Agnes AI API Key?
A: 前往 Agnes AI API Hub 注册并获取 API Key。
Q: 如何获取 OpenAI API Key?
A: 前往 OpenAI Platform 创建 API Key。
Q: 支持哪些图片格式?
A: 输出格式为 PNG。图生图输入支持 PNG、JPG、JPEG、GIF、WebP 格式。
Q: 可以使用其他兼容的 API 吗?
A: 可以,只需将 IMAGE_API_URL 设置为对应的 API 端点地址,IMAGE_MODEL 设置为对应的模型名称即可。接口需兼容 OpenAI GPT-Image 的请求/响应格式。
Q: 图片保存在哪里?
A: 由调用时的 save_path 参数决定,可以是任意路径。如果目录不存在会自动创建。
📄 许可证
MIT License - 详见 LICENSE 文件
🔗 相关链接
Available Tools
2 toolsimage_to_imageB
基于参考图片和文本描述生成新图片
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | 输出图片尺寸 | 1024x1024 |
| prompt | Yes | 变换描述文本 | |
| quality | No | 图片质量 | medium |
| save_path | Yes | 保存的本地文件路径 | |
| input_image | Yes | 输入图片的本地文件路径 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of disclosing behavioral traits. It mentions generation but does not specify that files are created at the 'save_path', potential side effects, or required permissions. The file I/O behavior is implied but not explicitly stated.
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 very short (one sentence) and to the point. It is efficient but may be overly brief for a tool with five parameters. No wasted words, but could benefit from additional context.
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?
The tool generates an image and saves it to a file, but the description does not explain the output behavior or return value. Without an output schema, the agent must infer what the tool returns. This omission reduces completeness.
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 each parameter. The description adds overall tool purpose but does not elaborate on parameter meaning beyond what the schema provides. Baseline score of 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 clearly states the tool's purpose: generating new images based on a reference image and text description. It implies distinction from the sibling 'text_to_image' by mentioning a reference image input, which is unique to this tool.
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 implies usage when a reference image and text transform are needed, but offers no explicit guidance on when not to use it or alternatives beyond the sibling name. No exclusion criteria or context signals are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
text_to_imageC
根据文本描述生成图片
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | 图片尺寸,如 1024x1024 | 1024x1024 |
| prompt | Yes | 图片描述文本 | |
| quality | No | 图片质量 | medium |
| save_path | Yes | 保存的本地文件路径 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description must carry the full burden. It only states it generates images, but offers no info on behavior traits such as image generation limits, cost, output format, or side effects. The minimal description provides almost no transparency.
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 a single, concise sentence with no fluff. It front-loads the core action. While extremely short, it is efficient and easy to parse.
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?
The tool has no output schema and no annotations, so the description must compensate. It fails to mention what the tool returns, any limitations on image generation, or how it compares to the sibling. For a generative tool, this is insufficient.
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% and all parameters have descriptions. The tool description adds no additional meaning beyond what the schema already provides. 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 clearly states the tool's purpose: generating images from text descriptions. However, it does not distinguish this from the sibling tool 'image_to_image', which may also generate images. The purpose is specific but misses clarification on scope.
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?
No guidelines are provided about when to use this tool versus the sibling or alternatives. The description gives no context on prerequisites, trade-offs, or typical scenarios. The agent has no decision support.
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.
2 tool updates
v0.2.1- First observed
image_to_image - First observed
text_to_image
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one generates images purely from text, the other uses a reference image as input. There is no overlap.
Both tools follow a consistent verb_noun snake_case pattern (text_to_image, image_to_image), making them predictable.
With only 2 tools, the server is minimal but focused. The count is reasonable for a narrow image generation domain, though slightly thin.
The server covers basic text-to-image and image-to-image generation, but lacks common features like image editing (inpainting), variations, or parameter controls, leaving notable gaps.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Generate images with your own ChatGPT subscription (Plus, Pro or Team), without spending API credits
Generate AI images and videos from any compatible MCP client.
Generate AI images, video, music, and sound effects, and upscale them, from any MCP client.
LLM chat, text tools, image generation, editing and batch image jobs
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables image generation and editing using OpenAI's GPT Image API (gpt-image-1, 1.5, 2) with support for multi-image generation, history management, and batch processing.121181MIT
- FlicenseNot gradedqualityDmaintenanceProvides AI agents and coding assistants with image generation and editing capabilities using OpenAI's GPT-image-1 model, with support for local or Supabase storage.3-
- FlicenseAqualityAmaintenanceEnables AI assistants to generate images and videos via the Agnes AI API, supporting text-to-image, image-to-image, and video generation.31-
- AlicenseAqualityBmaintenanceEnables image analysis, OCR, and text-to-image generation through OpenAI-compatible APIs. Supports local paths, URLs, or base64 images with configurable models and backup endpoints.315MIT