Skip to main content

OpenAI Image Generation MCP

Model Context Protocol (MCP) server for AI assistants to generate and edit images using OpenAI's GPT-image-1 model.

Features

  • Generate images from text prompts
  • Edit images with reference images and optional masks
  • Save generated/edited images to local storage
  • Handle errors gracefully

Installation

Install from PyPI:

pip install openai-gpt-image-1-mcp

Prerequisites

  • Python 3.10 or higher
  • OpenAI API key (set as environment variable OPENAI_API_KEY)

Usage

Starting the MCP Server

After installation, you can start the MCP server using the following command:

openai-gpt-image-1-mcp

Or run it directly as a module:

python -m openai_gpt_image_1_server

Configuring with Claude Desktop

To use this MCP with Claude Desktop or similar tools, add the following configuration to your mcp_config.json file:

"openai-gpt-image-1-mcp": {
  "autoApprove": [
    "generate_image",
    "edit_image"
  ],
  "disabled": false,
  "timeout": 180,
  "command": "openai-gpt-image-1-mcp",
  "env": {
    "OPENAI_API_KEY": "your_openai_api_key_here"
  },
  "transportType": "stdio"
}

For UV package manager

"openai-gpt-image-1-mcp": {
  "autoApprove": [
    "generate_image",
    "edit_image"
  ],
  "disabled": false,
  "timeout": 180,
  "command": "uv",
  "args": [
    "run",
    "openai-gpt-image-1-mcp"
  ],
  "env": {
    "OPENAI_API_KEY": "your_openai_api_key_here"
  },
  "transportType": "stdio"
}

For direct execution (without PyPI)

If you cloned the repository and want to run it directly:

"openai-gpt-image-1-mcp": {
  "autoApprove": [
    "generate_image",
    "edit_image"
  ],
  "disabled": false,
  "timeout": 180,
  "command": "python",
  "args": [
    "/absolute/path/to/your/cloned/repo/openai_gpt_image_1_mcp/openai_gpt_image_1_server/__init__.py"
  ],
  "env": {
    "OPENAI_API_KEY": "your_openai_api_key_here"
  },
  "transportType": "stdio"
}

Configuration parameters explained:

  • autoApprove: List of tool methods that can be called without user confirmation
  • disabled: Set to true to disable this MCP
  • timeout: Maximum time (in seconds) allowed for image generation operations
  • command & args: The command to start the MCP server
  • env: Environment variables needed by the MCP (requires your OpenAI API key)
  • transportType: Communication protocol used (keep as "stdio")

API Tools

generate_image

Generate an image from a text prompt.

Parameters:

  • prompt (string, required): Text description of the desired image
  • model (string, optional): Model to use, default is "gpt-image-1"
  • n (integer, optional): Number of images to generate, default is 1
  • size (string, optional): Image dimensions, options: "1024x1024", "1536x1024", "1024x1536", "auto"
  • quality (string, optional): Rendering quality, options: "low", "medium", "high", "auto"
  • user (string, optional): Unique identifier for the end-user
  • save_filename (string, optional): Custom filename without extension

Returns:

  • Success: {"status": "success", "saved_path": "/path/to/image.png"}
  • Error: {"status": "error", "message": "Error details"}

edit_image

Edit an image or create variations based on reference images and an optional mask.

Parameters:

  • prompt (string, required): Text description of the desired final image
  • image_paths (array of strings, required): List of paths to input images
  • mask_path (string, optional): Path to mask image for inpainting
  • model (string, optional): Model to use, default is "gpt-image-1"
  • n (integer, optional): Number of images to generate, default is 1
  • size (string, optional): Image dimensions, options: "1024x1024", "1536x1024", "1024x1536", "auto"
  • quality (string, optional): Rendering quality, options: "low", "medium", "high", "auto"
  • user (string, optional): Unique identifier for the end-user
  • save_filename (string, optional): Custom filename without extension

Returns:

  • Success: {"status": "success", "saved_path": "/path/to/image.png"}
  • Error: {"status": "error", "message": "Error details"}

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key (required)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for openai-gpt-image-1-mcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-gpt-image-1-mcp 0.1.3
File Size Uploaded Provenance
openai_gpt_image_1_mcp-0.1.3.tar.gz 9.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-gpt-image-1-mcp 0.1.3
File Interpreter ABI Platform
openai_gpt_image_1_mcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / openai_gpt_image_1_mcp-0.1.3.tar.gz

Download URL openai_gpt_image_1_mcp-0.1.3.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
51eeb022dfea696157c8288d31918bbe891eb57bb128d5a8785c9b79dde4e0a3
BLAKE2b-256 checksum
How to use checksums
e26814d0440fc19279369d634e242440f082ef58d47c6f29d76598feb02e9da7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / openai_gpt_image_1_mcp-0.1.3-py3-none-any.whl

Download URL openai_gpt_image_1_mcp-0.1.3-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47eecd8dc9377a2e12625da7e30b813932e240f1ffe1a35803c1654ade5855b4
BLAKE2b-256 checksum
How to use checksums
9c1c8ff5915898962071b2e634e31c7276b63c3c974fc55c4ab26fdacefc91cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Security for openai-gpt-image-1-mcp 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page