Bridging Code and Canvas: New Open-Source Tool Integrates Google’s Stateful Gemini Image Model with Kiro Agent Framework

An innovative open-source project is changing how developers interact with artificial intelligence during multi-modal workflows. By wrapping Google’s highly efficient gemini-3.1-flash-lite-image model (affectionately dubbed "NB2Lite") into a lightweight Model Context Protocol (MCP) server, developer and community contributor xbill9 has introduced nb2lite-skill-kiro.
This integration packages stateful image generation directly as a "Kiro skill." For the first time, coding agents operating within the Kiro ecosystem can not only generate images in real time but also iteratively edit them using conversational, context-aware commands.
Instead of traditional, stateless image generation workflows that require users to re-specify an entire prompt for every minor tweak, the new tool leverages Google’s stateful Interactions API. This allows developers to issue iterative commands—such as "add a neon RAMEN sign" or "make it night"—while the model retains the exact visual composition, lighting, and character details of the original image.
Main Facts: The Tech Stack and the Stateful Breakthrough
At the core of this release is a fundamental shift in how generative AI handles visual context. Most commercial image generators, including DALL-E 3 and Midjourney, are stateless. When a user requests a modification, the system processes the request as a brand-new generation, leading to dramatic shifts in style, composition, and consistency.
The nb2lite-skill-kiro repository solves this by combining three core technologies:
- Google NB2Lite (
gemini-3.1-flash-lite-image): A high-efficiency, low-latency image generation model capable of sub-two-second execution times and native multi-lingual text rendering across more than 25 languages. - Google Interactions API: A stateful endpoint that caches visual context server-side. It returns an "interaction ID" with each image, which serves as a pointer for subsequent edits.
- Model Context Protocol (MCP): An open standard created by Anthropic that standardizes how AI agents connect to external tools and data sources.
The tool exposes four specialized functions to Kiro or any other MCP-compatible client:
| Tool Name | Input Parameters | Output / Action |
|---|---|---|
generate_image |
Prompt, aspect ratio, thinking level | Generates a new 1k image, saves it locally, and returns the path along with a unique interaction_id. |
edit_image |
Previous interaction_id, edit prompt |
Applies a localized edit to the cached image, preserving composition. Returns a new interaction_id for chaining. |
edit_local_image |
Local image path, edit prompt, aspect ratio | Uploads an existing local image via base64, initializes a session, and performs a stateful edit. |
get_help |
None | Diagnostics: checks Gemini API key status, active model, output directory, and tool references. |
Chronology: The Road to Stateful Visual Agents
The development of nb2lite-skill-kiro represents the convergence of several distinct milestones in the AI landscape over the past year:
[Late 2024]
Anthropic releases the Model Context Protocol (MCP) open standard,
decoupling AI clients from proprietary tool integrations.
│
▼
[Early 2025]
Google launches Gemini 3.1 Flash Lite Image (NB2Lite)
featuring the stateful Interactions API.
│
▼
[Mid 2025]
Release of Kiro, an advanced agentic framework
designed for automated software engineering.
│
▼
[Present]
xbill9 publishes nb2lite-skill-kiro,
marrying NB2Lite, MCP, and Kiro into a cohesive visual skill.
1. The Rise of the Model Context Protocol (MCP)
Before MCP’s release, integrating a new tool into an AI assistant required custom integration code for every single platform. If a developer wanted to use an image generator in three different coding assistants, they had to write three different integrations. MCP collapsed this $N times M$ complexity into a unified JSON-RPC-based protocol operating over standard input/output (stdio).
2. Google’s Stateful Paradigm Shift
Recognizing the limitations of stateless diffusion models, Google introduced the Interactions API for its lightweight Gemini models. By shifting the burden of maintaining visual consistency from the user’s prompt engineering to the server’s state cache, Google unlocked a more conversational design loop.
3. The Emergence of Kiro and Agentic Skills
As agentic coding assistants transitioned from simple code-completion tools to full-fledged virtual teammates, frameworks like Kiro introduced the concept of "skills." A skill combines executable code (like an MCP server) with markdown-based behavioral guidelines (SKILL.md), instructing the agent exactly when and how to deploy its tools.
Supporting Data: Architectural Deep Dive and Performance
To understand the efficiency of nb2lite-skill-kiro, one must look at how it manages the state loop. In a standard stateless workflow, modifying an image requires sending increasingly complex prompts back to the server:
- Turn 1: "A watercolor fox in a forest at dawn."
- Turn 2: "A watercolor fox in a forest at dawn, wearing a red scarf, with three birch trees on the left."
- Turn 3: "A watercolor fox in a forest at dawn, wearing a red scarf, holding a lantern in its paw, with three birch trees on the left."
Each turn introduces compounding prompt drift, as the model attempts to reconstruct the entire latent space from scratch.
Under the hood of the nb2lite-agent MCP server, the stateful loop is handled elegantly via the following programmatic execution flow:
[User Command] ──> [Kiro Agent] ──> [nb2lite-agent MCP Server] ──> [Google Interactions API]
│
[New Image File] <── [Saved to Disk] <── [Returns Image & ID] <──────────┘
When an edit is requested, the client sends only the delta:
"previous_interaction_id": "v1_ChdpRU5...",
"edit_prompt": "Add a lantern in its paw."
Because the Gemini server retains the latent representation of the previous generation, it only recalculates the pixels necessary to insert the lantern, maintaining the style, lighting, and composition of the original fox and forest.
Installation and Integration Path Analysis
The project provides four deployment paths, catering to different development environments and security requirements:
Path A: The Bootstrap Script
For rapid local testing, developers can clone the repository and run a unified shell script:
git clone https://github.com/xbill9/nb2lite-skill-kiro.git
cd nb2lite-skill-kiro
./init.sh
The init.sh script automates dependency installation, registers the server in the local .mcp.json configuration, and securely writes the user’s Gemini API key to ~/gemini.key.
Path B: Direct Project Injection
Developers working within an existing Kiro workspace can inject the skill dynamically using a Makefile target:
make init TARGET=/path/to/your/project ARGS='--output-dir ./images'
Path C: Manual MCP Configuration
For non-Kiro clients (such as Claude Desktop or Claude Code), the server can be registered manually in the client’s configuration file:
"mcpServers":
"nb2lite-agent":
"command": "python",
"args": [".kiro/skills/nb2lite-image/mcp/server.py"],
"env":
"GEMINI_API_KEY": "your-key-here",
"IMAGE_OUTPUT_DIR": "./images"
Path D: Containerized Execution
For sandbox environments, the project is published as a pre-built Docker image (xbill9/nb2lite-agent). The container requires directory mounting to ensure that files created inside the container align with the host workspace:
"mcpServers":
"nb2lite-agent":
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "GEMINI_API_KEY",
"-v", "/abs/path/to/project:/abs/path/to/project",
"-w", "/abs/path/to/project",
"xbill9/nb2lite-agent"
],
"env": "GEMINI_API_KEY": "your-key-here"
Official Context & Community Reception
The release of nb2lite-skill-kiro has sparked notable interest within the open-source AI community. While Google and Anthropic have historically positioned themselves as competitors in the frontier model space, this project highlights how open standards like MCP allow technologies from both ecosystems to work together seamlessly.
Industry analysts point out that Google’s Gemini API strategy—offering generous free tiers and low-latency "Flash" models—makes it highly attractive for developers building utility tools. Meanwhile, Anthropic’s open-sourcing of MCP has established it as the industry-standard interface for agentic tool use, supported by a growing list of clients including Claude Desktop, Claude Code, and Kiro.
The repository’s documentation explicitly notes that this is a third-party, community-driven effort:
"This is a third-party community project, not affiliated with or endorsed by Anthropic or Google. Bring your own Gemini API key — and remember generations are billable, so draft on
lowand savehighfor the money shot."
This community-first model has allowed the project to remain highly agile, implementing support for both local file editing and cloud-based generation within a single, cohesive codebase.
Implications: The Future of Multi-Modal Coding Agents
The integration of stateful image tools into developer environments has profound implications for software engineering, design, and rapid prototyping.
1. Unified Prototyping Workflows
Historically, a developer building a web application had to jump between an IDE to write code and a web browser to generate design assets. With nb2lite-skill-kiro, a developer can command their coding agent to build a landing page, generate the background illustrations, refine those illustrations in place, and automatically reference the resulting local asset paths in the generated HTML and CSS.
2. The Power of "Dogfooding"
Demonstrating the practical utility of the tool, the author utilized the system itself to generate the project’s cover art. The prompt requested a dark-themed developer workspace featuring a stylized Kiro logo bridging the gap between code and design, complete with precise textual rendering of "nb2lite-image" and "Powered by Gemini • Built for Kiro."
generate_image(
prompt="A sleek dark-themed tech cover image for a developer tool called "
"'nb2lite-image'. The scene shows a futuristic AI workspace: a glowing "
"terminal/IDE interface with code on the left side, and on the right, a "
"vibrant image generation panel showing colorful AI-generated artwork "
"materializing from pixels. In the center foreground, the Kiro logo — a "
"stylized letter K with a neon blue glow — acts as the bridge between "
"code and image, with light rays connecting it to both sides. Bold text "
"reads 'nb2lite-image' at the top and 'Powered by Gemini • Built for Kiro' "
"at the bottom. Color palette: deep navy background, electric blue and "
"purple accents, white text, with sparkling particle effects. High-tech, "
"modern, developer-aesthetic, cinematic lighting.",
aspect_ratio="16:9",
thinking_level="high",
)
The resulting high-fidelity asset, committed directly to the repository as cover-image.jpg, serves as real-world proof of the tool’s capabilities. It highlights the model’s strong performance in text rendering and complex compositional layouts—two areas where older generative image models frequently struggle.
3. Paving the Way for Local-First AI
By storing images locally as uniquely identified files (gen_<timestamp>_<uuid8>.jpg), the tool ensures that concurrent generations do not overwrite each other. This local-first architecture makes it highly suitable for enterprise environments where local caching, version control, and workspace isolation are critical.
As agentic frameworks continue to mature, the boundary between text-based coding assistants and creative visual tools will continue to blur. Projects like nb2lite-skill-kiro demonstrate that with the right integration standards, AI agents can handle complex, multi-turn visual design tasks just as naturally as they write code.
