Gemini Image

An MCP server for image generation using the Gemini API.
  • typescript

2

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "creating-cat-gemini-image-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@creating-cat/gemini-image-mcp-server"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
      }
    }
  }
}

You can generate and compress images from text prompts (with optional input images) using the Gemini-powered Image MCP Server. It runs as a standard MCP tool, accepts calls from an MCP client, and saves results to a designated directory with unique file names to avoid conflicts.

How to use

To generate an image, you provide a prompt and optional input images. The server processes the request, saves the generated image to your chosen directory, and compresses the output for smaller file sizes. You can control image size, format, and quality through the available input parameters, and you receive a response detailing the final file path and sizes.

Typical usage patterns include providing a prompt only for plain image generation, or including input images to guide the output. You can also enable enhanced prompts to improve the AI instructions and adjust options such as the target image size, compression level, and output format.

How to install

Prerequisites you need before installing the server:

  • Node.js (version 18 or newer recommended)
  • Google Cloud Project with Gemini API enabled
  • Gemini API Key

Install and set up the MCP server using the configuration example below. This assumes you already have Node.js installed and an active Gemini API key.

{
  "mcpServers": {
    "gemini_image_mcp_server": {
      "command": "npx",
      "args": [
        "-y",
        "@creating-cat/gemini-image-mcp-server"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
      },
      "disabled": false,
      "timeout": 300
    }
  }
}

Additional sections

Notes and important details to keep in mind as you work with this MCP server:

  • The server uses the Gemini API model gemini-2.0-flash-preview-image-generation. Be aware that Google may discontinue or update this model over time.
  • Handle your Gemini API key securely. Do not expose it in public or shared environments.
  • Generated images are automatically compressed according to the configured quality settings, with options to force specific formats like JPEG, PNG, or WebP if needed.
  • The server assigns unique file names by default to prevent collisions, and you can control the output directory and base file name via parameters in the tool call.

Tool: generate_image

The MCP server provides a tool named generate_image to generate images from prompts and optional input images.

Configuration notes

Key configuration options you can adjust when calling the tool include:

  • prompt: required text prompt for image generation
  • output_directory: where to save the generated image (default: output/images)
  • file_name: save filename without extension (default: generated_image)
  • input_image_paths: optional list of input reference image paths
  • use_enhanced_prompt: enable enhanced prompts (default: true)
  • target_image_max_size: maximum size of the longer edge after resizing (default: 512)
  • force_conversion_type: force output format (e.g., jpeg, webp, png)
  • skip_compression_and_resizing: skip compression and resizing if true (default: false)
  • jpeg_quality: JPEG quality 0-100 (default: 80)
  • webp_quality: WebP quality 0-100 (default: 80)
  • png_compression_level: PNG compression 0-9 (default: 9)
  • optipng_optimization_level: OptiPNG optimization level 0-7 (default: 2)

Output example

On success, you receive the save path and a message detailing both the original and final file sizes. Example output shows the path and size summary.

{
  "content": [
    {
      "type": "text",
      "text": "Image successfully generated and compressed at output/images/my_cat.jpg.\nOriginal size: 1024.12KB, Final size: 150.45KB"
    }
  ]
}

Available tools

generate_image

Generates an image from a text prompt with optional input images, saves the result to a specified directory, and returns the save path along with size details.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational