mrn-gemini-imagen-mcp
Generates and edits images using the Google Gemini API, supporting text-to-image generation, image editing, and multi-turn iterative refinement.
Click on "Install 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., "@mrn-gemini-imagen-mcpgenerate a serene Japanese garden with koi pond"
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.
mrn-gemini-imagen-mcp
MCP (Model Context Protocol) server for generating and editing images using Google Gemini API.
Quick Start
Get your API key from Google AI Studio
Add to Claude Desktop config:
{
"mcpServers": {
"gemini-imagen": {
"command": "npx",
"args": ["-y", "mrn-gemini-imagen-mcp"],
"env": { "GEMINI_API_KEY": "your-api-key-here" }
}
}
}Restart Claude Desktop and start generating images!
Related MCP server: Gemini Gen MCP
Features
Text-to-Image Generation: Generate images from text descriptions
Image Editing: Modify existing images based on text prompts
Multi-turn Iteration: Refine images through conversational editing sessions
Configurable Aspect Ratios: Support for 10 different aspect ratios
Flexible Model Selection: Use any Gemini image model via configuration
Prerequisites
Node.js >= 18.0.0
Google Gemini API Key (get one from Google AI Studio)
Installation
Option 1: Using npx (Recommended)
No installation needed! Just configure Claude Desktop or Claude Code to use it directly via npx.
Option 2: Global Install
npm install -g mrn-gemini-imagen-mcpOption 3: From Source
git clone https://github.com/mernorthzide/mrn-gemini-imagen-mcp.git
cd mrn-gemini-imagen-mcp
npm install
npm run buildConfiguration
Set the following environment variables:
Variable | Required | Default | Description |
| Yes | - | Your Google Gemini API key |
| No |
| Gemini model to use |
| No |
| Output directory for images |
Supported Models
gemini-3-pro-image-preview(default, latest)gemini-2.5-flash-image(stable, faster)
Supported Aspect Ratios
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
Note: Aspect ratio is optional. If not specified, Gemini will automatically select the best aspect ratio based on your prompt.
Usage with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Using npx (Recommended)
{
"mcpServers": {
"gemini-imagen": {
"command": "npx",
"args": ["-y", "mrn-gemini-imagen-mcp"],
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}Using Global Install
{
"mcpServers": {
"gemini-imagen": {
"command": "mrn-gemini-imagen-mcp",
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}Usage with Claude Code
Add to your Claude Code settings file (~/.claude.json):
{
"mcpServers": {
"gemini-imagen": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mrn-gemini-imagen-mcp"],
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}Tip: Set
GEMINI_MODELtogemini-2.5-flash-imagefor faster generation.
Tools
1. generate_image
Generate an image from a text description.
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Description of the image to generate |
| string | No | Aspect ratio (auto-selected by Gemini if not provided) |
| string | No | Custom output file path |
Example:
{
"prompt": "A serene Japanese garden with a koi pond and cherry blossoms",
"aspectRatio": "16:9"
}Response:
{
"success": true,
"filePath": "/path/to/a_serene_japanese_garden_1705123456789.png",
"message": "Image generated successfully"
}2. edit_image
Edit an existing image based on a text prompt.
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Path to the image to edit |
| string | Yes | Instructions for editing |
| string | No | Aspect ratio for output |
| string | No | Custom output file path |
Example:
{
"imagePath": "/path/to/original.png",
"prompt": "Change the sky to a beautiful sunset with orange and pink colors"
}3. iterate_image
Iteratively refine an image through multi-turn conversation.
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Instructions for this iteration |
| string | No | Session ID from previous iteration |
| string | Conditional | Required when starting new session |
| string | No | Aspect ratio for output |
Starting a new session:
{
"imagePath": "/path/to/original.png",
"prompt": "Add a rainbow in the background"
}Response:
{
"success": true,
"filePath": "/path/to/add_a_rainbow_1705123456789.png",
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
"message": "Image iteration completed. Use the same sessionId to continue editing."
}Continuing the session:
{
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
"prompt": "Make the rainbow more vibrant and add some birds"
}Error Handling
All tools return structured error responses when something goes wrong:
{
"success": false,
"error": {
"code": "SAFETY_BLOCKED",
"message": "Content was blocked by safety filters",
"reason": "HARM_CATEGORY_DANGEROUS_CONTENT"
}
}Error Codes:
Code | Description |
| Content blocked by safety filters |
| Error from Gemini API |
| Invalid input parameters |
| File read/write error |
Development
# Watch mode for development
npm run dev
# Build for production
npm run build
# Run the server directly
npm startFile Structure
mrn-gemini-imagen-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── types.ts # TypeScript types and constants
│ ├── services/
│ │ └── geminiClient.ts # Gemini API wrapper
│ ├── tools/
│ │ ├── generateImage.ts # Text-to-image tool
│ │ ├── editImage.ts # Image editing tool
│ │ └── iterateImage.ts # Multi-turn iteration tool
│ └── utils/
│ ├── fileManager.ts # File operations
│ └── sessionManager.ts # Session management
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdLicense
MIT
Acknowledgments
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides AI image generation and editing capabilities using Google's Gemini 2.5 Flash Image API. It allows users to create new images from text, modify existing files, and perform iterative edits through natural language prompts.Last updated61,090MIT
- AlicenseBqualityCmaintenanceMCP server for generating images and audio using Google's Gemini AI models.Last updated22MIT
- AlicenseBqualityDmaintenanceAn MCP server for AI-powered image generation, editing, analysis, and transformation using Google's Gemini and Imagen 4 models.Last updated192AGPL 3.0
- Alicense-qualityDmaintenanceMCP server for Google Gemini image generation with configurable model support, enabling text-to-image generation, image editing, and iterative refinement.Last updated39MIT
Related MCP Connectors
MCP server for Google Veo AI video generation
MCP server for Midjourney AI image generation and editing
MCP server for NanoBanana AI image generation and editing
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/mernorthzide/mrn-gemini-imagen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server