openai-gpt-image-mcp

MCP.Pizza Chef: SureScaleAI

Two tools do the work: one makes a new picture from a written description, the other edits one you already have, optionally through a mask that marks the area to change. You bring your own paid OpenAI account and every picture is charged to it. Setup means downloading the code and building it yourself, because nothing is published ready-made. Saved files land wherever the assistant decides to put them and overwrite whatever was already there. Nothing has changed in this copy since May 2025.

Unmaintained ยท No commits in 14 months.
Images/Design

Use This MCP server To

Create a logo idea from a written description Remove an unwanted object from a photo I already have Extend a photo's background to fit a wider frame Generate several variations of one image at once Save a finished picture straight into a folder I name Make a transparent-background version of an illustration

README

openai-gpt-image-mcp

MCP SDK OpenAI SDK License GitHub stars Build Status


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

  • Generate images from text prompts using OpenAI's latest models.
  • Edit images (inpainting, outpainting, compositing) with advanced prompt control.
  • Supports: Claude Desktop, Cursor, VSCode, Windsurf, and any MCP-compatible client.

โœจ Features

  • create-image: Generate images from a prompt, with advanced options (size, quality, background, etc).
  • edit-image: Edit or extend images using a prompt and optional mask, supporting both file paths and base64 input.
  • File output: Save generated images directly to disk, or receive as base64.

๐Ÿš€ Installation

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

๐Ÿ”‘ Configuration

Add to Claude Desktop or VSCode (including Cursor/Windsurf) config:

{
  "mcpServers": {
    "openai-gpt-image-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/dist/index.js"],
      "env": { "OPENAI_API_KEY": "sk-..." }
    }
  }
}

Also supports Azure deployments:

{
  "mcpServers": {
    "openai-gpt-image-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/dist/index.js"],
      "env": { 
        "AZURE_OPENAI_API_KEY": "sk-...",
        "AZURE_OPENAI_ENDPOINT": "my.endpoint.com",
        "OPENAI_API_VERSION": "2024-12-01-preview"
      }
    }
  }
}

Also supports supplying an environment files:

{
  "mcpServers": {
    "openai-gpt-image-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/dist/index.js", "--env-file", "./deployment/.env"]
    }
  }
}

โšก Advanced

  • For create-image, set n to generate up to 10 images at once.
  • For edit-image, provide a mask image (file path or base64) to control where edits are applied.
  • Provide an environment file with --env-file path/to/file/.env
  • See src/index.ts for all options.

๐Ÿง‘โ€๐Ÿ’ป Development

  • TypeScript source: src/index.ts
  • Build: yarn build
  • Run: node dist/index.js

๐Ÿ“ License

MIT


๐Ÿฉบ Troubleshooting

  • Make sure your OPENAI_API_KEY is valid and has image API access.
  • You must have a verified OpenAI organization. After verifying, it can take 15โ€“20 minutes for image API access to activate.
  • File paths must be absolute.
    • Unix/macOS/Linux: Starting with / (e.g., /path/to/image.png)
    • Windows: Drive letter followed by : (e.g., C:/path/to/image.png or C:\path\to\image.png)
  • For file output, ensure the directory is writable.
  • If you see errors about file types, check your image file extensions and formats.

โš ๏ธ Limitations & Large File Handling

  • 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.
  • 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.
  • 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.
  • Environment Variable:
    • 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
  • Best Practice: For large or production images, always use file output and ensure your client is configured to handle file paths.

๐Ÿ“š References


๐Ÿ™ Credits

openai-gpt-image-mcp FAQ

Do I need to pay for anything?
Yes. You need an OpenAI account with credit on it, and the organisation has to be verified before the picture model will work at all. Verification can take fifteen to twenty minutes to take effect. Each picture is billed, and large high-quality ones cost noticeably more than small rough ones.
How hard is setup?
This is a developer job. There is no ready-made package to fetch, so you download the code, install its parts, build it, and then point your assistant at the built file.
Does it work with Microsoft's version of OpenAI?
Yes. If you supply Azure credentials instead of the standard ones, it switches over on its own with no other changes.
Where do my pictures end up?
Small ones come straight back into the chat. Anything over about one megabyte is saved to a file instead, silently, and unless you set a folder of your own it lands in your machine's temporary directory, where it may later be cleared away.
Can it overwrite my files?
Yes, and this is worth knowing. It writes to whichever full path is chosen at the time, with no confirmation and no check for a file already sitting there. Give it a scratch folder rather than a folder of work you care about.
Is it still maintained?
This copy is a fork of someone else's project and has not been touched since May 2025, so expect no updates as OpenAI's picture models change.
Can I use this to make product photos for a shop listing?
Yes, that is a good fit. Describe the product and the setting, or hand it a photo and describe the change you want.
Anything else I should know?
Two things. The strength of OpenAI's own content filter is offered as an ordinary setting, so the assistant can ask for it to be relaxed on any request. And the program writes a plain-text startup line onto the same channel it uses to talk to your assistant, which some apps report as a failure to start.