Skip to content
Back to search

openai-gpt-image-mcp

A Model Context Protocol (MCP) tool server for OpenAI's GPT-4o/gpt-image-1 image generation and editing APIs.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/surescaleai--openai-gpt-image-mcp/badge.svg)](/listings/surescaleai--openai-gpt-image-mcp)

HTML

<a href="/listings/surescaleai--openai-gpt-image-mcp"><img src="/api/listings/surescaleai--openai-gpt-image-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

git clone https://github.com/SureScaleAI/openai-gpt-image-mcp.git
cd openai-gpt-image-mcp
yarn install
yarn build

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 146 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # openai-gpt-image-mcp
  2. <p align="center">
  3. <a href="https://www.npmjs.com/package/@modelcontextprotocol/sdk"><img src="https://img.shields.io/npm/v/@modelcontextprotocol/sdk?label=MCP%20SDK&color=blue" alt="MCP SDK"></a>
  4. <a href="https://www.npmjs.com/package/openai"><img src="https://img.shields.io/npm/v/openai?label=OpenAI%20SDK&color=blueviolet" alt="OpenAI SDK"></a>
  5. <a href="https://github.com/SureScaleAI/openai-gpt-image-mcp/blob/main/LICENSE"><img src="https://img.shields.io/github/license/SureScaleAI/openai-gpt-image-mcp?color=brightgreen" alt="License"></a>
  6. <a href="https://github.com/SureScaleAI/openai-gpt-image-mcp/stargazers"><img src="https://img.shields.io/github/stars/SureScaleAI/openai-gpt-image-mcp?style=social" alt="GitHub stars"></a>
  7. <a href="https://github.com/SureScaleAI/openai-gpt-image-mcp/actions"><img src="https://img.shields.io/github/actions/workflow/status/SureScaleAI/openai-gpt-image-mcp/main.yml?label=build&logo=github" alt="Build Status"></a>
  8. </p>
  9. ---
  10. A Model Context Protocol (MCP) tool server for OpenAI's GPT-4o/gpt-image-1 image generation and editing APIs.
  11. - **Generate images** from text prompts using OpenAI's latest models.
  12. - **Edit images** (inpainting, outpainting, compositing) with advanced prompt control.
  13. - **Supports**: Claude Desktop, Cursor, VSCode, Windsurf, and any MCP-compatible client.
  14. ---
  15. ## ✨ Features
  16. - **create-image**: Generate images from a prompt, with advanced options (size, quality, background, etc).
  17. - **edit-image**: Edit or extend images using a prompt and optional mask, supporting both file paths and base64 input.
  18. - **File output**: Save generated images directly to disk, or receive as base64.
  19. ---
  20. ## 🚀 Installation
  21. ```sh
  22. git clone https://github.com/SureScaleAI/openai-gpt-image-mcp.git
  23. cd openai-gpt-image-mcp
  24. yarn install
  25. yarn build
  26. ```
  27. ---
  28. ## 🔑 Configuration
  29. Add to Claude Desktop or VSCode (including Cursor/Windsurf) config:
  30. ```json
  31. {
  32. "mcpServers": {
  33. "openai-gpt-image-mcp": {
  34. "command": "node",
  35. "args": ["/absolute/path/to/dist/index.js"],
  36. "env": { "OPENAI_API_KEY": "sk-..." }
  37. }
  38. }
  39. }
  40. ```
  41. Also supports Azure deployments:
  42. ```json
  43. {
  44. "mcpServers": {
  45. "openai-gpt-image-mcp": {
  46. "command": "node",
  47. "args": ["/absolute/path/to/dist/index.js"],
  48. "env": {
  49. "AZURE_OPENAI_API_KEY": "sk-...",
  50. "AZURE_OPENAI_ENDPOINT": "my.endpoint.com",
  51. "OPENAI_API_VERSION": "2024-12-01-preview"
  52. }
  53. }
  54. }
  55. }
  56. ```
  57. Also supports supplying an environment files:
  58. ```json
  59. {
  60. "mcpServers": {
  61. "openai-gpt-image-mcp": {
  62. "command": "node",
  63. "args": ["/absolute/path/to/dist/index.js", "--env-file", "./deployment/.env"]
  64. }
  65. }
  66. }
  67. ```
  68. ---
  69. ## ⚡ Advanced
  70. - For `create-image`, set `n` to generate up to 10 images at once.
  71. - For `edit-image`, provide a mask image (file path or base64) to control where edits are applied.
  72. - Provide an environment file with `--env-file path/to/file/.env`
  73. - See `src/index.ts` for all options.
  74. ---
  75. ## 🧑‍💻 Development
  76. - TypeScript source: `src/index.ts`
  77. - Build: `yarn build`
  78. - Run: `node dist/index.js`
  79. ---
  80. ## 📝 License
  81. MIT
  82. ---
  83. ## 🩺 Troubleshooting
  84. - Make sure your `OPENAI_API_KEY` is valid and has image API access.
  85. - You must have a [verified OpenAI organization](https://platform.openai.com/account/organization). After verifying, it can take 15–20 minutes for image API access to activate.
  86. - File paths must be absolute.
  87. - **Unix/macOS/Linux**: Starting with `/` (e.g., `/path/to/image.png`)
  88. - **Windows**: Drive letter followed by `:` (e.g., `C:/path/to/image.png` or `C:\path\to\image.png`)
  89. - For file output, ensure the directory is writable.
  90. - If you see errors about file types, check your image file extensions and formats.
  91. ---
  92. ## ⚠️ Limitations & Large File Handling
  93. - **1MB Payload Limit:** MCP clients (including Claude Desktop) have a hard 1MB limit for tool responses. Large images (especially high-res or multiple images) can easily exceed this limit if returned as base64.
  94. - **Auto-Switch to File Output:** If the total image size exceeds 1MB, the tool will automatically save images to disk and return the file path(s) instead of base64. This ensures compatibility and prevents errors like `result exceeds maximum length of 1048576`.
  95. - **Default File Location:** If you do not specify a `file_output` path, images will be saved to `/tmp` (or the directory set by the `MCP_HF_WORK_DIR` environment variable) with a unique filename.
  96. - **Environment Variable:**
  97. - `MCP_HF_WORK_DIR`: Set this to control where large images and file outputs are saved. Example: `export MCP_HF_WORK_DIR=/your/desired/dir`
  98. - **Best Practice:** For large or production images, always use file output and ensure your client is configured to handle file paths.
  99. ---
  100. ## 📚 References
  101. - [OpenAI Images API Documentation](https://platform.openai.com/docs/api-reference/images)
  102. ---
  103. ## 🙏 Credits
  104. - Built with [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
  105. - Uses [openai](https://www.npmjs.com/package/openai) Node.js SDK
  106. - Built by [SureScale.ai](https://surescale.ai)
  107. - Contributions from [Axle Research and Technology](https://axleinfo.com/)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.