OpenAI GPT Image MCP
openai-gpt-图像-mcp
OpenAI 的 GPT-4o/gpt-image-1 图像生成和编辑 API 的模型上下文协议 (MCP) 工具服务器。
使用 OpenAI 的最新模型根据文本提示生成图像。
使用高级提示控制编辑图像(修复、去除修复、合成)。
支持:Claude Desktop、Cursor、VSCode、Windsurf 以及任何与 MCP 兼容的客户端。
✨ 特点
create-image :根据提示生成图像,并带有高级选项(大小、质量、背景等)。
edit-image :使用提示和可选掩码编辑或扩展图像,支持文件路径和 base64 输入。
文件输出:将生成的图像直接保存到磁盘,或以 base64 形式接收。
Related MCP server: imagegen-mcp
🚀 安装
git clone https://github.com/SureScaleAI/openai-gpt-image-mcp.git
cd openai-gpt-image-mcp
yarn install
yarn build🔑 配置
添加到 Claude Desktop 或 VSCode(包括 Cursor/Windsurf)配置:
{
"mcpServers": {
"openai-gpt-image-mcp": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}⚡ 高级
对于
create-image,设置n以一次生成最多 10 张图像。对于
edit-image,提供一个遮罩图像(文件路径或 base64)来控制编辑的应用位置。请参阅
src/index.ts了解所有选项。
🧑💻开发
TypeScript 源代码:
src/index.ts构建:
yarn build运行:
node dist/index.js
📝 许可证
麻省理工学院
🩺 故障排除
确保您的
OPENAI_API_KEY有效并且具有图像 API 访问权限。您必须拥有一个经过验证的 OpenAI 组织。验证后,可能需要 15-20 分钟才能激活图像 API 访问权限。
文件路径必须是绝对路径。
对于文件输出,请确保目录是可写的。
如果您发现有关文件类型的错误,请检查图像文件扩展名和格式。
⚠️ 限制和大文件处理
1MB 有效负载限制: MCP 客户端(包括 Claude Desktop)对工具响应的大小有 1MB 的硬性限制。大图像(尤其是高分辨率或多幅图像)如果以 base64 格式返回,很容易超出此限制。
**自动切换到文件输出:**如果图片总大小超过 1MB,该工具将自动将图片保存到磁盘并返回文件路径(而非 base64 编码)。这确保了兼容性,并避免了诸如
result exceeds maximum length of 1048576类的错误。**默认文件位置:**如果您未指定
file_output路径,图像将以唯一的文件名保存到/tmp(或MCP_HF_WORK_DIR环境变量设置的目录)。环境变量:
MCP_HF_WORK_DIR:设置此项以控制大图像和文件输出的保存位置。例如:export MCP_HF_WORK_DIR=/your/desired/dir
**最佳实践:**对于大型或生产图像,始终使用文件输出并确保您的客户端配置为处理文件路径。
📚 参考文献
🙏 致谢
使用openai Node.js SDK
由SureScale.ai构建
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
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 AI images and videos from any compatible MCP client.
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Generate AI images, video, music, and sound effects, and upscale them, from any MCP client.
MCP server for Qwen Image 3 AI image generation
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server for generating and editing images using OpenAI's GPT Image and DALL·E models. It provides tools for image generation, editing, variation creation, and model listing with support for multiple AI models.4-
- AlicenseNot gradedqualityDmaintenanceMCP server that wraps OpenAI's image generation and editing APIs, enabling text-to-image and image-to-image operations via tools.20437ISC
- 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-
- AlicenseAqualityDmaintenanceAn MCP server that generates and edits images using OpenAI's GPT Image model, allowing users to create images from text descriptions and edit existing images through natural language.117MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/SureScaleAI/openai-gpt-image-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server