AiondaDotCom/mcp-gemini-image
If you are the rightful owner of mcp-gemini-image and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Google Gemini Image Generation Server is a Model Context Protocol server that leverages Google's Imagen 4 model to generate high-quality images with enhanced text rendering and detailed imagery.
generate-image
Generate images using Google Gemini Imagen 4.
configure-server
Configure Google API credentials.
get-config-status
Check the current configuration status of the server.
list-supported-models
List all supported Google Gemini image generation models with their capabilities.
MCP Google Gemini Image Generation Server
Logo generated using Google Gemini via this MCP server
A Model Context Protocol (MCP) server that provides Google Gemini image generation capabilities, specifically supporting the Imagen 4 model for high-quality image generation with enhanced text rendering and detailed imagery.
Features
- Imagen 4 Support: Generate high-quality images using Google's latest Imagen 4 model
- Multiple Models: Support for both standard and ultra versions of Imagen 4
- Flexible Parameters: Configurable aspect ratios, number of images, and person generation settings
- Automatic File Management: Images are automatically saved to your Desktop
- TypeScript: Full TypeScript support with proper type definitions
- MCP Protocol: Seamless integration with MCP-compatible clients
Installation
- Clone this repository
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
API Key Setup
- Get a Google API key from the Google Cloud Console
- Enable the Generative AI API for your project
- Start the MCP server
- Use the
configure-server
tool to set your API key before generating images- Note: Your API key will be automatically saved to
~/.mcp-gemini-image.json
for future use
- Note: Your API key will be automatically saved to
Usage
Running the Server
npm start
Available Tools
1. generate-image
Generate images using Google Gemini Imagen 4.
Parameters:
prompt
(required): Text description of the desired imagemodel
(optional): Choose betweenimagen-4.0-generate-preview-06-06
(default) orimagen-4.0-ultra-generate-preview-06-06
aspect_ratio
(optional):square
,portrait
, orlandscape
(default:square
)num_images
(optional): Number of images to generate (1-4 for standard, 1 for ultra) (default: 1)person_generation
(optional):dont_allow
,allow_adult
, orallow_all
(default:allow_adult
)filename
(optional): Custom filename for the saved image
Example:
{
"prompt": "A serene mountain landscape with a crystal clear lake reflecting the snow-capped peaks at sunset",
"model": "imagen-4.0-generate-preview-06-06",
"aspect_ratio": "landscape",
"num_images": 2
}
2. configure-server
Configure Google API credentials.
Parameters:
api_key
(required): Your Google API keyproject_id
(optional): Your Google Cloud project ID
Note: Credentials are automatically saved to ~/.mcp-gemini-image.json
and will persist between server restarts.
Example:
{
"api_key": "your-google-api-key"
}
3. get-config-status
Check the current configuration status of the server.
Returns:
- Configuration status
- Available models
- Image save directory
4. list-supported-models
List all supported Google Gemini image generation models with their capabilities.
Returns:
- Model details
- Maximum number of images per model
- Model features
Model Comparison
Imagen 4 Standard (imagen-4.0-generate-preview-06-06
)
- Max Images: 1-4 per request
- Features: High-quality, detailed images with good lighting
- Best for: General image generation, multiple variations
Imagen 4 Ultra (imagen-4.0-ultra-generate-preview-06-06
)
- Max Images: 1 per request
- Features: Enhanced quality and detail, premium version
- Best for: High-quality single images, professional use
File Management
Images are automatically saved to:
- Directory:
~/Desktop/gemini-images/
- Format: PNG files with timestamp
- Metadata: JSON files with generation parameters
Error Handling
The server provides comprehensive error handling for:
- Invalid API credentials
- Model parameter validation
- Network connectivity issues
- File system errors
Development
Scripts
npm run build
: Build the TypeScript projectnpm run dev
: Watch mode for developmentnpm run clean
: Clean build directory
Project Structure
src/
āāā index.ts # Main entry point
āāā server.ts # MCP server implementation
āāā config-manager.ts # Configuration management
āāā image-generator.ts # Google Gemini API integration
āāā file-manager.ts # File operations
āāā types.ts # TypeScript definitions
Requirements
- Node.js 18.0.0 or later
- Google API key with Generative AI API enabled
- TypeScript 5.0.0 or later
License
MIT License
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Support
For issues and questions, please open an issue on the GitHub repository.
Changelog
v1.0.0
- Initial release with Imagen 4 support
- Basic image generation functionality
- Configuration management
- File management system