
mcp google gemini image generation
通过 Google Gemini API 实现基于文本提示的图像生成功能,支持多种配置和上下文集成。
Repository Info
About This Server
通过 Google Gemini API 实现基于文本提示的图像生成功能,支持多种配置和上下文集成。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Google Gemini Image Generation
MCP server for generating images using Google's Gemini API with Context7 integration.
Features
- Generate images from text prompts using Google Gemini API
- Save generated images to a specified directory
- Configure different Gemini models for image generation
- Context7 integration with sequential thinking capability
- Supports both programmatic use and CLI interface
Installation
npm install -g mcp-google-gemini-image-generation
Or use it directly with npx:
npx mcp-google-gemini-image-generation
Configuration
Create a .env file in your project directory (you can copy from .env.example):
# Google Gemini API Key
GEMINI_API_KEY=your_api_key_here
# Output directory for images
OUTPUT_DIR=./output
# Default model for image generation
DEFAULT_MODEL=gemini-2.0-flash-preview-image-generation
Usage
Using in VS Code with MCP Extension
- Make sure you have the MCP Extension installed in VS Code
- Add the server to your MCP configuration:
{
"servers": {
"gemini-image-generation": {
"command": "npx",
"args": ["-y", "mcp-google-gemini-image-generation"]
}
}
}
- Use it in VS Code by providing context:
prompt: "Create an image of a dragon flying over a magical forest"
outputPath: "./images"
outputFilename: "dragon.png"
model: "gemini-2.0-flash-preview-image-generation"
Using with CLI
npx mcp-google-gemini-image-generation --api-key YOUR_API_KEY --output-dir ./images --model gemini-2.0-flash-preview-image-generation
Using Sequential Thinking
This MCP server includes a sequential thinking tool that helps break down complex image generation tasks:
{
"thoughtNumber": 1,
"totalThoughts": 3,
"thought": "First, let's consider the key elements needed in this fantasy scene...",
"nextThoughtNeeded": true
}
API Reference
Context Parameters
| Parameter | Description | Required | Default |
|---|---|---|---|
| prompt | The text prompt to generate an image from | Yes | - |
| model | The Gemini model to use | No | gemini-2.0-flash-preview-image-generation |
| outputPath | Directory to save the generated image | No | ./output |
| outputFilename | Filename for the generated image | No | gemini-image-[uuid].png |
Tools
generate-image
Generates an image based on text prompt.
Parameters:
prompt(required): Text description of the image to generatemodel: Name of the Gemini model to useoutputPath: Directory to save the imageoutputFilename: Custom filename for the generated image
sequential-thinking
Enables step-by-step complex reasoning for image generation tasks.
Parameters:
thought(required): Current thinking stepnextThoughtNeeded(required): Whether another thought step is neededthoughtNumber(required): Current thought numbertotalThoughts(required): Estimated total thoughts neededisRevision: Whether this revises previous thinkingrevisesThought: Which thought is being reconsideredbranchFromThought: Branching point thought numberbranchId: Branch identifierneedsMoreThoughts: If more thoughts are needed
License
ISC
Quick Start
Clone the repository
git clone https://github.com/gyuha/mcp-google-gemini-image-generationInstall dependencies
cd mcp-google-gemini-image-generation
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.