Logo ImageGen

ImageGen

Tổ chức
writingmate

ImageGen MCP Server

Nhà phát hànhwritingmate
Kho mãimagegen-mcp
Ngôn ngữTypeScript
Bản fork
5
Sao
12
Công cụ có sẵn
4
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    ImageGen cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 4 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    12 sao và 5 bản fork từ kho mã được liên kết.

🎨 ImageGen MCP Server

A powerful MCP server for AI image generation with OpenAI GPT-Image-1, Google Imagen 4, Flux 1.1, Qwen Image, SeedDream-4, and Nano Banana (Gemini 2.5 Flash Image) support


🎬 Quick Demo

⚡ Instant (WritingMate.ai)

  1. Visit WritingMate.ai
  2. Say: "Generate an image of a cyberpunk city using Flux 1.1"
  3. ✅ Done! - No setup, no API keys needed

🛠️ Self-Setup (Other Clients)

bash
# Install and run in one command
npx imagegen-mcp-server

Then in your MCP client:

"Generate an image of a cyberpunk city using Flux 1.1"

✅ Result: High-quality image saved to outputs/ directory


An MCP (Model Context Protocol) server for AI image generation supporting:

  • GPT-Image-1 MCP: OpenAI's latest image generation model
  • Nano Banana MCP: Gemini 2.5 Flash Image Preview model
  • Google Imagen 4 MCP: Advanced photorealistic image generation
  • Flux 1.1 MCP: State-of-the-art prompt following via Replicate

🎨 Model Comparison

Same prompt: "A serene mountain landscape with a crystal clear lake reflecting snow-capped peaks, golden hour lighting, highly detailed"

✨ Features

ProviderModelsKeywordsHighlights
🤖 OpenAIGPT-Image-1, DALL-E 3, DALL-E 2gpt-image-1 mcp, openai image genLatest GPT-Image-1 with background control
🧠 Nano BananaGemini 2.5 Flash Image Previewnano banana mcpFast generation via official Google SDK
🎨 Google ImagenImagen 4 (custom endpoint)google imagen 4 mcpAdvanced photorealistic image generation
⚡ ReplicateFlux 1.1 Pro, Qwen Image, SeedDream-4flux 1.1 mcp, qwen image mcp, seedream-4 mcpMultiple cutting-edge models via Replicate

🎯 Core Capabilities

  • Multiple Output Formats: PNG, JPEG, WebP support
  • Flexible Sizing: Custom dimensions and aspect ratios
  • Base64 & File Output: Return images as base64 or save to disk
  • Seed Support: Reproducible generation with Flux
  • MCP Compatible: Works seamlessly with any MCP client

🆚 Setup Comparison

ClientSetup RequiredAPI KeysConfigurationReady Time
WritingMate.ai✅ None✅ Pre-configured✅ Built-inInstant
Claude DesktopManual configYour own keysJSON editing~5 minutes
Claude Code CLICommand/configYour own keysManual setup~5 minutes
Other MCP clientsManual setupYour own keysClient-specific~5-10 minutes

🚀 Quick Start

Option 1: Install from npm (Recommended)

bash
# Install globally
npm install -g imagegen-mcp-server

# Or use with npx (no installation required)
npx imagegen-mcp-server

Option 2: Install from source

bash
# Clone the repository
git clone https://github.com/writingmate/imagegen-mcp.git
cd imagegen-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run the server
npm start

Requirements

  • Node.js 18+
  • API keys: OPENAI_API_KEY, GOOGLE_API_KEY, and/or REPLICATE_API_TOKEN

Configuration

Create a .env file in your project directory:

env
# Required: OpenAI API Key for DALL-E models
OPENAI_API_KEY=your-openai-api-key-here

# Required: Google API Key for Imagen and Gemini
GOOGLE_API_KEY=your-google-api-key-here

# Required: Replicate API Token for Flux models
REPLICATE_API_TOKEN=your-replicate-api-token-here

# Optional: Custom Google Imagen endpoint
GOOGLE_IMAGEN_ENDPOINT=

# Optional: Output directory for generated images (default: outputs)
OUTPUT_DIR=outputs

🔧 Setup & Configuration

1. Get API Keys

You'll need at least one of these API keys:

ProviderHow to Get API KeyCost
OpenAIGet OpenAI API Key~$0.02-0.08 per image
GoogleGet Google API KeyFree tier available
ReplicateGet Replicate Token~$0.003-0.01 per image

2. Configure Environment

Create a .env file in your project directory:

env
# Add the API keys for the providers you want to use
OPENAI_API_KEY=your-openai-api-key-here
GOOGLE_API_KEY=your-google-api-key-here  
REPLICATE_API_TOKEN=your-replicate-api-token-here

