Nano Banana — AI Image Generation & Editing
Generate and edit images using Google Gemini 2.5 Flash via the nano-banana MCP server.
Available MCP Tools
All tools are prefixed with mcp_nano-banana_ when called. There are 6 tools:
1. `mcp_nano-banana_generate_image` — Generate from text
Create a new image from a text prompt.
Parameters:
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| prompt | string | ✅ | Text describing the image to generate |
Example call:
{"prompt": "A serene Japanese garden with cherry blossoms at sunset, watercolor style"}
Behavior: Generates an image and saves it to ./generated_imgs/generated-[timestamp]-[id].png. Returns the file path and inline image content.
2. `mcp_nano-banana_edit_image` — Edit an existing image
Apply modifications to a specific image file on disk.
Parameters:
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| imagePath | string | ✅ | Full file path to the image to edit |
| prompt | string | ✅ | Description of modifications to make |
| referenceImages | string[] | ❌ | Optional array of file paths to reference images for style/content transfer |
Example call:
{
"imagePath": "./generated_imgs/generated-1234567890-abc.png",
"prompt": "Make the sky more dramatic with orange and purple tones",
"referenceImages": []
}
3. `mcp_nano-banana_continue_editing` — Continue editing last image
Continue editing the most recently generated/edited image in the session (no file path needed).
Parameters:
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| prompt | string | ✅ | Modifications/changes to make |
| referenceImages | string[] | ❌ | Optional reference images for style transfer |
Example call:
{"prompt": "Add a rainbow in the background"}
4. `mcp_nano-banana_get_last_image_info` — Get last image info
Returns metadata about the last generated/edited image (path, file size, last modified).
Parameters: None.
5. `mcp_nano-banana_configure_gemini_token` — Set API key
Persist a Gemini API key to local config.
Parameters:
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| apiKey | string | ✅ | Gemini API key |
6. `mcp_nano-banana_get_configuration_status` — Check config
Check whether the API key is configured and its source.
Parameters: None.
Workflow
Basic image generation
- User asks for an image → call
mcp_nano-banana_generate_imagewith a detailed prompt - The tool returns inline image content + saved file path
- Send the saved file to the user via
send_messagewithattachment_path
Iterative editing
- Generate initial image with
generate_image - User requests changes → use
continue_editing(uses last image automatically) - Repeat as needed — each edit builds on the previous result
Edit existing image
- User provides an image path → call
edit_imagewith the path and modification prompt - For style transfer: include reference images in
referenceImagesarray
Sending results to user
After any generation/edit, the image is saved to disk. Always send the file to the user:
send_message(attachment_path="/full/path/to/generated_imgs/filename.png", caption="描述")
Usage Guidance
- Prompt quality matters: Be specific about style, composition, colors, lighting. Translate vague user requests into detailed prompts.
- The model is Gemini 2.5 Flash Image: Good at photorealistic images, illustrations, and style transfer. Less suited for precise text rendering in images.
- File location: All generated images land in
./generated_imgs/relative to the rayclaw working directory (typically/home/ubuntu/rayclaw/generated_imgs/). - Session state: The MCP server tracks the last generated image per session, so
continue_editingworks across a conversation. - API key: Configured via
GEMINI_API_KEYenv var inmcp.json. If the user reports auth errors, check withget_configuration_status. - Rate limits: Gemini API has rate limits. If you get rate limit errors, wait a moment and retry.
- Image format: Output is always PNG.