Python MCP server for AI-powered image generation using Google Gemini models - A complete port of nanobanana
Project description
nanobanana-py
Python MCP server for AI-powered image generation using Google Gemini models.
A complete port of nanobanana (TypeScript) to Python.
Features
-
7 Image Generation Tools:
generate_image- Text to image with styles and variationsedit_image- Edit existing imagesrestore_image- Restore/enhance imagesgenerate_icon- App icons, favicons, UI elementsgenerate_pattern- Seamless patterns and texturesgenerate_story- Sequential story imagesgenerate_diagram- Technical diagrams and flowcharts
-
Dual Model Support: Flash (fast) and Pro (high quality)
-
Batch Generation: Generate multiple variations in parallel
-
Reference Images: Use existing images as references
-
Multiple Resolutions: 1K, 2K, 4K output options
Installation
Via uvx (Recommended)
uvx nanobanana-py
Via pip
pip install nanobanana-py
Via pipx
pipx install nanobanana-py
Configuration
Environment Variable
Get your API key from Google AI Studio.
export NANOBANANA_GEMINI_API_KEY="your-api-key-here"
Optional Environment Variables
# Use a different model (default: gemini-2.5-flash-image)
export NANOBANANA_MODEL="gemini-3-pro-image-preview"
# Set custom output directory
export NANOBANANA_OUTPUT_DIR="/path/to/output"
# Enable debug logging
export NANOBANANA_DEBUG="1"
Claude Code Integration
Add to your .mcp.json:
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": ["nanobanana-py"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key-here"
}
}
}
}
Or with local installation:
{
"mcpServers": {
"nanobanana": {
"command": "nanobanana-py"
}
}
}
Tools
generate_image
Generate single or multiple images from text prompts.
Parameters:
prompt(required): Image descriptionfiles: Reference image paths (1-13)filename: Output filenameoutput_count: Number of variations (1-8)styles: Artistic styles (photorealistic, watercolor, sketch, etc.)variations: Variation types (lighting, angle, mood, etc.)format: Output format (grid, separate)seed: Seed for reproducibilityresolution: 1K, 2K, or 4Kpreview: Auto-open in viewer
edit_image
Edit an existing image based on a text prompt.
Parameters:
prompt(required): Edit descriptionfile(required): Input image pathfilename: Output filenameresolution: 1K, 2K, or 4Kpreview: Auto-open in viewer
restore_image
Restore or enhance an existing image.
Parameters:
prompt(required): Restoration descriptionfile(required): Input image pathfilename: Output filenameresolution: 1K, 2K, or 4Kpreview: Auto-open in viewer
generate_icon
Generate app icons in multiple sizes.
Parameters:
prompt(required): Icon descriptionsizes: Icon sizes (16, 32, 64, 128, 256, 512, 1024)type: app-icon, favicon, ui-elementstyle: flat, skeuomorphic, minimal, modernformat: png, jpegbackground: transparent, white, blackcorners: rounded, sharp
generate_pattern
Generate seamless patterns and textures.
Parameters:
prompt(required): Pattern descriptionsize: Tile size (e.g., "256x256")type: seamless, texture, wallpaperstyle: geometric, organic, abstract, floral, techdensity: sparse, medium, densecolors: mono, duotone, colorfulrepeat: tile, mirror
generate_story
Generate a sequence of related images.
Parameters:
prompt(required): Story descriptionsteps: Number of images (2-8)type: story, process, tutorial, timelinestyle: consistent, evolvingtransition: smooth, dramatic, fade
generate_diagram
Generate technical diagrams and flowcharts.
Parameters:
prompt(required): Diagram descriptiontype: flowchart, architecture, network, database, wireframe, mindmap, sequencestyle: professional, clean, hand-drawn, technicallayout: horizontal, vertical, hierarchical, circularcomplexity: simple, detailed, comprehensive
Development
# Clone the repository
git clone https://github.com/aspect-apps/nanobanana-py.git
cd nanobanana-py
# Install dependencies
uv sync
# Install with dev dependencies
uv sync --extra dev
# Run tests
uv run pytest
# Format code
uv run ruff format src/
uv run ruff check src/ --fix
License
MIT
Credits
- Original nanobanana by Will 保哥
- Built with FastMCP
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanobanana_py-0.1.0.tar.gz.
File metadata
- Download URL: nanobanana_py-0.1.0.tar.gz
- Upload date:
- Size: 133.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3a7c625cd9fbf38e8c34618e434d5b2caf7cbf6b08d7ac71f4c62ebe388e517
|
|
| MD5 |
ad031d2cafa3a0de79a6405e69a96b60
|
|
| BLAKE2b-256 |
2e678a0ab15466e3d26048ff8cd6090151fd66c70054d03195481cce860ac261
|
Provenance
The following attestation bundles were made for nanobanana_py-0.1.0.tar.gz:
Publisher:
publish.yml on yazelin/nanobanana-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobanana_py-0.1.0.tar.gz -
Subject digest:
b3a7c625cd9fbf38e8c34618e434d5b2caf7cbf6b08d7ac71f4c62ebe388e517 - Sigstore transparency entry: 867722468
- Sigstore integration time:
-
Permalink:
yazelin/nanobanana-py@9375dc4076b4b7daed1f4572e53ade5021a9318a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yazelin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9375dc4076b4b7daed1f4572e53ade5021a9318a -
Trigger Event:
release
-
Statement type:
File details
Details for the file nanobanana_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nanobanana_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
554c778bf6a7483b7c009060f5da5463fa808738d8a76711ffb3fb4827c12fdf
|
|
| MD5 |
1b0cd18281ef680d1defbe3d417ca530
|
|
| BLAKE2b-256 |
9b7b844514dbc283c7c177d9aefd767a98e7ce7ca88eb30380239220534510a0
|
Provenance
The following attestation bundles were made for nanobanana_py-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on yazelin/nanobanana-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanobanana_py-0.1.0-py3-none-any.whl -
Subject digest:
554c778bf6a7483b7c009060f5da5463fa808738d8a76711ffb3fb4827c12fdf - Sigstore transparency entry: 867722472
- Sigstore integration time:
-
Permalink:
yazelin/nanobanana-py@9375dc4076b4b7daed1f4572e53ade5021a9318a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yazelin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9375dc4076b4b7daed1f4572e53ade5021a9318a -
Trigger Event:
release
-
Statement type: