Spaces:
Paused
Paused
| 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: | |
| ```bash | |
| export GEMINI_API_KEY="your-gemini-api-key" | |
| ``` | |
| ### Local Development | |
| 1. Install dependencies: | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 2. Run the application: | |
| **Web UI mode:** | |
| ```bash | |
| python app.py | |
| ``` | |
| **MCP server mode:** | |
| ```bash | |
| python app.py --mcp | |
| ``` | |
| ## Usage with Claude Code | |
| Add this configuration to your Claude Code settings: | |
| ```json | |
| { | |
| "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 |