Nano Banana 2 Lite with Codex — Stable Diffusion Tips &…
    Neura MarketNeura Market/Stable Diffusion
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityStable DiffusionStable Diffusion
    DeepSeekDeepSeekCoPilotCoPilotMidjourneyMidjourney
    View All Directories
    OverviewPromptsBlogVideosGuidesCoursesCommunityModelsLoRAsComfyUI WorkflowsTrending
    Stable DiffusionBlogNano Banana 2 Lite with Codex
    Back to Blog
    Nano Banana 2 Lite with Codex
    python

    Nano Banana 2 Lite with Codex

    xbill July 4, 2026
    0 views

    This article covers the MCP setup and configuration for using Google Nano Banana 2 Lite and...


    title: Nano Banana 2 Lite with Codex published: true series: MCP date: 2026-07-04 02:14:56 UTC tags: python,openaicodex,nanobanana,mcps canonical_url: https://xbill999.medium.com/nano-banana-2-lite-with-codex-8a58f159dd51

    This article covers the MCP setup and configuration for using Google Nano Banana 2 Lite and underlying Gemini LLM with Codex 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 Claude Code 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 Codex 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.

    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 Codex opens up a new pathway to call the underlying Nano Bananna model.

    Integrating Codex with Nano Banana 2 Flash Lite

    Pairing Codex 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.

    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
    

    Setup the Basic Environment

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

    cd ~
    git clone https://github.com/xbill9/nb2lite-codex
    

    Then run init.sh from the cloned directory.

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

    cd nb2lite-codex
    source init.sh
    

    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
    

    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
    

    The project can also be linted:

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

    Codex MCP Config

    A sample MCP server file is provided:

    m3:.codex xbill$ more config.toml 
      [mcp_servers.nb2lite-agent]
      command = "/opt/homebrew/bin/python3"
      args = ["/Users/xbill/nb2lite-codex/server.py"]
      enabled = true
      env_vars = ["GEMINI_API_KEY", "GOOGLE_API_KEY"]
    
      [mcp_servers.nb2lite-agent.tools.generate_image]
      approval_mode = "approve"
    
    [mcp_servers.nb2lite-agent.tools.get_help]
    approval_mode = "approve"
    
    [mcp_servers.nb2lite-agent.tools.edit_image]
    approval_mode = "approve"
    
    [mcp_servers.nb2lite-agent.tools.edit_local_image]
    approval_mode = "approve"
    

    Validation with Codex CLI

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

    /mcp
    
    🔌 MCP Tools
    
      • codex_apps
        • Auth: Bearer token
        • Tools: (none)
    
      • nb2lite-agent
        • Auth: Unsupported
        • Tools: edit_image, edit_local_image, generate_image, get_help
    

    the tools are reviewed:

    
    • nb2lite-agent exposes these MCP tools:
    
      - generate_image - generate a new image from a prompt.
      - edit_image - edit a previously generated image using its interaction ID.
      - edit_local_image - edit a local image file by path.
      - get_help - show server help, config, and tool details.
    
      Current model: gemini-3.1-flash-lite-image
      Output directory: /Users/xbill/nb2lite-codex
    

    We have Lift Off!

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

    › summarize the nblite mcp tools
    
    • nb2lite-agent provides image generation and editing tools backed by Gemini.
    
      - generate_image: Creates a new image from a text prompt. Supports aspect ratios like 1:1,
        16:9, 9:16, 4:3, 3:4.
    
      - edit_image: Edits a previously generated image using its interaction_id, preserving session
        continuity.
    
      - edit_local_image: Edits an existing local image file from a filesystem path.
      - get_help: Returns server help, current config, and available tool details.
    
      Current setup:
    
      - Model: gemini-3.1-flash-lite-image
      - Output folder: /Users/xbill/nb2lite-codex
      - API key status: set
       
    
    

    Enough, Already! Show me the Money!

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

    › call mcp tool generate_image codex banana
    
    

    Not a fan of Bananas?

    › use the mcp tool edit_image make the banana an apple with Saved image:
        gen_1783125858_21c75be6.jpg
    
        Interaction ID:
    
        v1_ChdZVmRJYW9pRUhlX2FqckVQcnFPTC1BOBIXWVZkSWFvaUVIZV9hanJFUHJxT0wtQTg
    
    • I’ll use edit_image with the interaction ID so the server edits the existing banana session
      into an apple while preserving the mascot style.
    
    • Called
      └ nb2lite-
            agent.edit_image({"previous_interaction_id":"v1_ChdZVmRJYW9pRUhlX2FqckVQcnFPTC1BOBIXWVZ
            kSWFvaUVIZV9hanJFUHJxT0wtQTg","edit_prompt":"Transform the banana mascot into a playful
            futuristic Codex apple mascot. Preserve the same centered composition, polished
            stylized 3D illustration style, clean studio lighting, expressive friendly eyes, subtle
            software-engineering circuit-like markings, and tiny terminal charm. The subject should
            clearly be a bright apple instead of a banana. No text, no
            watermark.","thinking_level":"low"})
        🟢 Image successfully saved!
        • Saved to: /Users/xbill/nb2lite-codex/edit_1783126427_6b6cef2d.jpg
        • Interaction ID: v1_ChdZVmRJYW9pRUhlX2FqckVQcnFPTC1BOBIXbWxsSWFyNjhMWnpxanJFUHVkMnJxQVU
    
    ───────────────────────────────────────────────────────────────────────────────────────────────
    
    • Edited successfully.
    
      Saved image:
      edit_1783126427_6b6cef2d.jpg
    
      New interaction ID:
    
      v1_ChdZVmRJYW9pRUhlX2FqckVQcnFPTC1BOBIXbWxsSWFyNjhMWnpxanJFUHVkMnJxQVU
    

    Not a fan of Apples?

    › use the mcp tool edit local image to make [Image #1] a pineapple
    
    • I’ll use edit_local_image on the local file and ask it to convert the apple mascot into a
      pineapple while keeping the same pose, lab setting, and 3D Codex style.
    
    • Called
      └ nb2lite-agent.edit_local_image({"image_path":"/Users/xbill/nb2lite-codex/
            edit_1783126427_6b6cef2d.jpg","edit_prompt":"Transform the apple mascot into a playful
            futuristic Codex pineapple mascot. Preserve the same centered composition, pose,
            friendly expression, polished stylized 3D illustration quality, clean sci-fi lab
            background, studio lighting, subtle software-engineering circuit-like markings, limbs,
            tiny terminal charm, and overall mascot feel. The subject should clearly be a pineapple
            with a golden textured pineapple body and green leafy crown instead of an apple. No
            text, no watermark.","aspect_ratio":"1:1","thinking_level":"low"})
        🟢 Image successfully saved!
        • Saved to: /Users/xbill/nb2lite-codex/edit_local_1783126589_39305f53.jpg
        • Interaction ID: v1_ChdQRnBJYXNUMUFZQ2JqckVQaXZDRXlBTRIXUEZwSWFzVDFBWUNianJFUGl2Q0V5QU0
    
    ───────────────────────────────────────────────────────────────────────────────────────────────
    
    • Edited local image successfully.
    
      Saved image:
      edit_local_1783126589_39305f53.jpg
    
      Interaction ID:
    
      v1_ChdQRnBJYXNUMUFZQ2JqckVQaXZDRXlBTRIXUEZwSWFzVDFBWUNianJFUGl2Q0V5QU0
    

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

    › use the nblite mcp tools to retheme this as steam-punk: Saved image:
        gen_1783111489_1ac76ec9.jpg
    
        Interaction ID:
    
        v1_ChdRUjlJYW91b0NxT2dqckVQZzVhTS1RTRIXUVI5SWFvdW9DcU9nanJFUGc1YU0tUU0
    
    • I’ll use the existing interaction ID with edit_image so the original Codex pet is rethemed
      into steampunk while keeping the same mascot identity and composition.
    
    • Called
      └ nb2lite-
            agent.edit_image({"previous_interaction_id":"v1_ChdRUjlJYW91b0NxT2dqckVQZzVhTS1RTRIXUVI
            5SWFvdW9DcU9nanJFUGc1YU0tUU0","edit_prompt":"Retheme the existing Codex pet mascot as
            steampunk. Preserve the same main character identity, friendly expression, centered
            composition, compact companion-creature proportions, and polished stylized 3D
            illustration quality. Replace the futuristic software aesthetic with brass and copper
            mechanical details, tiny gears, rivets, leather straps, clockwork accents, warm amber
            glow, and subtle Victorian workshop atmosphere. Keep it approachable and memorable. No
            text, no watermark.","thinking_level":"low"})
        🟢 Image successfully saved!
        • Saved to: /Users/xbill/nb2lite-codex/edit_1783126855_06812b3a.jpg
        • Interaction ID: v1_ChdRUjlJYW91b0NxT2dqckVQZzVhTS1RTRIXUmx0SWFvdmFGYWl4MU1rUHNwMm53QW8
    
    ───────────────────────────────────────────────────────────────────────────────────────────────
    
    • Rethemed successfully.
    
      Saved image:
      edit_1783126855_06812b3a.jpg
    
      Interaction ID:
    
      v1_ChdRUjlJYW91b0NxT2dqckVQZzVhTS1RTRIXUmx0SWFvdmFGYWl4MU1rUHNwMm53QW8
    

    One last thought- Where are Agents?

    Where are the Agents?

    The Codex 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 Codex 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 Codex 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.

    Tags

    pythonopenaicodexnanobananamcps

    Comments

    More Blog

    View all
    Context bankruptcy: The case for strategic forgetting for AI Agentsai

    Context bankruptcy: The case for strategic forgetting for AI Agents

    Most of us have seen a coding agent fail to complete a task we know it can do. We just don't...

    J
    James O'Reilly
    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestrationgooglecloud

    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestration

    When building Generative AI applications, developers often encounter a massive bottleneck: sequential...

    A
    Aryan Irani
    Is It Ethical to Post and Ask About Circuits on Dev.to?discuss

    Is It Ethical to Post and Ask About Circuits on Dev.to?

    I’ve been thinking about sharing some electronic circuit posts on Dev.to — small circuits, DIY...

    C
    codebunny20
    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limitsagents

    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limits

    What nobody tells you about exporting your multi-agent prototype to a local workspace. Every...

    L
    leslysandra
    Guarding the till while autonomous data agents do the diggingagenticarchitect

    Guarding the till while autonomous data agents do the digging

    Autonomous agents are genuinely good at answering messy business questions. Give one an LLM and a set...

    S
    Sireesha Pulipati
    Return on Attention: Why AI Code Reviews Are Wearing Us Outai

    Return on Attention: Why AI Code Reviews Are Wearing Us Out

    PR volume went up, ticket quality didn't, and the gap got filled with LLMs on both sides of the review: bots reviewing, bots replying, bots occasionally arguing with bots about priorities that only existed in a teammate's head. Our CEO named the actual problem, and it's bigger than code review.

    C
    christine

    Stay up to date

    Get the latest Stable Diffusion prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Stable Diffusion and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Stable Diffusion resource

    • Auto-translate Blog Articles with Google Translate and Airtable Storagen8n · Free · Related topic
    • TechCrunch AI Article Scraper & Classifier with GPT-4.1-nano to Sheets & Telegramn8n · Free · Related topic
    • Classify and Summarize WeChat Articles with GPT-4, Nano to Google Sheets, and Notionn8n · Free · Related topic
    • Automate WordPress Article Summarization and Email Distribution with OpenAI and Google Sheetsn8n · Free · Related topic
    Browse all workflows