DEV Community

xbill for Google Developer Experts

Posted on

Nano Banana 2 Lite with Kiro

This article covers the MCP setup and configuration for using Google Nano Banana 2 Lite and underlying Gemini LLM with Kiro CLI to enhance and extend image operations over the MCP protocol.

What is Google Nano Banana 2 Lite?

Nano Banana 2 Lite (officially known as the Gemini 3.1 Flash-Lite Image model) is Google’s fastest and most cost-efficient AI image generation and editing model. It is built specifically for enterprises and developers who need to generate high-quality images quickly and affordably at a large scale. [1, 2, 3]

Key Features

  • Lightning-Fast Latency: Capable of generating high-quality images in about 4 seconds. [1, 2]
  • Cost-Efficient Pricing: Priced at approximately $0.034 per 1,000 images in Google AI Studio, undercutting standard models and previous versions. [1]
  • Real-World Grounding: Integrates with Google Web and Image Search to produce highly accurate visuals based on real-world information, such as live weather data and exact global locations. [1, 2]
  • Pro-Level Editing: Allows for nuanced image-editing capabilities, aspect ratio control, and text rendering/translation directly onto images. [1, 2]
  • Character Consistency: Retains the fidelity of subjects across multiple generations and scenarios, making it highly effective for storyboarding and marketing campaigns. [1, 2]

More details are here:

Start building with Nano Banana 2 Lite and Gemini Omni Flash

and here:

Gemini 3.1 Flash-Lite Image (Nano Banana 2 Lite) | Gemini Enterprise Agent Platform | Google Cloud Documentation

Haven’t You Done this One Before?

What is old is new.

This article extends a previous article covering using Antigravity CLI with MCP servers. The original article is here:

Nano Banana 2 Lite with MCP, and Antigravity CLI

The same structured approach is used to enable Python MCP servers on Kiro CLI.

This seems Pretty Basic- why even Bother?!

When configuring a new environment and new tools — the key to a successful deployment is to validate the basic building blocks for the approach. Python MCP servers allow CLI tools like Kiro to be dynamically extended with a clear approach to enable minimal MCP tools. Before attempting more complicated MCP tools — a set of basic MCP commands with the simplest MCP protocol (stdio) is used to verify the functionality.

AWS Setup

The AWS CLI provides the basic tools for working with the AWS services:

AWS CLI

Check the AWS installation:

xbill9@cloudshell:~ (aisprint-491218)$ /usr/local/bin/aws --version
aws-cli/2.34.57 Python/3.14.5 Linux/6.6.137+ exe/x86_64.ubuntu.24
xbill9@cloudshell:~ (aisprint-491218)$
Enter fullscreen mode Exit fullscreen mode

Once the tools are installed — login to the AWS console:

aws login --remote
Enter fullscreen mode Exit fullscreen mode

What is Kiro

Kiro is an agentic, AI-powered Integrated Development Environment (IDE) built by Amazon Web Services (AWS) designed to help developers move from initial concepts to production-ready software. Based on a fork of VS Code (Code OSS), Kiro feels familiar while acting like an autonomous co-developer. [1, 2, 3]

Installing Kiro

The main download site for Kiro is:

https://kiro.dev/
Enter fullscreen mode Exit fullscreen mode

Kiro: Bring engineering rigor to agentic development

for the CLI download — click CLI:

curl -fsSL https://cli.kiro.dev/install | bash
Enter fullscreen mode Exit fullscreen mode

once the stars align — you will see the CLI:

                             ⢀⣴⣶⣶⣦⡀⠀⠀⠀⠀⢀⣴⣶⣦⣄⡀ ⢀⣴⣶⣶⣦⡀ ⢀⣴⣶⣶⣶⣶⣶⣶⣶⣶⣶⣦⣄⡀ ⢀⣠⣴⣶⣶⣶⣶⣶⣦⣄⡀
                            ⢰⣿⠋⠁⠈⠙⣿⡆⠀⢀⣾⡿⠁ ⠈⢻⡆ ⢰⣿⠋⠁⠈⠙⣿⡆ ⢰⣿⠋⠁ ⠈⠙⠻⣦ ⣴⡿⠟⠋⠁ ⠈⠙⠻⢿⣦
                            ⢸⣿⠀⠀⠀⠀⣿⣇⣴⡿⠋⠀⠀ ⢀⣼⠇ ⢸⣿⠀⠀⠀⠀⣿⡇ ⢸⣿⠀⠀⠀⢠⣤⣤⣤⣤⣄ ⣿⡆ ⣼⡟⠀⠀⠀ ⣀⣀⣀ ⢻⣧
                            ⢸⣿⠀⠀⠀⠀⣿⡿⠋⠀⠀ ⢀⣾⡿⠁ ⢸⣿⠀⠀⠀⠀⣿⡇ ⢸⣿⠀⠀⠀⢸⣿⠉⠉⠉⣿⡇ ⣿⡇ ⣼⡟⠀⠀ ⣰⡿⠟⠛⠻⢿⣆⠀⠀ ⢻⣧
                            ⢸⣿⠀⠀⠀⠀⠙⠁⠀⠀ ⢀⣼⡟⠁ ⢸⣿⠀⠀⠀⠀⣿⡇ ⢸⣿⠀⠀⠀⢸⣿⣶⣶⡶⠋⠀ ⣿⠇ ⢰⣿⠀⠀⠀⢰⣿⠀⠀⠀ ⣿⡆⠀⠀ ⣿⡆
                            ⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀ ⠹⣷⡀ ⢸⣿⠀⠀⠀⠀⣿⡇⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀ ⣠⣼⠟ ⢸⣿⠀⠀ ⢸⣿⠀⠀⠀⠀ ⣿⡇⠀⠀ ⣿⡇
                            ⢸⣿⠀⠀⠀⠀⠀⣠⡀⠀⠀ ⠹⣷⡄ ⢸⣿⠀⠀⠀⠀⣿⡇⠀⢸⣿⠀⠀⠀⠀⣤⣄ ⠀⠀⠹⣿⡅ ⠸⣿⠀⠀ ⠸⣿⠀⠀⠀⠀ ⣿⠇⠀ ⣿⠇
                            ⢸⣿⠀⠀⠀⠀⣾⡟⣷⡀⠀⠀ ⠘⣿⣆ ⢸⣿⠀⠀⠀⠀⣿⡇ ⢸⣿⠀⠀⠀⠀⣿⡟⣷⡀⠀⠀ ⠘⣿⣆ ⢻⣧⠀⠀ ⠹⣷⣦⣤⣤⣾⠏⠀⠀⠀⣼⡟
                            ⢸⣿⠀⠀⠀⠀⣿⡇⠹⣷⡀ ⠀⠈⢻⡇ ⢸⣿⠀⠀⠀⠀⣿⡇ ⢸⣿⠀⠀⠀⠀⣿⡇⠹⣷⡀ ⠀⠈⢻⡇ ⢻⣧⠀⠀⠀ ⠉⠉⠉ ⣼⡟
                            ⠸⣿⣄⡀⢀⣠⣿⠇⠀⠙⣷⡀ ⢀⣼⠇ ⠸⣿⣄⡀⢀⣠⣿⠇ ⠸⣿⣄⡀⢀⣠⣿⠇⠀⠙⣷⡀ ⢀⣼⠇ ⠻⣷⣦⣄⡀ ⢀⣠⣴⣾⠟
                             ⠈⠻⠿⠿⠟⠁⠀⠀⠀⠈⠻⠿⠿⠟⠁ ⠈⠻⠿⠿⠟⠁ ⠈⠻⠿⠿⠟⠁⠀⠀⠀⠈⠻⠿⠿⠟⠁ ⠀⠀⠈⠙⠻⠿⠿⠿⠿⠟⠋⠁

                                                 Welcome to Kiro CLI V3!

                             What's new: Specs, expanded hooks, and an improved trust model.
                         Migration tooling to bring your V2 configurations to V3 is coming soon.
                                              https://kiro.dev/docs/cli/v3/

                                         Share feedback anytime with /feedback.
Enter fullscreen mode Exit fullscreen mode

What is MCP?

Unless you have been living off grid without Internet- MCP is the new universal connector and next “Big Thing”.

More information is here:

What is Model Context Protocol (MCP)? A guide

Python MCP Documentation

The official GitHub Repo provides samples and documentation for getting started:

GitHub - modelcontextprotocol/python-sdk: The official Python SDK for Model Context Protocol servers and clients

Isn’t MCP overkill?

There are many ways to call models. Native MCP support in Kiro opens up a new pathway to call the underlying Nano Bananna model.

Integrating Kiro with Nano Banana 2 Flash Lite

Pairing Kiro with Nano Banana 2 Lite expands the agent’s core capabilities, allowing it to act on multimodal inputs and execute complex tasks on your behalf. [1, 2, 3]

So what is the Secret Sauce?

The Interactions API allows for a clean consistent call to the model.

The Interactions API is Google’s unified interface for building with Gemini AI models and autonomous agents. Rather than using multiple separate endpoints for text chat, tool use, image generation, or background agents, it provides a single, streamlined API to handle complex, stateful workflows. [1, 2, 3]

More information is here:

Interactions API | Gemini API | Google AI for Developers

and here:

Gemini Interactions API | Gemini API | Google AI for Developers

but wait — there’s more!

There is A Skill for That!

You can make the magic happen!

Interactions API: our primary interface for Gemini models and agents

npx skills add google-gemini/gemini-skills --skill gemini-interactions-api
Enter fullscreen mode Exit fullscreen mode

Setup the Basic Environment

At this point you should have a working Python environment and a working Kiro CLI installation. The next step is to clone the GitHub samples repository with support scripts:

cd ~
git clone https://github.com/xbill9/nb2lite-kiro
Enter fullscreen mode Exit fullscreen mode

Then run init.sh from the cloned directory.

The script will attempt to determine your shell environment and set the correct variables:

cd nb2lite-kiro
source init.sh
Enter fullscreen mode Exit fullscreen mode

If your session times out or you need to re-authenticate- you can run the set_env.sh script to reset your environment variables:

cd nb2lite
source set_env.sh
Enter fullscreen mode Exit fullscreen mode

Variables like PROJECT_ID need to be setup for use in the various build scripts- so the set_env script can be used to reset the environment if you time-out.

Running the Python Code

First- switch the directory with the Python version of the MCP sample code:

make install
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

The project can also be linted:

xbill@penguin:~/nb2lite-kiro$ make lint
ruff check .
All checks passed!
ruff format --check .
2 files already formatted
mypy .
Success: no issues found in 2 source files
Enter fullscreen mode Exit fullscreen mode

Kiro CLI mcp.json

A sample MCP server file is provided in the .kiro/settings directory:

