Skip to content

Getting Started

Add AI image generation and editing capabilities to your projects using the OpenAI gpt-image-1 MCP server.

Overview

This MCP server provides the following capabilities:

  • High-quality image generation using OpenAI gpt-image-1
  • Advanced text rendering and logo generation
  • Image editing and variation creation
  • Batch processing for multiple image operations

Installation

bash
$ claude mcp add gpt-image-1 -s user \
    -e OPENAI_API_KEY=your-api-key-here \
    -e DEFAULT_IMAGE_SIZE=square \
    -e DEFAULT_IMAGE_QUALITY=hd \
    -- npx @napolab/gpt-image-1-mcp

Manual Configuration

Add the following to your MCP client configuration:

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

Development Setup

bash
# Clone repository
git clone https://github.com/naporin0624/gen-image-mcp.git
cd gen-image-mcp
pnpm install
pnpm build

Environment Variables

VariableRequiredDefaultDescription
OPENAI_API_KEY-OpenAI API key
DEFAULT_IMAGE_SIZEsquareDefault image size (square/landscape/portrait)
DEFAULT_IMAGE_QUALITYstandardDefault image quality (standard/hd)
DEFAULT_OUTPUT_DIR./generated_imagesImage save directory
OPENAI_API_TIMEOUT60000API timeout (milliseconds)
OPENAI_MAX_RETRIES3Maximum retry attempts

Available Tools

After setup, the following tools will be available:

  • generate-image - Generate images using gpt-image-1
  • edit-image - Image editing, inpainting, and outpainting
  • batch-edit - Apply edits to multiple images

First Image Generation

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

Next Steps

Common Issues

API Key Error

  • Verify gpt-image-1 and GPT-4o Vision access permissions
  • Re-check environment variable configuration

MCP Connection Error

  • Confirm Node.js 20+ installation
  • Verify npx package access permissions
  • Check MCP client logs

Image Generation Error

  • Verify OpenAI account credit balance
  • Check API key rate limits
  • Review detailed error messages

Report issues at GitHub Issues.

Released under the MIT License.