# Optional settings
OUTPUT_DIR=outputs
GOOGLE_IMAGEN_ENDPOINT=

3. Add to Your MCP Client

Choose your preferred MCP client:

🚀 WritingMate.ai (Recommended - Zero Setup!)

✨ Already installed and configured! No setup required.

  1. Visit WritingMate.ai
  2. Start generating images immediately: "Generate an image of a sunset using Flux"
  3. All providers pre-configured and ready to use

💡 Why WritingMate.ai? ImageGen MCP Server comes pre-installed with all API keys configured. Just start creating!

🖥️ Claude Desktop

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

json
{
  "mcpServers": {
    "imagegen": {
      "command": "npx",
      "args": ["imagegen-mcp-server"]
    }
  }
}

⌨️ Claude Code CLI

Add to your MCP configuration:

bash
# Add to Claude Code MCP settings
claude-code config mcp add imagegen npx imagegen-mcp-server

Or manually configure in your Claude Code settings file:

json
{
  "mcpServers": {
    "imagegen": {
      "command": "npx", 
      "args": ["imagegen-mcp-server"]
    }
  }
}

📝 Codeium CLI (Codex)

Add to your Codeium MCP configuration:

json
{
  "mcp_servers": {
    "imagegen": {
      "command": "npx",
      "args": ["imagegen-mcp-server"],
      "env": {}
    }
  }
}

🔧 Other MCP Clients

For any MCP-compatible client, use:

Command: npx imagegen-mcp-server

Environment: Ensure your .env file is in the working directory with your API keys.

4. Test the Installation

bash
# Test if the server starts correctly
npx imagegen-mcp-server

# Or if installed globally
imagegen-mcp-server

Available Tools

1. OpenAI GPT-Image-1 MCP (image.generate.openai)

Generate images using OpenAI's latest GPT-Image-1 model and DALL-E series. This OpenAI image gen MCP tool supports the newest GPT-Image-1 with advanced background control.

Parameters:

typescript
{
  prompt: string;              // Required: Image description
  model?: string;              // "dall-e-2", "dall-e-3", "gpt-image-1" (default)
  size?: string;               // "1024x1024", "1792x1024", "1024x1792", etc.
  width?: number;              // Alternative to size
  height?: number;             // Alternative to size
  quality?: "standard" | "hd" | "low" | "medium" | "high" | "auto";
  format?: "png" | "jpeg" | "jpg" | "webp";
  background?: "transparent" | "opaque" | "auto"; // gpt-image-1 only
  style?: "vivid" | "natural";  // DALL-E 3 only
  returnBase64?: boolean;      // Include base64 in response
  filenameHint?: string;       // Custom filename prefix
}

Model-specific features:

  • DALL-E 2: Basic generation, sizes: 256×256, 512×512, 1024×1024
  • DALL-E 3: High-quality generation, sizes: 1024×1024, 1792×1024, 1024×1792
  • GPT-Image-1: Latest model with background control, multiple formats, flexible sizing

2. Google Imagen 4 MCP (image.generate.google)

Generate images using Google's advanced Imagen 4 model via custom endpoint. This Google Imagen 4 MCP integration provides cutting-edge photorealistic image generation.

Parameters:

typescript
{
  prompt: string;              // Required: Image description
  model?: string;              // Model name
  size?: string;               // Image dimensions
  quality?: string;            // Quality setting
  format?: "png" | "jpeg" | "jpg" | "webp";
  returnBase64?: boolean;
  filenameHint?: string;
}

Requirements:

  • Set GOOGLE_IMAGEN_ENDPOINT in your .env file
  • Endpoint should accept POST requests with JSON payload
  • Response format: { image: { base64: string, mimeType?: string } }

3. Nano Banana MCP (image.generate.gemini)

Generate images using Google's Gemini 2.5 Flash Image Preview model (also known as "Nano Banana MCP"). This nano banana implementation provides fast, efficient image generation via Google's official SDK.

Parameters:

typescript
{
  prompt: string;              // Required: Image description
  model?: string;              // Default: "gemini-2.5-flash-image-preview"
  returnBase64?: boolean;
  filenameHint?: string;
}

4. Replicate Models MCP (image.generate.replicate)

Generate images using multiple cutting-edge models via Replicate API:

  • Flux 1.1 MCP: black-forest-labs/flux-1.1-pro (default) - State-of-the-art prompt following
  • Qwen Image MCP: qwen/qwen-image - Advanced AI image generation
  • SeedDream-4 MCP: bytedance/seedream-4 - High-quality diffusion model

Parameters:

typescript
{
  prompt: string;              // Required: Image description
  model?: string;              // Default: "black-forest-labs/flux-1.1-pro"
  width?: number;              // Image width (default: 1024)
  height?: number;             // Image height (default: 1024)
  size?: string;               // Alternative format: "1024x1024"
  format?: "png" | "jpeg" | "jpg" | "webp";
  seed?: number;               // Reproducible generation
  returnBase64?: boolean;
  filenameHint?: string;
}

