gpt-image-1-mcp

naporin0624/gpt-image-1-mcp

3.2

If you are the rightful owner of gpt-image-1-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The gpt-image-1 MCP server is designed for AI-powered image generation using OpenAI's gpt-image-1 model, offering advanced text rendering and native transparency support.

Tools
  1. generate-image

    Generate images using gpt-image-1 with advanced text rendering.

  2. edit-image

    Edit existing images with AI-powered modifications.

  3. batch-edit

    Apply the same edit to multiple images efficiently.

gpt-image-1 MCP

License: MIT OpenAI Documentation

MCP server for AI-powered image generation using OpenAI's gpt-image-1 model with advanced text rendering and native transparency support.

Features

  • Advanced text rendering with gpt-image-1 - Crisp, legible typography and logos in generated images
  • Native transparency support - Built-in transparent background without post-processing
  • Multi-format output (PNG, JPEG, WebP) - Flexible format options with optimized compression
  • Flexible dimensions and aspect ratios - Square (1024×1024), landscape (1536×1024), and portrait (1024×1536)
  • Batch image editing capabilities - Process multiple images with parallel processing
  • Token-optimized MCP responses - Efficient response formats for MCP protocol limits

Installation

Recommended: Using npx

{
  "mcpServers": {
    "gpt-image-1-mcp": {
      "command": "npx",
      "args": ["@napolab/gpt-image-1-mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-your-api-key"
      }
    }
  }
}

Alternative: Local Installation

npm install -g @napolab/gpt-image-1-mcp

Claude Desktop Configuration

Configure in ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "gpt-image-1-mcp": {
      "command": "npx",
      "args": ["@napolab/gpt-image-1-mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-your-api-key"
      }
    }
  }
}

Configuration

Environment Variables

VariableRequiredDefaultDescription
OPENAI_API_KEYYes-Your OpenAI API key
DEFAULT_OUTPUT_DIRNo./generated_imagesDefault output directory
DEFAULT_IMAGE_SIZENo1024x1024Default image dimensions
DEFAULT_IMAGE_QUALITYNostandardDefault quality (standard/hd)
DEFAULT_OUTPUT_FORMATNopngDefault format (png/jpeg/webp)

Available Tools

generate-image

Generate images using gpt-image-1 with advanced text rendering and superior instruction following.

Parameters:

ParameterTypeRequiredDefaultDescription
promptstringYes-Image description (English only)
aspect_ratiostringNosquare"square", "landscape", or "portrait"
qualitystringNostandard"standard" or "hd"
output_directorystringNo./generated_imagesDirectory to save the image
filenamestringNo-Custom filename
save_to_filebooleanNotrueWhether to save locally
include_base64booleanNofalseInclude base64 in response

Example:

await client.callTool("generate-image", {
  prompt: "A serene Japanese garden with cherry blossoms",
  aspect_ratio: "landscape",
  quality: "hd",
});

edit-image

Edit existing images with AI-powered modifications including inpainting, outpainting, style transfer, and background changes.

Parameters:

ParameterTypeRequiredDefaultDescription
source_imageobjectYes-Image input (URL, base64, or local file)
edit_promptstringYes-Description of desired changes (English only)
edit_typestringYes-Type of edit to perform
strengthnumberNo0.8Edit strength (0.0 to 1.0)
preserve_compositionbooleanNotrueMaintain original composition
output_formatstringNopngOutput format

Edit Types:

  • inpaint - Fill in or modify specific areas
  • outpaint - Extend image beyond boundaries
  • background_change - Replace or modify background
  • style_transfer - Apply artistic styles
  • object_removal - Remove unwanted objects
  • variation - Create variations of original

Example:

await client.callTool("edit-image", {
  source_image: {
    type: "local",
    value: "/path/to/image.jpg",
  },
  edit_prompt: "Add a sunset sky background",
  edit_type: "background_change",
});

batch-edit

Apply the same edit to multiple images efficiently with parallel processing.

Parameters:

ParameterTypeRequiredDefaultDescription
imagesarrayYes-Array of image inputs
edit_promptstringYes-Edit description (English only)
edit_typestringYes-Type of edit to apply
batch_settingsobjectNo-Batch processing configuration

Example:

await client.callTool("batch-edit", {
  images: [
    { type: "local", value: "/path/to/image1.jpg" },
    { type: "local", value: "/path/to/image2.jpg" },
  ],
  edit_prompt: "Apply vintage sepia filter",
  edit_type: "style_transfer",
});

Usage Examples

Basic Image Generation

// Generate a simple image
const result = await client.callTool("generate-image", {
  prompt: "A modern minimalist logo design",
  aspect_ratio: "square",
  quality: "hd",
});

console.log("Generated image:", result.data.file_path);

Advanced Options

// Generate with all parameters
const result = await client.callTool("generate-image", {
  prompt: "Professional product photography of a smartphone",
  aspect_ratio: "portrait",
  quality: "hd",
  output_directory: "./product_images",
  filename: "smartphone_hero",
  output_format: "png",
  include_base64: true,
});

Image Editing

// Generate base image
const baseImage = await client.callTool("generate-image", {
  prompt: "A mountain landscape",
  aspect_ratio: "landscape",
});

// Edit the generated image
const editedImage = await client.callTool("edit-image", {
  source_image: {
    type: "local",
    value: baseImage.data.file_path,
  },
  edit_prompt: "Add dramatic storm clouds",
  edit_type: "background_change",
  strength: 0.7,
});

Batch Processing

// Process multiple images
const result = await client.callTool("batch-edit", {
  images: [
    { type: "local", value: "image1.jpg" },
    { type: "local", value: "image2.jpg" },
    { type: "local", value: "image3.jpg" },
  ],
  edit_prompt: "Apply Instagram-style filter",
  edit_type: "style_transfer",
  batch_settings: {
    max_concurrent: 3,
    error_handling: "continue_on_error",
  },
});

Development

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Testing

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Run linting
npm run lint

# Type checking
npm run typecheck

Building

# Build for production
npm run build

# Development mode with hot reload
npm run dev

License

MIT License - see the file for details.

Support