Skip to main content
Glama

OpenAI GPT Image MCP

by SureScaleAI

openai-gpt-图像-mcp


OpenAI 的 GPT-4o/gpt-image-1 图像生成和编辑 API 的模型上下文协议 (MCP) 工具服务器。

  • 使用 OpenAI 的最新模型根据文本提示生成图像
  • 使用高级提示控制编辑图像(修复、去除修复、合成)。
  • 支持:Claude Desktop、Cursor、VSCode、Windsurf 以及任何与 MCP 兼容的客户端。

✨ 特点

  • create-image :根据提示生成图像,并带有高级选项(大小、质量、背景等)。
  • edit-image :使用提示和可选掩码编辑或扩展图像,支持文件路径和 base64 输入。
  • 文件输出:将生成的图像直接保存到磁盘,或以 base64 形式接收。

🚀 安装

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
  • **最佳实践:**对于大型或生产图像,始终使用文件输出并确保您的客户端配置为处理文件路径。

📚 参考文献


🙏 致谢

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

一个 MCP 工具服务器,可通过 OpenAI 的图像模型生成和编辑图像,支持跨各种 MCP 兼容客户端的文本到图像生成和高级图像编辑(修复、去除)。

  1. ✨ 特点
    1. 🚀 安装
      1. 🔑 配置
        1. ⚡ 高级
          1. 🧑‍💻开发
            1. 📝 许可证
              1. 🩺 故障排除
                1. ⚠️ 限制和大文件处理
                  1. 📚 参考文献
                    1. 🙏 致谢

                      Related MCP Servers

                      • -
                        security
                        F
                        license
                        -
                        quality
                        An MCP server that allows users to generate, edit, and create variations of images through OpenAI's DALL-E API, supporting both DALL-E 2 and DALL-E 3 models.
                        Last updated -
                        2
                        TypeScript
                      • A
                        security
                        F
                        license
                        A
                        quality
                        An MCP (Model Context Protocol) server that allows generating, editing, and creating variations of images using OpenAI's DALL-E APIs.
                        Last updated -
                        1
                        TypeScript
                      • -
                        security
                        A
                        license
                        -
                        quality
                        Provides tools for generating and editing images using OpenAI's gpt-image-1 model via an MCP interface, enabling AI assistants to create and modify images based on text prompts.
                        Last updated -
                        10
                        Python
                        Apache 2.0
                        • Linux
                        • Apple
                      • A
                        security
                        A
                        license
                        A
                        quality
                        An MCP server that allows Claude to use OpenAI's image generation capabilities (gpt-image-1) to create image assets for users, which is particularly useful for game and web development projects.
                        Last updated -
                        1
                        JavaScript
                        MIT License

                      View all related MCP servers

                      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