Get the FREE Ultimate OpenClaw Setup Guide →

imagegen

ImageGen MCP Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio writingmate-imagegen-mcp npx imagegen-mcp-server \
  --env OUTPUT_DIR="Optional: output directory for generated images (default: outputs)" \
  --env GOOGLE_API_KEY="Your Google API key for Imagen and Gemini endpoints" \
  --env OPENAI_API_KEY="Your OpenAI API key for GPT-Image-1 and DALL-E style models" \
  --env REPLICATE_API_TOKEN="Your Replicate API token for Flux, Qwen Image, SeedDream-4 models" \
  --env GOOGLE_IMAGEN_ENDPOINT="Optional custom Google Imagen endpoint"

How to use

ImageGen MCP Server exposes multiple AI image-generation providers through a single MCP interface. It supports GPT-Image-1, Nano Banana (Gemini 2.5), Google Imagen 4, Flux 1.1, Qwen Image, and SeedDream-4, enabling you to generate images via different backends using a unified client. You can connect any MCP client to the imagegen server using a standard MCP configuration and start generating images with prompts that specify model choices, styles, and dimensions. The server handles routing to the chosen provider and returns images either as files or base64 data, depending on client capabilities.

To use, install and run the MCP server (via npx imagegen-mcp-server or your preferred method), then configure your MCP client to point to the imagegen server. In clients like WritingMate.ai or Claude-based tools, you’ll reference the imagegen MCP and issue prompts such as “Generate a cyberpunk city using Flux 1.1” or “create a serene mountain landscape with hyper-realistic detail.” The server will process the prompt across the enabled providers and return the generated image(s) to you. For local experimentation, you can specify output options and endpoints through environment variables in the mcp_config so that your client can access the results consistently.

How to install

Prerequisites:

  • Node.js 18+ and npm (or yarn)
  • Internet access to fetch the MCP server package from npm

Option A: Install from npm (recommended)

  1. Ensure Node.js is installed (node -v) and npm is available (npm -v).
  2. Run the MCP server globally for quick access:
npm install -g imagegen-mcp-server
  1. Start the server with a simple command:
npx imagegen-mcp-server

Option B: Install from source

  1. Clone the repository (if you have access to the source):
git clone https://github.com/writingmate/imagegen-mcp.git
cd imagegen-mcp
  1. Install dependencies:
npm install
  1. Build (if applicable) and run:
npm run build
npm start

Option C: Run via npx without global installation

npx imagegen-mcp-server

Environment setup (required for full functionality):

  • Create a .env file in your project directory or pass environment variables to your runtime:
OPENAI_API_KEY=your-openai-api-key-here
GOOGLE_API_KEY=your-google-api-key-here
REPLICATE_API_TOKEN=your-replicate-api-token-here
GOOGLE_IMAGEN_ENDPOINT=  # Optional custom endpoint
OUTPUT_DIR=outputs        # Optional: directory to save generated images

After installation, verify the server is running by visiting the MCP client interface or checking logs for a ready message.

Additional notes

Tips and caveats:

  • You can enable/disable providers by configuring API keys and endpoints in the .env file. The server will only attempt to use providers for which valid keys are provided.
  • If you encounter API quota or rate-limit issues, consider staggering requests or using multiple provider endpoints where supported.
  • The OUTPUT_DIR setting determines where generated images are saved if you choose file outputs; ensure the directory is writable by the running process.
  • Some MCP clients may require you to add an entry like: { "mcpServers": { "imagegen": { "command": "npx", "args": ["imagegen-mcp-server"] } } } in their config files.
  • For local testing, you can rely on the quick demo prompts described in the README to validate end-to-end image generation across providers.

Related MCP Servers

Sponsor this space

Reach thousands of developers