{
  "mcpServers": {
    "nb2lite-agent": {
      "command": "python3",
      "args": [
        "/home/xbill/nb2lite-kiro/server.py"
      ],
      "disabled": false
    },
    "aws-mcp": {
      "command": "uvx",
      "args": [
        "mcp-proxy-for-aws==1.6.0",
        "https://aws-mcp.us-east-1.api.aws/mcp",
        "--metadata",
        "AWS_REGION=us-east-1"
      ],
      "disabled": false
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Validation with Kiro CLI

The final connection test uses Kiro CLI as a MCP client with the Python code providing the MCP server:

/mcp list · 2 configured
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 search: nb2lite-agent 

 Configured Servers
 Name Status Details
 nb2lite-agent ● running 4 tools
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter fullscreen mode Exit fullscreen mode

the tools are reviewed:

  list the mcp tools for nb2lite

● Read /home/xbill/nb2lite-kiro/.agents/mcp_config.json
● Read /home/xbill/nb2lite-kiro/server.py

  The nb2lite MCP server (nb2lite-agent) exposes 4 tools:

  generate_image

  Generates a new image from a text prompt and saves it locally.

  - prompt (str, required) — natural language description of the image
  - aspect_ratio (str, optional, default "1:1") — 1:1, 16:9, 9:16, 4:3, 3:4
  - thinking_level (str, optional, default "medium") — minimal, low, medium, high

  edit_image

  Edits a previously generated image using its interaction ID (multi-turn continuity).

  - previous_interaction_id (str, required) — ID returned from a prior generation or edit
  - edit_prompt (str, required) — description of changes to apply
  - thinking_level (str, optional, default "medium")

  edit_local_image

  Uploads a local image file (base64 encoded) and applies text-described edits.

  - image_path (str, required) — path to the local image file
  - edit_prompt (str, required) — description of modifications
  - aspect_ratio (str, optional, default "1:1")
  - thinking_level (str, optional, default "medium")

  get_help

  Returns a help summary of the server's configuration and all available tools. No arguments.

  The server uses gemini-3.1-flash-lite-image (overridable via GEMINI_MODEL_NAME) and saves output images to the current
  directory (overridable via IMAGE_OUTPUT_DIR) using the naming pattern <prefix>_<timestamp>_<uuid>.jpg.
Enter fullscreen mode Exit fullscreen mode

We have Lift Off!

Finally- the tools are now available for working with the Nano Banana2 Lite models:

summarize the mcp tools

  The nb2lite MCP server provides 4 tools for AI-powered image generation and editing using Google's Gemini model:

  1. generate_image — Create a new image from a text prompt. Control output shape with aspect_ratio and quality/speed
  tradeoff with thinking_level.
  2. edit_image — Iteratively edit a previously generated image by passing its previous_interaction_id. Maintains style
  and pixel continuity across turns.
  3. edit_local_image — Edit an image file already on disk by providing its path and a description of the changes you
  want.
  4. get_help — Returns server configuration status (API key, model name, output directory) and a full tool reference.

  All tools save output images locally. The thinking_level parameter (minimal → high) trades response speed for
  generation quality across all image tools.
Enter fullscreen mode Exit fullscreen mode

Enough, Already! Show me the Money!

Kiro CLI was started up for a hands-on image editing session:

Not a fan of Bananas?

  use the mcp tools to edit gen_1782921715_ec8088ac.jpg and make the ghost banana a ghost apple

● Read /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  TASK 1: Edit image using MCP tools to make ghost banana a ghost apple

  STATUS: in-progress

  USER QUERIES: 1 ("use the mcp tools to edit gen_1782921715_ec8088ac.jpg and make the ghost banana a ghost apple")

  DETAILS:

  - The user requested editing the file /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg using the MCP image editing
  tools
  - The image was read and confirmed to exist (JPEG, 492614 bytes) — it's a ghost banana image
  - The MCP tool mcp_nb2lite_agent_edit_local_image was identified as the appropriate tool to use
  - The tool call was initiated with:
    - image_path: /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg
    - edit_prompt: "make the ghost banana a ghost apple"
    - aspect_ratio: "1:1"

  - The context window was exhausted before the tool call could complete and return results — the edit has NOT been
  confirmed as completed

  NEXT STEPS:

  - Call mcp_nb2lite_agent_edit_local_image with:
    - image_path: /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg
    - edit_prompt: "make the ghost banana a ghost apple"
    - aspect_ratio: "1:1" (or omit for default)

  - Save/confirm the output image path returned by the tool
  - Report the result to the user

  FILEPATHS:

  - /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg (source image to edit)

  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  USER CORRECTIONS AND INSTRUCTIONS:

  - Use the MCP tools (specifically mcp_nb2lite_agent_edit_local_image) for image editing — not other approaches
  - The workspace is /home/xbill/nb2lite-kiro/

  Files to read:

  - /home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg (the image to edit — already read, skip re-reading unless
  needed)
● edit_local_image
    ╰ image_path=/home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg, edit_prompt=make the ghost banana a ghost apple,
    aspect_ratio=1:1
● edit_local_image
    ╰ image_path=/home/xbill/nb2lite-kiro/gen_1782921715_ec8088ac.jpg, edit_prompt=make the ghost banana a ghost apple,
    aspect_ratio=1:1, thinking_level=low
    {
      "content": [
        {
    ...+5 lines (ctrl+o to toggle)

  The edit succeeded. The ghost banana has been transformed into a ghost apple and saved to:

  /home/xbill/nb2lite-kiro/edit_local_1782922067_7371b516.jpg
Enter fullscreen mode Exit fullscreen mode

Not a fan of Apples?

  what is the interactions API ID

  The interaction ID returned from the edit is:

  v1_ChdVanRGYXRqZEctX3VfdU1QLTdlaWdRbxIXVWp0RmF0amRHLV91X3VNUC03ZWlnUW8

▸ Credits: 0.06 • Time: 2s
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  with v1_ChdVanRGYXRqZEctX3VfdU1QLTdlaWdRbxIXVWp0RmF0amRHLV91X3VNUC03ZWlnUW8 and the MCP tools make the ghost apple a
  ghost pinapple

● edit_image
    ╰ previous_interaction_id=v1_ChdVanRGYXRqZEctX3VfdU1QLTdlaWdRbxIXVWp0RmF0amRHLV91X3VNUC03ZWlnUW8, edit_prompt=make
    the ghost apple a ghost pineapple, thinking_level=low
    {
      "content": [ { ...+5 lines (ctrl+o to toggle) Done! The ghost apple has been turned into a ghost pineapple, saved to: /home/xbill/nb2lite-kiro/edit_1782922194_394f5f79.jpg New interaction ID: v1_ChdVanRGYXRqZEctX3VfdU1QLTdlaWdRbxIXMFR0RmFxbS1Pdi1YX3VNUDVjN3RnQWc
Enter fullscreen mode Exit fullscreen mode

One last example — the banner for this article was re-themed in steam-punk style:

> use the MCP tool to edit_local_image and retheme ghost-banana.jpeg as steam-punk

● edit_local_image
    ╰ image_path=/home/xbill/nb2lite-kiro/ghost_banana.jpeg, edit_prompt=retheme this image as steampunk, with steampunk
    aesthetics including brass gears, cogs, pipes, copper tones, Victorian industrial style, goggles, and mechanical
    elements, aspect_ratio=1:1, thinking_level=low
    {
      "content": [
        {
    ...+5 lines (ctrl+o to toggle)

  Done! The steampunk-themed ghost banana has been saved to:

  /home/xbill/nb2lite-kiro/edit_local_1782922350_db5b8fcc.jpg

  Interaction ID: v1_ChdiRHhGYXN5Zk85YkotOFlQZ19TbXFRYxIXYkR4RmFzeWZPOWJKLThZUGdfU21xUWM

▸ Credits: 0.15 • Time: 16s
Enter fullscreen mode Exit fullscreen mode

One last thought- Where are Agents?

Where are the Agents?

The Kiro CLI harness itself uses agents to manage the workflow.

The additional touch point for leveraging the MCP interface is that they all are exposed as MCP tools. The MCP tools can be called directly from Agent code or used as a template for Interactions API calls embedded in an Agent.

Summary

The strategy for using MCP with Nano Banana 2 Lite and Kiro CLI was validated with a incremental step by step approach.

A minimal stdio transport MCP Server was started from Python source code and validated with Kiro CLI running as a MCP client in the same local environment.

This MCP Python server provided all of the management tools to interact with the model and generate high quality cyberpunk banana images.

Top comments (0)