OpenAI GPT Image MCP Server

MCP server for working with OpenAI GPT-4o/gpt-image-1 image generation and editing APIs, supporting image creation from text prompts and advanced editing capabilities.

Get this MCP server

MCP server for working with OpenAI GPT-4o/gpt-image-1 image generation and editing APIs, supporting image creation from text prompts and advanced editing capabilities.

Installation

From Source Code

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

Configuration

Claude Desktop/VSCode/Cursor/Windsurf

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

Azure OpenAI Configuration

{
  "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"
      }
    }
  }
}

With Environment File

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

Available Tools

Tool Description
create-image Generates images from prompts with advanced options (size, quality, background, etc.)
edit-image Edits or extends images using a prompt and optional mask, supports both file paths and base64

Features

  • Image generation from text prompts using the latest OpenAI models
  • Image editing (inpainting, outpainting, compositing) with advanced control through prompts
  • Support for Claude Desktop, Cursor, VSCode, Windsurf, and any MCP-compatible clients
  • File output: save generated images directly to disk or retrieve as base64
  • Generate up to 10 images simultaneously using create-image
  • Mask support for controlling editing areas
  • Automatic file output switching for large images exceeding the 1MB limit

Environment Variables

Required

  • OPENAI_API_KEY - OpenAI API key for accessing the image generation API

Optional

  • AZURE_OPENAI_API_KEY - Azure OpenAI API key for Azure deployments
  • AZURE_OPENAI_ENDPOINT - Azure OpenAI endpoint URL
  • OPENAI_API_VERSION - OpenAI API version for Azure deployments
  • MCP_HF_WORK_DIR - Directory for saving large images and file outputs

Notes

A verified OpenAI organization is required to access the image API. After verification, activating image API access may take 15-20 minutes. MCP clients have a 1MB limit, so large images are automatically saved to disk. File paths must be absolute. Configuration via environment file with the --env-file flag is supported.

Comments (0)

Sign In Sign in to leave a comment.

Spark Drops

Weekly picks: best new AI tools, agents & prompts

Venture Crew
Terms of Service

© 2026, Venture Crew