home / mcp / image mcp server

Image MCP Server

Provides AI image generation via MCP with prompts, sizes, and models using OpenAI and Replicate APIs.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "iplanwebsites-image-mcp": {
      "command": "npx",
      "args": [
        "image-mcp@latest"
      ],
      "env": {
        "MCP_TIMEOUT": "1200000",
        "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
        "REPLICATE_API_TOKEN": "YOUR_REPLICATE_API_TOKEN"
      }
    }
  }
}

You can run an Image MCP Server that exposes AI image generation capabilities and connect it to your preferred MCP client. This server uses the image-mcp package to interface with OpenAI and Replicate image inference services, giving you flexible image generation with prompts, sizes, and models that you choose. It’s designed to be simple to set up and easy to invoke from clients that support MCP endpoints.

How to use

You interact with the Image MCP Server through an MCP client by calling its available image generation tools. Key capabilities include generating AI images with customizable prompts, sizes, and models, as well as shortcut commands for common aspect ratios.

The primary function is generate_ai_image, which accepts a prompt and optional parameters such as size, model, and output file path. Shortcut commands provide preconfigured sizes for quick image creation.

How to install

Prerequisites you need before installing: node.js version 18 or newer, and a working internet connection to fetch dependencies.

Install the MCP server package globally so you can run it from anywhere.

npm install -g image-mcp

Configure your environment with the required API keys for image generation services.

{
  "mcpServers": {
    "image_mcp": {
      "command": "npx",
      "args": ["image-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "REPLICATE_API_TOKEN": "your-replicate-api-token",
        "MCP_TIMEOUT": "1200000"
      },
      "resetTimeoutOnProgress": true
    }
  }
}

Put the JSON configuration into Claude Desktop’s MCP configuration file for your operating system. The path and file you modify are shown here for reference.

{
  "mcpServers": {
    "image-mcp": {
      "command": "npx",
      "args": ["image-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "REPLICATE_API_TOKEN": "your-replicate-api-token",
        "MCP_TIMEOUT": "1200000"
      },
      "resetTimeoutOnProgress": true
    }
  }
}

Additional configuration notes

The server relies on two API keys: OPENAI_API_KEY for OpenAI access and REPLICATE_API_TOKEN for Replicate access. These keys are passed to the server as environment variables when you start it.

Examples of image generation

You can try prompts such as: - "A red cat in Picasso style" - "A sunset over mountains, photorealistic" - "Abstract geometric patterns in blue and gold"

Security and usage notes

Keep API keys secure and do not share them in public or unsecured places. Use a separate key for development and production environments if possible. Monitor usage to avoid unintended costs from external image generation services.

Troubleshooting and tips

If you encounter timeouts or slow responses, adjust the MCP timeout value in the environment configuration to accommodate longer inference times. Ensure your API keys are valid and that your hosting environment can reach the OpenAI and Replicate endpoints.

Notes

This server provides a straightforward path to generate AI images via MCP clients, leveraging the image-mcp package to connect with AI inference services.

Available tools

generate_ai_image

Generates AI images from a prompt with optional size, model, and output path.

square_image

Shortcut to generate 1024x1024 images.

landscape_image

Shortcut to generate 1536x1024 landscape images.

portrait_image

Shortcut to generate 1024x1536 portrait images.