ImageGenMCP / README.md
tomo2chin2's picture
Upload 9 files
0b26f38 verified

A newer version of the Gradio SDK is available: 6.5.1

Upgrade
metadata
title: ImageGenMCP
emoji: ๐ŸŽจ
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: mit

ImageGenMCP - Image Generation MCP Server

A Gradio-based image generation application using Google's Gemini 2.0 Flash Preview model, designed to work as an MCP (Model Context Protocol) server for Claude Code.

Features

  • ๐ŸŽจ High-quality image generation using Gemini 2.0 Flash Preview
  • ๐Ÿ–ผ๏ธ Support for reference images to guide generation
  • ๐Ÿ”ง MCP server integration for Claude Code
  • ๐ŸŒ Web interface powered by Gradio 5.31.0
  • ๐Ÿ“ Detailed logging for debugging

Setup

Environment Variables

Set your Gemini API key:

export GEMINI_API_KEY="your-gemini-api-key"

Local Development

  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:

Web UI mode:

python app.py

MCP server mode:

python app.py --mcp

Usage with Claude Code

Add this configuration to your Claude Code settings:

{
  "mcpServers": {
    "image-gen": {
      "command": "python",
      "args": ["/path/to/app.py", "--mcp"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

API

MCP Tool: generate_image

Description: Generates images using Gemini 2.0 Flash Preview

Parameters:

  • prompt (string, required): Description of the image to generate

Returns:

  • success (boolean): Whether generation was successful
  • message (string): Status message
  • image_url (string): URL to access the generated image (if successful)
  • image_path (string): Local file path of the generated image (if successful)

Requirements

  • Python 3.8+
  • Gemini API key with access to gemini-2.0-flash-preview-image-generation model
  • Dependencies listed in requirements.txt

License

MIT