Gemini Image Generation MCP

by collactivelabs

453 downloads Not rated yet
GitHub

About

A Model Calling Protocol (MCP) server that allows Claude and other LLMs to generate images using Google's Gemini AI model.

Explore

- Generate images from text prompts using Google's Gemini model (gemini-2.0-flash-preview-image-generation)
- Save generated images locally
- Configure generation parameters like temperature, topK, and topP
- Interactive web interface for testing and demonstration
- Docker support for easy deployment
- Simple MCP standard implementation

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Gemini Image Generation MCP
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Node.js 18 or higher
- Google API key with access to Gemini API (specifically the image generation preview model)
- For Docker: Docker and Docker Compose

When making API requests to Claude, include the MCP configuration:

{
  "mcpServers": {
    "openai-image-generation": {
      "command": "node",
      "args": ["/full/path/to/openai-image-gen-mcp/src/mcp-server.js"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key-here"
      }
    }
  }
}

1. Go to Developer Settings
2. Navigate to the MCPs section
3. Click "Add MCP"
4. Fill in the details:
- Name: gemini_image_generation
- URL: https://your-server-url.com/mcp
- Authentication (if implemented): Select Bearer Token and enter your token

The MCP server supports the following configuration options:

| Option | Description | Default |
|--------|-------------|---------|
| GEMINI_API_KEY | Google API key with Gemini access | (Required) |
| MCP_AUTH_TOKEN | Authentication token for MCP | (Optional) |
| PORT | Web server port | 3070 |
| OUTPUT_DIR | Directory for saved images | ./generated-images |
| LOG_LEVEL | Logging level (debug, info, warn, error) | info |

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "gemini image generation mcp": {
            "openai-image-generation": {
                "command": "node",
                "args": [
                    "/full/path/to/openai-image-gen-mcp/src/mcp-server.js"
                ],
                "env": {
                    "OPENAI_API_KEY": "your-openai-api-key-here"
                }
            }
        }
    }
}

McpServers

{
    "openai-image-generation": {
        "command": "node",
        "args": [
            "/full/path/to/openai-image-gen-mcp/src/mcp-server.js"
        ],
        "env": {
            "OPENAI_API_KEY": "your-openai-api-key-here"
        }
    }
}

A Model Calling Protocol (MCP) server that allows Claude and other LLMs to generate images using Google's Gemini AI model.

Overview

This MCP server enables Large Language Models (LLMs) like Claude to delegate image generation tasks to Google's Gemini model. It follows the MCP standard to provide a seamless integration experience.

Features

- Generate images from text prompts using Google's Gemini model (gemini-2.0-flash-preview-image-generation)
- Save generated images locally
- Configure generation parameters like temperature, topK, and topP
- Interactive web interface for testing and demonstration
- Docker support for easy deployment
- Simple MCP standard implementation

Prerequisites

- Node.js 18 or higher
- Google API key with access to Gemini API (specifically the image generation preview model)
- For Docker: Docker and Docker Compose

Getting Started

Installation

1. Clone this repository:

git clone https://your-repository-url/gemini-image-gen-mcp.git
cd gemini-image-gen-mcp

2. Install dependencies:

npm install

3. Create your environment configuration:

cp .env.example .env

4. Edit the .env file to add your Google API key:

GEMINI_API_KEY=your_gemini_api_key_here

Running the Server

Option 1: Using Node.js directly

For MCP server only:

node src/mcp-server.js

For web interface only:

node src/web-server.js

Or use the provided script:

```

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.