Conversation
|
@bdmorgan I’ve submitted a pull request. I’d be grateful if you could take a look and review it. |
|
@bdmorgan |
There was a problem hiding this comment.
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:
- 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
};- Implement a proper Chain of Responsibility fallback during authentication, allowing ADC as an option only if
NANOBANANA_VERTEX_LOCATIONandNANOBANANA_GOOGLE_CLOUD_PROJECTare both validated.
Let me know your thoughts on adjusting this framework! We're close, but the endpoint routing needs to be solid.
|
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 |
Implement #10
(generated by default model, not pro)
if you show the following error after
geminiworkaround (Locate files under
mcp-server/dist/. Same as #13 (comment))