create-image-mcp
Provides image generation and editing tools for OpenAI Codex via the MCP protocol.
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., "@create-image-mcpCreate a serene mountain landscape at sunset"
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.
Create Image MCP Server
A Model Context Protocol (MCP) server that generates and edits images using OpenAI's GPT Image model (gpt-image-1.5). This server enables Claude Desktop, Claude Code, and other MCP clients to create images from text descriptions and edit existing images.
Features
Text-to-image generation via OpenAI GPT Image model
Image editing and style transfer with input image support
Configurable size, quality, and output format
Transparent background support
Multiple image variations in a single request
Images saved to disk with text-only responses (no base64 bloat)
Retry with exponential backoff for transient failures
Related MCP server: OpenAI GPT Image MCP
Prerequisites
Node.js >= 20.0.0
OpenAI API Key
Installation
Option 1: NPM Global Install (Recommended)
npm install -g @gpriday/create-image-mcpThe create-image-mcp command will be available globally.
Option 2: Local Development Install
git clone https://github.com/gpriday/create-image-mcp.git
cd create-image-mcp
npm installConfiguration
Create a .env file in your project root or home directory (~/.env):
OPENAI_API_KEY=your_api_key_hereYou can get an OpenAI API key from OpenAI Platform.
For local development, validate your configuration with:
npm run check-envThe server will automatically load .env from:
Current working directory (
.env)Home directory (
~/.env) as fallbackOr use environment variables directly
Usage
Run the MCP Server
If installed globally:
create-image-mcpIf running locally:
npm startThe server runs on stdio and communicates via JSON-RPC 2.0.
Test the Server
npm test # Unit tests
npm run test:integration # Integration test with live API
npm run test:all # All testsAvailable Tools
create_image
Generate or edit images using OpenAI GPT Image.
Use when: user says "create an image", "generate a picture", "draw", "make an illustration", "edit an image", "transform a photo", or any visual content creation request.
Parameters:
Parameter | Required | Type | Default | Description |
| Yes | string | - | Image description or editing instructions (1-32,000 chars) |
| Yes | string | - | File path to save the generated image |
| No | array | - | File paths to input images for editing (supports PNG/JPEG/WebP/GIF, max 20MB each) |
| No | enum |
|
|
| No | enum |
|
|
| No | enum |
|
|
| No | integer |
| Number of variations (1-4) |
| No | enum |
|
|
Examples:
Generate a simple image:
{
"name": "create_image",
"arguments": {
"prompt": "A serene mountain landscape at sunset with golden light",
"output_file": "./landscape.png"
}
}Generate with specific settings:
{
"name": "create_image",
"arguments": {
"prompt": "A futuristic city skyline with flying cars, cyberpunk style",
"output_file": "./cyberpunk-city.png",
"size": "1536x1024",
"quality": "high",
"number_of_images": 2
}
}Generate with transparent background:
{
"name": "create_image",
"arguments": {
"prompt": "A minimalist flat vector logo of an owl",
"output_file": "./logo.png",
"background": "transparent"
}
}Edit an existing image:
{
"name": "create_image",
"arguments": {
"prompt": "Change the background to a beach scene",
"input_images": ["./photo.jpg"],
"output_file": "./edited-photo.png"
}
}Style transfer:
{
"name": "create_image",
"arguments": {
"prompt": "Make this image look like a watercolor painting",
"input_images": ["./source.png"],
"output_file": "./watercolor.png"
}
}Response Format:
The tool saves images to disk and returns a text-only response:
Image saved to: ./landscape.png (245.3 KB, image/png)For multiple images, files are numbered:
Image saved to: ./cyberpunk-city_1.png (312.1 KB, image/png)
Image saved to: ./cyberpunk-city_2.png (298.7 KB, image/png)Integration with Claude Desktop
Add this server to your Claude Desktop configuration.
If Installed Globally (Recommended)
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "create-image-mcp",
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "create-image-mcp",
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Linux
Edit ~/.config/Claude/claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "create-image-mcp",
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}If Running Locally
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "node",
"args": ["/path/to/create-image-mcp/src/index.js"],
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "node",
"args": ["C:\\path\\to\\create-image-mcp\\src\\index.js"],
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Linux
Edit ~/.config/Claude/claude_desktop_config.json:
{
"mcpServers": {
"create-image": {
"command": "node",
"args": ["/path/to/create-image-mcp/src/index.js"],
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}After updating the configuration, restart Claude Desktop.
Integration with Claude Code
Option 1: Project-Level mcp.json (Recommended)
Add an mcp.json file to your project root. This is the simplest approach and works automatically when Claude Code opens the project.
Note: If
OPENAI_API_KEYis already set in your shell environment (e.g. in~/.zshrc,~/.bashrc, or~/.env), you can omit theenvfield entirely.
If installed globally:
{
"mcpServers": {
"create-image": {
"command": "create-image-mcp",
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}If running locally:
{
"mcpServers": {
"create-image": {
"command": "node",
"args": ["/path/to/create-image-mcp/src/index.js"],
"env": {
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Option 2: CLI Command
For current project only:
claude mcp add --scope project create-image -e OPENAI_API_KEY=your_api_key_here -- create-image-mcpFor your user (available in all projects):
claude mcp add --scope user create-image -e OPENAI_API_KEY=your_api_key_here -- create-image-mcpVerify the server is running:
claude mcp listIntegration with OpenAI Codex
Add the MCP server using the codex mcp add command or by editing ~/.codex/config.toml.
Using CLI (Recommended)
If installed globally:
codex mcp add create-image --env OPENAI_API_KEY=your_api_key_here -- create-image-mcpIf running locally:
codex mcp add create-image --env OPENAI_API_KEY=your_api_key_here -- node /path/to/create-image-mcp/src/index.jsManual Configuration
Edit ~/.codex/config.toml:
[mcp.create-image]
command = "create-image-mcp"
env = ["OPENAI_API_KEY=your_api_key_here"]Development
Dependency Management
Semver Ranges: Dependencies use caret (
^) ranges for automatic patch/minor security updatesLockfile:
package-lock.jsonis committed for reproducible buildsCI/CD: Use
npm ci(notnpm install) to enforce lockfile versionsSecurity: Run
npm run security:auditregularly
Project Structure
create-image/
├── src/
│ └── index.js # Main MCP server
├── scripts/
│ └── check-env.js # Environment validation
├── test/
│ ├── unit/
│ │ ├── tool-handler.test.js # Unit tests
│ │ └── tool-description.test.js # Schema tests
│ └── test-create-image-mcp.js # Integration tests
├── package.json
├── package-lock.json # Committed for reproducibility
├── .env # API key (git-ignored)
├── .env.example # API key template
├── .gitignore
├── LICENSE
└── README.mdScripts
Development:
npm start- Start the MCP server (auto-runs environment validation)npm test- Run unit testsnpm run test:integration- Run integration testsnpm run test:all- Run all testsnpm run dev- Run server with auto-reload
Environment & Security:
npm run check-env- Validate environment configurationnpm run security:audit- Check for security vulnerabilitiesnpm run security:fix- Auto-fix security issuesnpm run security:update- Update dependencies and audit
Error Handling
The server provides categorized error handling:
Input Validation: Parameters validated for presence, type, length, and enum membership
[AUTH_ERROR]: Missing or invalid API keys
[QUOTA_ERROR]: API quota, rate limit, or billing errors
[TIMEOUT_ERROR]: Request timeout errors
[SAFETY_ERROR]: Content blocked by safety filters or content policy violations
[API_ERROR]: General API errors
Retry Logic: Transient failures retried with exponential backoff (up to 3 attempts)
Process Stability: Unhandled rejections and exceptions trigger clean shutdown
License
MIT
Contributing
Contributions welcome! Please open an issue or PR.
Support
For issues or questions:
Check the MCP documentation
Review OpenAI API docs
Open an issue in this repository
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gregpriday/create-image-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server