OpenAI Image Generation MCP logo

OpenAI Image Generation MCP

by jerryzhao173985

A Model Context Protocol (MCP) server for OpenAI image generation API. This MCP enables AI assistants like Claude to generate and edit images using OpenAI's GPT-image-1 model.

View on GitHub

Last updated: N/A

What is OpenAI Image Generation MCP?

This is a Model Context Protocol (MCP) server designed to facilitate image generation and editing using OpenAI's image generation models, specifically the GPT-image-1 model. It allows AI assistants like Claude to interact with OpenAI's API to create and modify images based on text prompts.

How to use OpenAI Image Generation MCP?

To use this server, you need to install it by cloning the repository and installing the dependencies. Then, configure it to connect with Claude using the provided configuration file. You can start the server using the provided scripts, ensuring you have a valid OpenAI API key. Claude can then use the available tools (oai_generate_image, oai_edit_image, health_check) to generate and edit images.

Key features of OpenAI Image Generation MCP

  • Generate images using OpenAI's image generation models

  • Edit existing images with text prompts and optional masks

  • Automatically save generated images to local storage

  • Optionally upload generated images to Cloudflare ImgBed

  • Health check endpoint to verify server status

  • Multiple ways to provide API key (env var, command line, direct)

Use cases of OpenAI Image Generation MCP

  • Integrating image generation capabilities into AI assistants

  • Creating visual content based on textual descriptions

  • Editing existing images using AI-powered tools

  • Automating image creation workflows

FAQ from OpenAI Image Generation MCP

How do I provide my OpenAI API key?

You can provide the API key through environment variables, command-line arguments, or directly in the code (for testing purposes only).

What is the recommended way to run the server in production?

The recommended way is to use the run-with-key.sh script, which embeds the API key and starts the full-featured MCP server.

How do I connect Claude to this MCP server?

You need to configure Claude with the provided JSON configuration file, pointing to the compiled build/index.js file.

Where are the generated images stored?

Generated images are automatically saved to local storage, specifically in the output/ directory.

What tools are available for Claude to use?

Claude can use the oai_generate_image, oai_edit_image, and health_check tools to generate images, edit images, and verify server status, respectively.