# Nanobanana Mcp

> MCP server for AI image generation via Gemini — text-to-image with reference image support, for Claude

- **Type:** MCP server
- **Install:** `agentstack add mcp-amylyra-nanobanana-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [amylyra](https://agentstack.voostack.com/s/amylyra)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [amylyra](https://github.com/amylyra)
- **Source:** https://github.com/amylyra/nanobanana-mcp

## Install

```sh
agentstack add mcp-amylyra-nanobanana-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# NanoBanana MCP

A production MCP server for image generation, editing, and analysis in Claude, powered by Gemini.

**Live:** `https://nanobanana-739905005785.us-central1.run.app`

---

## What works

| Feature | Status |
|---|---|
| Generate images from text | Working |
| Edit images (inpaint, outpaint, remove objects) | Working |
| Swap backgrounds | Working |
| Create variations | Working |
| Analyze / compare images | Working |
| Upload pasted images (urllib POST flow) | Working |
| Upload via drag-drop at `/upload` | Working |
| Image thumbnails in tool pane (1024px) | Working |
| S3 durable image storage | Working |
| Web app at `/app` (no MCP needed) | Working |
| REST API (`/api/generate`, `/api/edit`, etc.) | Working |

## Known limitations

| Issue | Detail |
|---|---|
| Claude chat inline images | claude.ai shows "Show Image" click-to-reveal boxes instead of true inline rendering. Tool pane previews are reliable; chat reply images require a click. This is a claude.ai client-side consent gate — not fixable from the server. |
| Python snippet run as bash | When Claude runs the urllib upload snippet via the bash tool (instead of the Python code tool), it fails with `/bin/sh: Bad for loop variable`. Server instructions explicitly say "use the Python tool, NOT bash" and explain the symptom. Claude usually recovers on second try. |
| Sandbox 503s | claude.ai's sandbox sometimes cannot reach Cloud Run (transient). The urllib snippet retries 3 times with exponential backoff. If all fail, the user is directed to `/upload` or `/app`. |

---

## How image input works

All tool parameters accept `http/https` URLs only. Paths to get images in:

### Path 1 — You already have a URL
Pass it directly to any tool. Google Drive share links are auto-rewritten.

### Path 2 — Pasted image in claude.ai web OR Claude Cowork (primary path)

Claude runs this Python snippet using the Python code tool (not bash). The snippet auto-discovers the uploads folder:

- claude.ai web sandbox: `/mnt/user-data/uploads/`
- Claude Cowork (Mac): `~/Library/Application Support/Claude/local-agent-mode-sessions//uploads/`

```python
import urllib.request, json, os, time, glob

SERVER = 'https://nanobanana-739905005785.us-central1.run.app'

candidates = ['/mnt/user-data/uploads'] + sorted(
    glob.glob(os.path.expanduser('~/Library/Application Support/Claude/local-agent-mode-sessions/*/uploads')),
    key=os.path.getmtime, reverse=True
)
uploads = next((p for p in candidates if os.path.isdir(p)), None)

if not uploads:
    print(f'No uploads folder found. Upload manually at {SERVER}/upload')
else:
    files = sorted(
        [f for f in os.listdir(uploads) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.webp'))],
        key=lambda f: os.path.getmtime(os.path.join(uploads, f)), reverse=True
    )[:4]
    for i, fname in enumerate(files):
        with open(os.path.join(uploads, fname), 'rb') as fh:
            data = fh.read()
        req = urllib.request.Request(f'{SERVER}/upload', data=data, method='POST')
        for attempt in range(3):
            try:
                result = json.loads(urllib.request.urlopen(req, timeout=30).read())
                print(f'image{i}: {result["url"]}')
                break
            except Exception as e:
                if attempt =1.34.0`, set `S3_BUCKET`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`

**GCS:** `pip install google-cloud-storage>=2.0.0`, set `GCS_BUCKET`

---

## Testing

```bash
python -m pytest test_simulation.py -x -q
```

225 tests. Run before every deploy.

---

## License

MIT

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [amylyra](https://github.com/amylyra)
- **Source:** [amylyra/nanobanana-mcp](https://github.com/amylyra/nanobanana-mcp)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** yes
- **Shell / process execution:** yes
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-amylyra-nanobanana-mcp
- Seller: https://agentstack.voostack.com/s/amylyra
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
