Nanana MCP Server: Gemini Nano Text-to-Image & Image-to-Image
Generate stunning images on the Nanana MCP server using Google Gemini Nano for text-to-image and image-to-image editing.
npx -y @nanana-app/mcp-server-nano-bananaOverview
The Nanana MCP Server is a lightweight Model Context Protocol (MCP) adapter that exposes Google Gemini Nano for image generation and image editing workflows. It implements simple HTTP endpoints compatible with MCP-style clients so you can use Gemini Nano for text-to-image (T2I) and image-to-image (I2I) tasks inside developer tools, bots, or hobby projects.
This server acts as a small bridge between your application and Gemini Nano: it accepts normalized MCP-style requests (prompt, seed, size, strength, etc.), forwards them to the configured provider, and returns a compact JSON response (base64 images, metadata). It is useful when you want a consistent, local-looking API for generating images without embedding provider-specific SDK logic across your codebase.
Features
- Text-to-image generation using Google Gemini Nano
- Image-to-image editing (prompt-guided edits, strength/scale controls)
- Simple MCP-style HTTP endpoints (JSON input / JSON output)
- Configurable provider and model options via environment variables / config file
- Returns base64-encoded PNG/JPEG images and metadata (seed, model, size)
- Lightweight, suitable to run locally or in a container
- Example clients and curl snippets for quick experimentation
Installation / Configuration
Requirements: Node.js >= 18 (or configured runtime), npm/yarn, and a provider API key for Gemini Nano.
- Clone the repo and install:
- Configure environment variables (example):
# .env
PORT=3000
PROVIDER=google # or other supported provider
GEMINI_API_KEY=your_google_gemini_api_key
MODEL=gemini-nano # default model name
LOG_LEVEL=info
Env vars explained:
| Variable | Purpose |
|---|---|
| PORT | HTTP port to listen on |
| PROVIDER | Provider implementation (e.g., “google”) |
| GEMINI_API_KEY | API key for Google Gemini access |
| MODEL | Model identifier (default: gemini-nano) |
| LOG_LEVEL | Logging verbosity (info/debug) |
- Start the server:
# or for development
You can also run it in Docker:
Configuration file (optional):
// mcp-config.json
Available Tools / Resources
- Git repository: https://github.com/nanana-app/mcp-server-nano-banana
- Gemini docs: refer to Google Cloud / Gemini API docs for rate limits and advanced options
- Example clients: included samples in the repo (curl scripts and Node.js client)
- Logs: server prints request/response metadata when LOG_LEVEL=debug
Endpoints (examples)
Below are typical endpoints exposed by the MCP server. The actual path names may vary slightly; check the repo README or source for exact routes.
- POST /v1/t2i — Text-to-image
- POST /v1/i2i — Image-to-image (requires input image)
- GET /health — Health check
Example request/response shapes are shown below.
Text-to-image example (curl):
Example response:
Image-to-image example (curl):
Returned images are base64-encoded; consumers should decode and save as PNG/JPEG.
Use Cases
- Rapid prototyping: Integrate a consistent T2I/I2I endpoint in a prototype without wiring provider SDKs everywhere.
- Content generation pipeline: Batch-generate thumbnails, concept art, or backgrounds using scripted calls to /v1/t2i.
- Assisted editing: Provide a frontend for non-technical users to upload an image and apply prompt-based edits using /v1/i2i.
- Game asset iteration: Quickly iterate on sprites or environment art by generating variations with different prompts and seeds.
- Chatbot attachments: Embed image generation into a chat assistant: convert user prompts to images and return them as attachments.
Notes and Best Practices
- Respect provider rate limits and quotas; use caching for repeated prompts and consider batching requests.
- Keep API keys secure and do not embed them in client-side code.
- For large-scale usage, run the server behind a reverse proxy and add authentication/quota controls.
- Tune size and steps to balance quality vs. latency and cost (larger sizes and more steps increase generation time).
For complete examples, detailed option lists, and provider-specific setup, see the GitHub repository: https://github.com/nanana-app/mcp-server-nano-banana.