Enables image generation using OpenAI's models, including DALL-E 3, DALL-E 2, GPT-Image-1, and GPT-Image-1-Mini, with support for advanced controls like transparency and custom output formats.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenAI Image Generation MCP Servercreate a futuristic cyberpunk city and save it to ~/Downloads/city.png"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenAI Image Generation MCP Server
A TypeScript-based Model Context Protocol (MCP) server for generating images using OpenAI's image generation models (gpt-image-1, gpt-image-1-mini, DALL-E 3, and DALL-E 2).
Quick Start with npx
The easiest way to use this MCP server is with npx (no installation required):
This will start the MCP server with stdio transport. You'll need to set the OPENAI_API_KEY environment variable:
Installation
You can also install the package globally:
Then run it with:
Development Setup
For local development:
Clone this repository
Install dependencies:
npm installCreate a
.envfile based on.env.exampleand add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_hereBuild the TypeScript code:
npm run build
Running the MCP Server
Start the MCP server:
Development
For development with automatic compilation:
MCP Server Configuration
To use this as an MCP server with Claude or other MCP clients, you need to add it to your MCP settings configuration file.
Using npx (Recommended)
The easiest way is to use npx directly in your MCP configuration:
Using local installation
If you have the package installed globally or locally, you can use the direct command:
Using from source (Development)
For local development with the cloned repository:
Important: Replace "your_openai_api_key_here" with your actual OpenAI API key. The MCP server will use this key to authenticate with the OpenAI API.
Copy this configuration to your MCP settings file, typically located at:
VS Code
VS Code has native MCP support. Add the configuration to your workspace or user settings:
Location: .vscode/mcp.json (in your workspace root)
Using npx:
Using local installation:
Important:
Replace
/absolute/path/to/openai-image-mcpwith the actual absolute path to your cloned repositoryReplace
"your_openai_api_key_here"with your actual OpenAI API key
Claude Desktop
Location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
Use the npx configuration format shown above.
API Key Configuration
The MCP server requires an OpenAI API key to function. There are two ways to provide this key:
Environment Variable: If you're running the server directly with
npm start, it will use the OPENAI_API_KEY from your.envfile.MCP Settings: When configuring the server in your MCP settings file, you need to provide the API key in the
envsection as shown above. This key will be passed to the server as an environment variable.
Usage
Once the MCP server is configured in Claude, you can use one of the four image generation tools to create images based on text prompts. Each tool is optimized for a specific OpenAI model.
Available Tools
1. generate_image_gpt - GPT-Image-1 Model
Generate images using OpenAI's gpt-image-1 model with advanced features like transparency and custom output formats.
Parameters:
prompt(required): A text description of the desired image (max 32,000 characters)output(required): File path where the generated image should be saved (e.g.,/path/to/image.png)size(optional): Image size. Options: "1024x1024", "1536x1024", "1024x1536", "auto". Default: "auto"quality(optional): Image quality. Options: "low", "medium", "high", "auto". Default: "auto"background(optional): Background transparency. Options: "transparent", "opaque", "auto". Default: "auto"output_format(optional): Output image format. Options: "png", "jpeg", "webp". Default: "png"output_compression(optional): Compression level (0-100) for webp/jpeg formats. Default: 100moderation(optional): Content moderation level. Options: "low", "auto". Default: "auto"n(optional): Number of images to generate (1-10). Default: 1
2. generate_image_gpt_mini - GPT-Image-1-Mini Model
Generate images using OpenAI's gpt-image-1-mini model. Cost-efficient alternative to gpt-image-1 with the same advanced features like transparency and custom output formats.
Parameters:
prompt(required): A text description of the desired image (max 32,000 characters)output(required): File path where the generated image should be saved (e.g.,/path/to/image.png)size(optional): Image size. Options: "1024x1024", "1536x1024", "1024x1536", "auto". Default: "auto"quality(optional): Image quality. Options: "low", "medium", "high", "auto". Default: "auto"background(optional): Background transparency. Options: "transparent", "opaque", "auto". Default: "auto"output_format(optional): Output image format. Options: "png", "jpeg", "webp". Default: "png"output_compression(optional): Compression level (0-100) for webp/jpeg formats. Default: 100moderation(optional): Content moderation level. Options: "low", "auto". Default: "auto"n(optional): Number of images to generate (1-10). Default: 1
3. generate_image_dalle3 - DALL-E 3 Model
Generate high-quality images using OpenAI's DALL-E 3 model with style control.
Parameters:
prompt(required): A text description of the desired image (max 4,000 characters)output(required): File path where the generated image should be savedsize(optional): Image size. Options: "1024x1024", "1792x1024", "1024x1792". Default: "1024x1024"quality(optional): Image quality. Options: "standard", "hd". Default: "standard"style(optional): Image style. Options: "vivid" (hyper-real and dramatic), "natural" (more natural, less hyper-real). Default: "vivid"
Note: DALL-E 3 can only generate 1 image at a time (n is always 1).
4. generate_image_dalle2 - DALL-E 2 Model
Generate images using OpenAI's DALL-E 2 model. Fast and cost-effective option.
Parameters:
prompt(required): A text description of the desired image (max 1,000 characters)output(required): File path where the generated image should be savedsize(optional): Image size. Options: "256x256", "512x512", "1024x1024". Default: "1024x1024"n(optional): Number of images to generate (1-10). Default: 1