Skip to content

Support ADC#25

Open
ftnext wants to merge 2 commits intogemini-cli-extensions:mainfrom
ftnext:main
Open

Support ADC#25
ftnext wants to merge 2 commits intogemini-cli-extensions:mainfrom
ftnext:main

Conversation

@ftnext
Copy link
Copy Markdown

@ftnext ftnext commented Nov 23, 2025

Implement #10

% gemini extensions install https://github.com/ftnext/gemini-cli-extensions-nanobanana
% NANOBANANA_GOOGLE_CLOUD_PROJECT=your-project-id gemini
/generate "a watercolor painting of a fox in a snowy forest" --preview

(generated by default model, not pro)


if you show the following error after gemini

✕ Error during discovery for server 'nanobanana': Connection failed for 'nanobanana': MCP error -32000: Connection closed

workaround (Locate files under mcp-server/dist/. Same as #13 (comment))

cd ~/.gemini/extensions/nanobanana
npm i

@ftnext
Copy link
Copy Markdown
Author

ftnext commented Nov 23, 2025

@bdmorgan I’ve submitted a pull request. I’d be grateful if you could take a look and review it.
ref: #10 (comment)

@supermarine1377
Copy link
Copy Markdown

@bdmorgan
Hi! I’m just checking in on this PR. Is there anything I can do to help move this forward? I’m happy to make any necessary changes or updates if needed. Thanks for your time!

Copy link
Copy Markdown

@JuanKRuiz JuanKRuiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub PR Review Comment (PR #25)

Hello @ftnext, thank you for putting this PR together. The intention of supporting ADC and moving away from static API keys is exactly what this project needs to scale for enterprise and Pro users.

However, after reviewing the implementation, I see two critical architectural issues that we must address before merging this, otherwise it will break for most GCP users and still won't solve the core issue for standard "Google AI Pro" users.

1. Vertex AI vs. Google AI Pro Identity Confusion
This PR assumes that if NANOBANANA_GOOGLE_CLOUD_PROJECT exists, the user is targeting Vertex AI on GCP. However, this is being positioned as a fix for Issue #45 (Google AI Pro subscribers). Standard Google AI Pro subscriptions cannot be authenticated to GCP endpoints using ADC. Vertex AI is a distinct B2B service billed against a GCP billing account. This implementation solves Issue #19 (Enterprise Auth), but not #45, which we should clarify in the PR description to manage expectations.

2. Hardcoded Global Location (location: 'global')
In imageGenerator.ts, the Vertex AI client is being initialized with location: 'global'. For Imagen models (like gemini-3.1-flash-image-preview), the global endpoint generally does not support image generation model execution arrays. Imagen generation in Vertex AI typically requires targeting specific regional endpoints with GPU backing (e.g., us-central1, europe-west4). Hardcoding this to global will result in fatal Location Not Supported errors for almost all enterprise users attempting to invoke the /generate command.

Proposed Refactor (Strategy/Conditioning)

We should extract this logic to avoid overwriting a valid, local API key by accident and properly configure Vertex:

  1. Make the region configurable and defensive:
const vertexConfig = {
  vertexai: true,
  project: process.env.NANOBANANA_GOOGLE_CLOUD_PROJECT,
  location: process.env.NANOBANANA_VERTEX_LOCATION || 'us-central1', // Never default to global for images
};
  1. Implement a proper Chain of Responsibility fallback during authentication, allowing ADC as an option only if NANOBANANA_VERTEX_LOCATION and NANOBANANA_GOOGLE_CLOUD_PROJECT are both validated.

Let me know your thoughts on adjusting this framework! We're close, but the endpoint routing needs to be solid.

@goflishMC
Copy link
Copy Markdown

I'm kind of lost in the jargon, has this issue been resolved so that I can use my gemini pro plan with the mcp nanobanana in CLI?

this was working fine a few days ago, but I guess something changed in the last updates because I can no longer get the CLI to use the generate image tools through my pro plan, it keeps telling me I need to setup api keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants