Skip to main content
Glama

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: GPT Image MCP Server

Prerequisites

  • Node.js >= 20.0.0

  • OpenAI API Key

Installation

npm install -g @gpriday/create-image-mcp

The 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 install

Configuration

Create a .env file in your project root or home directory (~/.env):

OPENAI_API_KEY=your_api_key_here

You can get an OpenAI API key from OpenAI Platform.

For local development, validate your configuration with:

npm run check-env

The server will automatically load .env from:

  1. Current working directory (.env)

  2. Home directory (~/.env) as fallback

  3. Or use environment variables directly

Usage

Run the MCP Server

If installed globally:

create-image-mcp

If running locally:

npm start

The 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 tests

Available 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

prompt

Yes

string

-

Image description or editing instructions (1-32,000 chars)

output_file

Yes

string

-

File path to save the generated image

input_images

No

array

-

File paths to input images for editing (supports PNG/JPEG/WebP/GIF, max 20MB each)

size

No

enum

1024x1024

1024x1024, 1024x1536, 1536x1024, auto

quality

No

enum

auto

low, medium, high, auto

background

No

enum

auto

transparent, opaque, auto

number_of_images

No

integer

1

Number of variations (1-4)

output_mime_type

No

enum

image/png

image/png, image/jpeg, image/webp

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.

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_KEY is already set in your shell environment (e.g. in ~/.zshrc, ~/.bashrc, or ~/.env), you can omit the env field 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-mcp

For your user (available in all projects):

claude mcp add --scope user create-image -e OPENAI_API_KEY=your_api_key_here -- create-image-mcp

Verify the server is running:

claude mcp list

Integration with OpenAI Codex

Add the MCP server using the codex mcp add command or by editing ~/.codex/config.toml.

If installed globally:

codex mcp add create-image --env OPENAI_API_KEY=your_api_key_here -- create-image-mcp

If running locally:

codex mcp add create-image --env OPENAI_API_KEY=your_api_key_here -- node /path/to/create-image-mcp/src/index.js

Manual 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 updates

  • Lockfile: package-lock.json is committed for reproducible builds

  • CI/CD: Use npm ci (not npm install) to enforce lockfile versions

  • Security: Run npm run security:audit regularly

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.md

Scripts

Development:

  • npm start - Start the MCP server (auto-runs environment validation)

  • npm test - Run unit tests

  • npm run test:integration - Run integration tests

  • npm run test:all - Run all tests

  • npm run dev - Run server with auto-reload

Environment & Security:

  • npm run check-env - Validate environment configuration

  • npm run security:audit - Check for security vulnerabilities

  • npm run security:fix - Auto-fix security issues

  • npm 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:

  1. Check the MCP documentation

  2. Review OpenAI API docs

  3. Open an issue in this repository

Available Tools

1 tool
create_imageA

Generate or edit images using OpenAI GPT Image. Use when asked to 'create an image', 'generate a picture', 'draw', 'make an illustration', 'edit an image', 'transform a photo', or any visual content creation request. Supports image input for editing and style transfer.

ParametersJSON Schema
NameRequiredDescriptionDefault
maskNoFile path to a PNG image with an alpha channel to use as a mask for targeted inpainting. Transparent areas of the mask indicate where the image should be edited. Only used with the edit endpoint (when input_images is provided).
sizeNoSize of the generated image. '1024x1024' for square, '1024x1536' for portrait, '1536x1024' for landscape, or 'auto' to let the model decide.1024x1024
styleNoOptional style preset that guides image generation towards a specific visual style.
promptYesA detailed description of the image to generate, or editing instructions when input images are provided. Be specific about style, composition, colors, mood, and subject matter for best results.
qualityNoQuality of the generated image. 'high' produces the most detailed output, 'medium' balances quality and speed, 'low' is fastest, 'auto' lets the model decide.auto
backgroundNoBackground style for the generated image. 'transparent' generates images with a transparent background (requires PNG or WebP output), 'opaque' forces a solid background, 'auto' lets the model decide.auto
output_fileYesFile path to save the generated image. Supports both absolute paths (/Users/name/image.png) and relative paths (./output/image.png). The image will be written to this path and the path returned in the response.
input_imagesNoFile paths to input images for editing or style reference. Supports PNG, JPEG, WebP, and GIF formats. Max 20MB per image. When provided, the prompt should describe how to modify or use these images. Accepts a single path string, a JSON-encoded array string, or an array of strings.
input_fidelityNoControls how strictly the output image preserves the original input image details. 'high' preserves more details, 'low' allows more creative freedom. Only used with the edit endpoint (when input_images is provided).
number_of_imagesNoNumber of image variations to generate (1-4). Multiple images are saved with numbered filenames (e.g., output_1.png, output_2.png).
output_mime_typeNoOutput image format. 'image/png' supports transparency, 'image/jpeg' for smaller file sizes, 'image/webp' for modern web use.image/png
system_message_fileNoFile path to a text file containing system-level instructions. The file contents are prepended to the prompt (truncated to 4000 chars). Use for persistent style guidelines, brand constraints, or negative constraints. Since the OpenAI images API does not support a native system role, the content is prepended to the prompt.

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only restates the tool's purpose and the fact that it supports image input, but does not disclose side effects like writing output to files, number of generated variants, or model limitations. The rich parameter descriptions help, but behavioral transparency beyond structured schema is minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core action, and every sentence adds value by providing usage triggers and capability context. There is no redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is complex with 12 parameters, but the schema is highly descriptive and covers all parameters with examples and defaults. The description adequately frames the high-level use cases, and the absence of an output schema and annotations is compensated by the detail in the input schema. It could mention file-saving side effects, but the output_file parameter already documents this.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds only marginal semantic context by noting that input images are used for editing and style transfer, which is already implied by the schema parameter descriptions. It does not substantially enhance parameter understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates or edits images using OpenAI GPT Image and lists explicit trigger phrases ('create an image', 'generate a picture', 'draw', etc.). It is specific about the verb and resource, but since no sibling tools are provided, it cannot demonstrate differentiation from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use when asked to...' and enumerates several concrete user request types. It provides clear context for when to invoke the tool, though it does not mention exclusions or alternatives because none are listed in the sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.2.0
    • First observedcreate_image

TDQS

A3.9/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion. The tool's name and description clearly define its purpose for image generation and editing.

Naming Consistency5/5

The single tool name follows a clear verb_noun convention (create_image), which is consistent and predictable. There are no other tools to create inconsistency.

Tool Count3/5

A single tool feels thin for a server, but it is appropriately scoped to a narrow domain of image creation and editing. It is borderline but functional.

Completeness5/5

The tool covers both generation and editing of images, fulfilling the stated purpose fully. There are no obvious gaps in the core lifecycle for this domain.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

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