Skip to main content
Glama

日本語版はこちら (Read in Japanese)

Gemini Image MCP Server

This is an MCP (Model Context Protocol) server that uses Google's Gemini API to generate images and save them to a specified directory. In addition to text prompts, you can optionally provide input images to guide the image generation process. Generated images are automatically compressed to reduce file size.


Features

  • Image generation from text prompts

  • (Optional) Image generation using input reference images

  • Automatic compression of generated images (JPEG, PNG)

  • Unique file name assignment to prevent file name conflicts

  • Operates as an MCP server, accepting tool calls via standard input/output


Related MCP server: gemini-image-mcp

Prerequisites

  • Node.js (v18 or higher recommended)

  • Google Cloud Project with Gemini API enabled

  • Gemini API Key


Setup

Example MCP server configuration for Roo Code

{
  "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
    }
  }
}
  • Replace YOUR_GEMINI_API_KEY with your actual Gemini API Key.

    • You can also use ${env:GEMINI_API_KEY} to retrieve the key from environment variables (Roo Code feature).


Tool: generate_image

This MCP server provides a tool named generate_image.

Input Parameters

Parameter Name

Description

Default Value

prompt

(string, required) Text prompt for image generation. If input images are provided, include instructions on how to incorporate them into the generated image. English is recommended.

None

output_directory

(string, optional) Directory path where the generated image will be saved.

output/images

file_name

(string, optional) Name of the saved image file (without extension).

generated_image

input_image_paths

(string[], optional) List of file paths for input reference images.

[] (empty array)

use_enhanced_prompt

(boolean, optional) Whether to use enhanced prompts to assist AI instructions.

true

target_image_max_size

(number, optional) Maximum size (in pixels) for the longer edge after resizing. The aspect ratio is preserved.

512

force_conversion_type

(string, optional) Optionally force conversion to a specific format ('jpeg', 'webp', 'png'). If not specified, the original format will be processed, defaulting to PNG for non-JPEG images.

None

skip_compression_and_resizing

(boolean, optional) Whether to skip compression and resizing of generated images. If true, force_conversion_type and target_image_max_size will be ignored.

false

jpeg_quality

(number, optional) JPEG quality (0-100). Lower values result in higher compression.

80

webp_quality

(number, optional) WebP quality (0-100). Lower values result in higher compression.

80

png_compression_level

(number, optional) PNG compression level (0-9). Higher values result in higher compression.

9

optipng_optimization_level

(number, optional) OptiPNG optimization level (0-7). Higher values result in higher compression.

2

Output

On success, the server returns the save path of the generated image and a message detailing the process, including the original and compressed file sizes. Example:

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

If an error occurs, an error message will be returned.


Notes

  • The MIME type and aspect ratio of the generated images depend on the default settings of the Gemini API.

  • Handle your API key with care.

  • This server uses the model gemini-2.0-flash-preview-image-generation. Google may discontinue this model in the future.


License

MIT

Available Tools

1 tool
generate_imageC

Generates an image based on a prompt and saves it to the specified path.

ParametersJSON Schema
NameRequiredDescriptionDefault
file_nameNoThe name of the image file to be saved (without extension). Defaults to 'generated_image'.generated_image
force_conversion_typeNoOptionally force conversion to a specific format ('jpeg', 'webp', 'png'). If not specified, the original format will be processed, defaulting to PNG for non-JPEG images.
input_image_pathsNoOptional. A list of file paths for input images to be used as a reference for generation.
jpeg_qualityNoJPEG quality (0-100). Lower values result in higher compression. Defaults to 80.
optipng_optimization_levelNoOptiPNG optimization level (0-7). Higher values result in higher compression. Defaults to 2.
output_directoryNoThe directory path to save the image. Defaults to 'output/images'.output/images
png_compression_levelNoPNG compression level (0-9). Higher values result in higher compression. Defaults to 9.
promptYesText prompt for image generation. If input images are provided, include instructions on how to use them to create the new image. English is recommended.
skip_compression_and_resizingNoWhether to skip compression and resizing of the generated image. If true, `force_conversion_type` and `target_image_max_size` are ignored. Defaults to false.
target_image_max_sizeNoThe maximum length (in pixels) of the longest side of the resized image. The original aspect ratio is maintained. Defaults to 512.
use_enhanced_promptNoWhether to use an enhanced prompt to assist the AI's instructions. Defaults to true.
webp_qualityNoWebP quality (0-100). Lower values result in higher compression. Defaults to 80.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions saving the image but omits critical details like potential side effects (e.g., file overwriting), performance considerations (e.g., generation time, resource usage), error handling, or output specifics. For a complex tool with 12 parameters, this lack of behavioral context is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's core function without unnecessary words. It is front-loaded with the essential action, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (12 parameters, no output schema, and no annotations), the description is inadequate. It fails to explain behavioral traits, output details, or usage context, leaving the agent with insufficient information to effectively invoke the tool beyond basic parameter filling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, meaning all parameters are well-documented in the schema itself. The description adds no additional parameter semantics beyond implying a 'prompt' and 'path' are involved, which is already covered. Thus, it meets the baseline of 3 where the schema does the heavy lifting without adding extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generates an image based on a prompt and saves it to the specified path.' It specifies the verb ('generates'), resource ('image'), and destination ('saves it to the specified path'), making the action explicit. However, it doesn't differentiate from siblings since there are none, so it cannot achieve a perfect score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or contextual constraints. It merely states what the tool does without indicating scenarios for its application, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedgenerate_image

TDQS

B3.1/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The tool 'generate_image' has a clearly distinct and singular purpose, making it impossible for an agent to misselect between non-existent alternatives.

Naming Consistency5/5

The single tool name 'generate_image' follows a clear verb_noun pattern (generate + image), and with only one tool, there is no inconsistency or deviation to evaluate. The naming is straightforward and predictable.

Tool Count2/5

A single tool is too few for most server purposes, as it limits functionality and flexibility. For an image generation server, one tool feels thin and under-scoped, lacking operations like editing, listing, or deleting images, which could hinder agent workflows.

Completeness2/5

The tool surface is severely incomplete for an image generation domain. While 'generate_image' covers creation, there are obvious gaps such as no ability to retrieve, update, delete, or manage generated images, leading to potential dead ends in agent tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/creating-cat/gemini-image-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server