gemini-image-mcp
Enables AI-powered image generation using Google's Gemini API, supporting text prompts and optional reference images with automatic compression and file management
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gemini-image-mcp generate a futuristic cityscape with flying cars at sunset"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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_KEYwith 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 |
| (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 |
| (string, optional) Directory path where the generated image will be saved. |
|
| (string, optional) Name of the saved image file (without extension). |
|
| (string[], optional) List of file paths for input reference images. |
|
| (boolean, optional) Whether to use enhanced prompts to assist AI instructions. |
|
| (number, optional) Maximum size (in pixels) for the longer edge after resizing. The aspect ratio is preserved. |
|
| (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 |
| (boolean, optional) Whether to skip compression and resizing of generated images. If |
|
| (number, optional) JPEG quality (0-100). Lower values result in higher compression. |
|
| (number, optional) WebP quality (0-100). Lower values result in higher compression. |
|
| (number, optional) PNG compression level (0-9). Higher values result in higher compression. |
|
| (number, optional) OptiPNG optimization level (0-7). Higher values result in higher compression. |
|
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 toolgenerate_imageC
Generates an image based on a prompt and saves it to the specified path.
Inputs: prompt (required), file_name, force_conversion_type, input_image_paths, +8 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
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.
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.
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.
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.
Related MCP Connectors
MCP server for Qwen Image 3 AI image generation
MCP server for Flux AI image generation
MCP server for Grok Imagine AI video generation
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for generating images and audio using Google's Gemini AI models.272 PyPI2MIT
- FlicenseAqualityDmaintenanceMCP server that generates images using Gemini models via an OpenAI-compatible gateway.19-
- AlicenseAqualityCmaintenanceMCP server for Google Gemini image generation with configurable model support, enabling text-to-image generation, image editing, and iterative refinement.640MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides image generation capabilities using Google's Gemini 2.5 Flash Image Preview model.101 npmMIT