About Gemini Image Mcp Server
Gemini Image MCP Server provides Gemini-based image generation and editing for users working with images through MCP. It supports PNG output and manages generated file paths.
Key features
- 01Generate images from text prompts
- 02Edit existing images
- 03Support PNG format
- 04Manage file paths automatically
Use cases
- 01Create images from prompts
- 02Modify images with instructions
MCP support
It exposes image generation and editing tools to MCP clients and returns the absolute path of each resulting image.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEInstallation
Gemini Image MCP Server
Google Gemini-based image generation and editing service providing AI image processing capabilities through MCP protocol.
Features
- Text-to-Image Generation (generate_image)
- Image Editing & Modification (edit_image)
- PNG Format Support
- Automatic File Path Management
安装运行
# 安装依赖
uv pip install -r requirements.txt
# 设置环境变量(Linux/macOS)
export GEMINI_API_KEY=your_api_key_here
# Windows 设置:
setx GEMINI_API_KEY "your_api_key_here"
API Documentation
generate_image
@mcp.tool()
async def generate_image(prompt: str, save_path: str = None) -> str:
"""
:param prompt: Image generation prompt (works better in English)
:param save_path: Optional save path (default: generated-images/ directory)
:return: Absolute path of generated image
"""
edit_image
@mcp.tool()
async def edit_image(prompt: str, image_path: str, save_path: str = None) -> str:
"""
:param prompt: 图像编辑指令(支持中文)
:param image_path: 原始图片路径
:param save_path: 可选保存路径,默认生成在 generated-images/ 目录
:return: 编辑后图片的绝对路径
"""
MCP Configuration
Add to mcp.json:
{
"mcpServers": {
"gemini-image-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/",
"run",
"server.py"
]
}
}
}
Important Notes
- Ensure replacement of absolute paths in configuration
- API key must be set through environment variables
- Recommended to run sample code first for initial usage
- Generated images default to generated-images directory
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.