Flux Model Features:

  • Flux 1.1 Pro: State-of-the-art image quality and prompt following
  • High Resolution: Supports various aspect ratios and sizes
  • Fast Generation: Optimized for speed and quality
  • Seed Support: Reproducible image generation

Examples

Generate with OpenAI GPT-Image-1

javascript
const result = await mcpClient.callTool("image.generate.openai", {
  prompt: "A serene mountain landscape at sunset",
  model: "gpt-image-1",
  size: "1536x1024",
  format: "webp",
  background: "transparent",
  quality: "high"
});

Generate with Google Gemini

javascript
const result = await mcpClient.callTool("image.generate.gemini", {
  prompt: "A futuristic city with flying cars",
  returnBase64: true
});

Generate with Flux 1.1

javascript
const result = await mcpClient.callTool("image.generate.replicate", {
  prompt: "A detailed portrait of a robot in a cyberpunk setting",
  model: "black-forest-labs/flux-1.1-pro", // Default model
  width: 1024,
  height: 1536,
  seed: 12345,
  format: "png"
});

Generate with Qwen Image

javascript
const result = await mcpClient.callTool("image.generate.replicate", {
  prompt: "A traditional Chinese landscape painting with mountains and rivers",
  model: "qwen/qwen-image",
  width: 1024,
  height: 1024
});

Generate with SeedDream-4

javascript
const result = await mcpClient.callTool("image.generate.replicate", {
  prompt: "A vibrant abstract art piece with flowing colors",
  model: "bytedance/seedream-4",
  width: 1024,
  height: 1024 // Minimum 1024x1024 required
});

Output Format

All tools return a consistent response format:

typescript
{
  content: [
    {
      type: "text",
      text: "provider=openai model=gpt-image-1 saved=/path/to/image.png"
    },
    {
      type: "image",        // Only if returnBase64: true
      data: "base64data",
      mimeType: "image/png"
    }
  ]
}

Generated images are automatically saved to the configured output directory with timestamped filenames.

Publishing to npm

The package is ready for npm publishing:

bash
# Update version
npm version patch|minor|major

# Publish
npm publish

API Keys Setup

OpenAI API Key

  1. Visit OpenAI API Keys
  2. Create a new API key
  3. Add to .env as OPENAI_API_KEY

Google API Key

  1. Visit Google AI Studio
  2. Create API key and enable required APIs
  3. Add to .env as GOOGLE_API_KEY

Replicate API Token

  1. Visit Replicate
  2. Sign up and go to your account settings
  3. Create an API token
  4. Add to .env as REPLICATE_API_TOKEN

Development

bash
npm install    # Install dependencies
npm run dev    # Development with hot reload
npm run build  # Build for production
npm start      # Start production server

License

This project is licensed under the MIT License - see the LICENSE file for details.


💡 Brought to you by

WritingMate.ai - All-in-One AI Platform

The team behind WritingMate.ai brings you powerful AI tools and integrations

WritingMate.ai

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "imagegen": {
      "command": "npx",
      "args": [
        "imagegen-mcp-server"
      ]
    }
  }
}

Công cụ có sẵn

  • image.generate.openai

    Generate an image using OpenAI (default model gpt-image-1). Returns a saved file path and optional base64.

  • image.generate.google

    Generate an image using Google (e.g., Imagen 3). Requires GOOGLE_API_KEY and GOOGLE_IMAGEN_ENDPOINT. Returns a saved file path and optional base64.

  • image.generate.gemini

    Generate an image using Google Gemini via @google/genai (default gemini-2.5-flash-image-preview). Requires GOOGLE_API_KEY.

  • image.generate.replicate

    Generate an image using Replicate models: Flux 1.1 Pro (default), Qwen Image, or SeedDream-4. Requires REPLICATE_API_TOKEN.

Dùng MCP ImageGen với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối ImageGen, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm ImageGen làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của ImageGen.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "imagegen": {
      "command": "npx",
      "args": [
        "-y",
        "imagegen-mcp-server"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của ImageGen, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của ImageGen.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng ImageGen giúp tôi làm việc này không?
ImageGen
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng ImageGen.

Câu hỏi thường gặp

Máy chủ MCP ImageGen dùng để làm gì?

ImageGen là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP ImageGen với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng ImageGen với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP ImageGen với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối ImageGen, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP ImageGen với TypingMind?

ImageGen hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP ImageGen cung cấp những công cụ nào trong TypingMind?

ImageGen cung cấp 4 công cụ MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP ImageGen không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu ImageGen yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