OpenAI Image Generation MCP
About
OpenAI Image Generation MCP that enables server to generate and edit images using OpenAI's gpt-image-1 api modes.
Details
- Author
- jerryzhao173985
- Downloads
- 324
- Categories
- AI
Jump to
- Generate images from text prompts
- Edit existing images with optional masks
- Automatically saves generated images to local storage
- Optionally uploads images to Cloudflare ImgBed
- Health check endpoint for server status verification
- Multiple ways to provide the OpenAI API key
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
OpenAI Image Generation MCPCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Clone the repository, install dependencies (npm install), and build the TypeScript project (npm run build). Start the server with the provided run script (./run-with-key.sh), a direct‑key script (node hardcoded-key.js), or by setting the OPENAI_API_KEY environment variable and running ./start.sh. Configure Claude to use the compiled build/index.js via the mcpServers JSON entry.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"openai image generation mcp": {
"openai-image-gen-mcp": {
"command": "node",
"args": [
"hardcoded-key.js"
]
}
}
}
}
McpServers
{
"openai-image-gen-mcp": {
"command": "node",
"args": [
"hardcoded-key.js"
]
}
}
OpenAI Image Generation MCP
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.
Table of Contents
- Features
- Installation
- Quick Start
- Configuration
- Detailed Documentation
- License
Features
- 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)
Installation
1. Clone the repository and install dependencies:
git clone https://github.com/yourusername/openai-image-gen-mcp.git
cd openai-image-gen-mcp
npm install
2. Build the TypeScript project:
npm run build
Quick Start
1. Using the Run Script (Recommended for Production)
The easiest way to start the full-featured MCP server:
./run-with-key.sh
This script has the API key embedded and starts the MCP server with all features.
2. Using Direct API Key (For Testing)
node hardcoded-key.js
This is a simplified version with the API key directly embedded in the code.
3. Using Environment Variables
export OPENAI_API_KEY=your-api-key
./start.sh
Configuration
Claude MCP Configuration
To connect Claude to this MCP, use this configuration file:
{
"mcpServers": {
"openai-image-gen": {
"command": "node",
"args": ["/Users/jerry/openai-image-gen-mcp/build/index.js"]
}
}
}
⚠️ IMPORTANT: Use the full-featured compiled version (build/index.js) for production. The simplified versions are for testing and education only.
Available Tools
The MCP provides these tools to Claude:
1. oai_generate_image - Generate images from text prompts
2. oai_edit_image - Edit existing images with text prompts
3. health_check - Verify the server's health status
Example usage in Claude:
Generate an image of a sunset over mountains with a lake in the foreground.
Claude will use the appropriate MCP tool to create the image.
Detailed Documentation
For more detailed information, please see:
- Architecture - System design and components
- Pipeline - Development and request processing pipeline
- Guidelines - Best practices and usage guidelines
- Explanation - Detailed explanation of the code and APIs
Directory Structure
openai-image-gen-mcp/
├── build/ # Compiled JavaScript code
├── docs/ # Documentation files
├── output/ # Generated images
├── src/ # TypeScript source code
│ ├── config.js # Configuration management
│ └── index.ts # Main MCP server implementation
├── .sh # Helper scripts
├── .js # Simplified versions and utilities
└── *.json # Configuration files
Troubleshooting
If you encounter problems:
1. Check that your API key is valid and properly formatted
2. Ensure the output directory exists and is writable
3. Run the health check to verify server status
4. Check logs for detailed error information
5. Try the simplified version to isolate issues
For more help, see the Troubleshooting section in the guidelines.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
