MCP Image Gen
Enables image generation from text prompts using Google's Gemini AI models (gemini-3-pro-image-preview and gemini-2.5-flash-image), with support for customizable aspect ratios, resolutions up to 4K, and automatic local image saving.
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., "@MCP Image Gengenerate a 16:9 image of a futuristic city skyline at night in xlarge size"
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.
MCP Image Gen
A Model Context Protocol (MCP) server for generating images using Google's Gemini AI models and OpenAI's GPT Image models.
Features
🎨 Generate high-quality images from text prompts using Gemini and OpenAI models
🖼️ Source/reference image support for editing, style transfer, and character consistency
📐 Customizable aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4)
🔧 Configurable image sizes with provider-aware mapping
🤖 OpenAI support for GPT Image models, including
gpt-image-2,gpt-image-1.5, andchatgpt-image-latest🧩 Provider is inferred automatically from the selected model
⚙️ Flexible configuration via JSON file
💾 Automatic local image saving with organized filenames (saves to ~/gemini_images by default)
🚀 Built on the MCP SDK for seamless integration
Related MCP server: Gemini-Imagen4
Models Supported
gemini-3-pro-image-preview (Default): Professional-grade, supports up to 4K resolution
gemini-3.1-flash-image-preview: High-efficiency counterpart to Gemini 3 Pro, optimized for speed and high-volume use; supports up to 4K resolution
gemini-2.5-flash-image: Optimized for speed, generates 1024px resolution
gpt-image-2: Experimental OpenAI model string accepted by this server
gpt-image-1.5: Latest documented dedicated OpenAI image generation model
chatgpt-image-latest: The image model currently used in ChatGPT
gpt-image-1: Previous GPT Image generation model
gpt-image-1-mini: Lower-cost GPT Image variant
Installation
Clone the repository:
git clone https://github.com/Legorobotdude/mcp-image-gen.git
cd mcp-image-genInstall dependencies:
pnpm installBuild the project:
pnpm buildConfiguration
Environment Variables
Set one or both provider API keys:
export GEMINI_API_KEY=your_api_key_here
export OPENAI_API_KEY=your_api_key_hereGet your API key from Google AI Studio. Get your OpenAI API key from OpenAI.
Config File (Optional)
Create a config.json file in the project root to customize defaults:
{
"model": "gemini-3-pro-image-preview",
"defaultAspectRatio": "1:1",
"defaultImageSize": "large",
"outputDirectory": "~/gemini_images"
}Available Options:
model:Gemini:
"gemini-3-pro-image-preview"(default),"gemini-3.1-flash-image-preview","gemini-2.5-flash-image"OpenAI:
"gpt-image-2","gpt-image-1.5","chatgpt-image-latest","gpt-image-1","gpt-image-1-mini"
defaultAspectRatio:"1:1","16:9","9:16","4:3", or"3:4"defaultImageSize:"small"(1K - 1024px)"medium"(2K - 2048px)"large"(2K - 2048px)"xlarge"(4K - 4096px - only for gemini-3.1-flash-image-preview and gemini-3-pro-image-preview)
outputDirectory: Path where generated images will be saved (default:~/gemini_images, can use absolute paths or~for home directory)
Usage with Claude Desktop
Add to your Claude Desktop configuration file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mcp-image-gen": {
"command": "node",
"args": ["/absolute/path/to/mcp-image-gen/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}Tool: generate_image
Generate an image from a text prompt.
Parameters
prompt (required): Text description of the image to generate
model (optional): Gemini or OpenAI image model. Provider is inferred automatically from the model. Defaults to server config.
aspectRatio (optional): Aspect ratio -
"1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"imageSize (optional): Resolution -
"small"(1K),"medium"(2K),"large"(2K),"xlarge"(4K)negativePrompt (optional): Describe what you DON'T want in the image
sourceImages (optional): Array of absolute file paths to source/reference images
Gemini: png, jpg, jpeg, gif, webp; max 14 images
OpenAI: png, jpg, jpeg, webp; max 16 images
The server still accepts OpenAI-specific quality and background arguments for direct callers, but they are no longer advertised in the MCP schema. OpenAI moderation is fixed to low.
Example Usage in Claude
Generate an image of a serene mountain landscape at sunset with vibrant colorsCreate a 16:9 image of a futuristic city skyline at night in xlarge size with GeminiGenerate a portrait of a wise old wizard with a long beard, aspect ratio 3:4, medium size, using model gpt-image-1.5Edit this photo to make it look like a watercolor painting (with sourceImages: ["/path/to/photo.jpg"])Create a product cutout using model chatgpt-image-latestResponse Format
The tool returns a JSON response with:
{
"success": true,
"imagePath": "/Users/yourusername/gemini_images/1234567890_serene_mountain_landscape.png",
"provider": "openai",
"prompt": "serene mountain landscape at sunset",
"model": "gpt-image-1.5",
"aspectRatio": "1:1",
"imageSize": "large",
"message": "Image generated successfully and saved to: /Users/yourusername/gemini_images/1234567890_serene_mountain_landscape.png"
}Image Quality Notes
All generated images include a SynthID watermark (Google's digital watermark)
gemini-3-pro-image-preview (default): Best for high-quality, detailed images up to 4K
gemini-3.1-flash-image-preview: Best for speed and high-volume use, supports up to 4K
gemini-2.5-flash-image: Best for quick generation, fixed at 1024px resolution
gpt-image-1.5: Best OpenAI image quality and instruction following
chatgpt-image-latest: Tracks the image model currently used in ChatGPT
OpenAI GPT Image models support square, landscape, and portrait sizes. Non-square aspect ratios are mapped to the closest supported OpenAI size.
OpenAI moderation is hardcoded to the least restrictive documented setting,
low.
Development
Watch mode for development:
pnpm devBuild for production:
pnpm buildTroubleshooting
"set GEMINI_API_KEY and/or OPENAI_API_KEY"
Make sure you've set at least one provider API key or added it to your MCP configuration.
Images not generating
Check your API key is valid
Verify you have internet connectivity
Ensure the output directory is writable
Size options not working
The gemini-2.5-flash-image model only supports 1024px resolution regardless of the size parameter. Use gemini-3-pro-image-preview or gemini-3.1-flash-image-preview for higher resolutions.
OpenAI aspect ratios look approximate
OpenAI GPT Image models support 1024x1024, 1536x1024, and 1024x1536. Wider or taller aspect ratios are mapped to the nearest supported landscape or portrait size.
License
MIT
This server cannot be installed
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
- AlicenseAqualityDmaintenanceEnables image generation and editing using Google Gemini AI with support for multiple aspect ratios, context images, custom styles, and watermark overlays. Optimized for creating social media content with automatic file saving and flexible output configuration.2103MIT
- Flicense-qualityDmaintenanceGenerate high-quality images from text descriptions using Google's Imagen 4.0 models with multiple quality variants, flexible aspect ratios, and local file storage.3
- Alicense-qualityBmaintenanceEnables AI assistants to generate high-quality images using Google's Gemini and Imagen models with support for multiple aspect ratios, dynamic model selection, and direct file saving capabilities.MIT
- Flicense-qualityCmaintenanceEnables image generation and editing using Google's Gemini models with support for model selection and custom aspect ratios. Users can generate high-quality images or modify existing ones through natural language prompts while controlling specific parameters like quality and dimensions.
Related MCP Connectors
Generate logos, social posts, app screenshots, comic panels & visual-novel assets from prompts.
LLM chat, text summarization and AI image generation
Generate PWA icon sets and iOS splash screens from a text prompt or an existing image.
Appeared in Searches
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/Legorobotdude/mcp-image-gen'
If you have feedback or need assistance with the MCP directory API, please join our Discord server