image-brother
v1.2.1
Published
MCP server for AI-powered image generation and editing using Duomi Nano Banana API
Maintainers
Readme
image-brother
MCP (Model Context Protocol) server for AI-powered image generation using Duomi Nano Banana API (Google Gemini).
Features
- Text-to-image generation - Create images from text prompts
- Image editing/transformation - Edit and transform images with AI (supports up to 5 reference images)
- Support for multiple models (Gemini 2.5 Pro / Gemini 3 Pro)
- Configurable aspect ratios and resolutions (1K/2K/4K)
- Automatic task polling and result retrieval
- Easy configuration via environment variables
Installation
Via npm
npm install -g image-brotherVia npx (no installation)
npx image-brotherConfiguration
Configure your Duomi API key as an environment variable in your MCP client.
Get your API key from: https://duomiapi.com
Usage with Claude Desktop
Add this to your Claude Desktop configuration with your API key:
macOS/Linux
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"image-brother": {
"command": "npx",
"args": ["-y", "image-brother"],
"env": {
"DUOMI_API_KEY": "your-duomi-api-key-here"
}
}
}
}Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"image-brother": {
"command": "npx",
"args": ["-y", "image-brother"],
"env": {
"DUOMI_API_KEY": "your-duomi-api-key-here"
}
}
}
}Available Tools
1. text_to_image - Text-to-Image Generation
Generate an image from a text prompt.
Parameters
| Parameter | Type | Required | Description | Default |
|-----------|------|----------|-------------|---------|
| prompt | string | ✅ | Text description of the image to generate | - |
| model | string | ❌ | Model: gemini-2.5-pro-image-preview or gemini-3-pro-image-preview | gemini-2.5-pro-image-preview |
| aspect_ratio | string | ❌ | Aspect ratio (e.g., 16:9, 1:1, 3:4) | 16:9 |
| image_size | string | ❌ | Resolution: 1K, 2K, or 4K (4K only for pro model) | 2K |
Example Usage in Claude
User: Generate an image of a lion on the grassland
Claude: [Calls text_to_image tool with prompt="A lion on the grassland"]Response Format
{
"success": true,
"taskId": "05ed364d-b392-8d18-97c2-eb6ea797541b",
"imageUrl": "https://cdn3.dmiapi.com/attachments/gemini/.../image.jpeg",
"fileName": "output.jpeg",
"description": "Here is an image of a lion on the grassland",
"prompt": "A lion on the grassland",
"model": "gemini-2.5-pro-image-preview",
"aspectRatio": "16:9",
"imageSize": "2K"
}2. edit_image - Image Editing/Transformation
Edit or transform images using text prompts and reference images. Upload up to 5 reference images to guide the generation.
Parameters
| Parameter | Type | Required | Description | Default |
|-----------|------|----------|-------------|---------|
| prompt | string | ✅ | Text description for the image editing/transformation | - |
| image_urls | array | ✅ | Array of reference image URLs (1-5 images) | - |
| model | string | ❌ | Model: gemini-2.5-pro-image-preview or gemini-3-pro-image-preview | gemini-2.5-pro-image-preview |
| aspect_ratio | string | ❌ | Aspect ratio (e.g., 16:9, 1:1, 3:4). Recommended to omit for auto-adaptation | "" (auto-adapt) |
| image_size | string | ❌ | Resolution: 1K, 2K, or 4K (4K only for pro model) | 2K |
Example Usage in Claude
User: Make this photo look like a watercolor painting
[User provides image URL: https://example.com/photo.jpg]
Claude: [Calls edit_image tool with:
prompt="Convert to watercolor painting style",
image_urls=["https://example.com/photo.jpg"]
]Response Format
{
"success": true,
"taskId": "3fb45a4a-750d-39bb-04da-4337a0f450bd",
"imageUrl": "https://cdn3.dmiapi.com/attachments/gemini/.../output.jpeg",
"fileName": "output.jpeg",
"description": "Watercolor painting style applied",
"prompt": "Convert to watercolor painting style",
"referenceImages": ["https://example.com/photo.jpg"],
"model": "gemini-2.5-pro-image-preview",
"aspectRatio": "auto-adapt",
"imageSize": "2K"
}Notes
- Maximum 5 reference images allowed
- For single reference image,
aspect_ratiodefaults to auto-adapt to the reference image - For multiple reference images, you can specify a custom
aspect_ratioif needed
Models
Standard Model: gemini-2.5-pro-image-preview
- Resolution: 1K, 2K
- Cost: 0.07 yuan/image
- Good for general use
Pro Model: gemini-3-pro-image-preview
- Resolution: 1K, 2K, 4K
- Cost: 0.14 yuan/image
- Higher quality output
Aspect Ratios
Supported aspect ratios:
16:9- Landscape (default, 1920x1080)1:1- Square3:4- Portrait4:3- Landscape9:16- Vertical- And more...
Development
Build from source
git clone <your-repo-url>
cd image-brother
npm install
npm run buildRun locally
npm run build
node dist/index.jsWatch mode
npm run watchPublishing to npm
# Login to npm
npm login
# Publish
npm publishTroubleshooting
DUOMI_API_KEY environment variable not set
Make sure you've configured the env section in your MCP client configuration with your API key:
{
"mcpServers": {
"image-brother": {
"command": "npx",
"args": ["-y", "image-brother"],
"env": {
"DUOMI_API_KEY": "your-api-key-here"
}
}
}
}Task timeout
If image generation takes too long, the server will timeout after 30 polling attempts (60 seconds). Try again with a simpler prompt.
API errors
Check that your API key is valid and you have sufficient credits at https://duomiapi.com.
License
MIT
Credits
- Powered by Duomi API
- Uses Google Gemini Nano Banana image generation
- Built with Model Context Protocol SDK
