Skip to main content
Glama

NanoBridge

Gemini 的 Nano Banana 图像生成功能,以 MCP 服务器CLI 的形式接入智能体——使用的是账户已有的 Gemini 套餐,而不是按图像计费。

nanobridge sprite "a small knight with a blue shield and a silver sword" --size 160

这两张图都来自本 README 中的命令——精灵图已经裁剪并去除了背景,动画已经从图集中切片并组装成循环 GIF。

为什么不直接调用 API

AI Studio API 密钥是显而易见的途径,但在免费套餐上不可用:每个图像模型都返回 429 RESOURCE_EXHAUSTED,因为免费层级授予的图像配额为零。启用计费可以解决这个问题,但会开始按图像收费,而同一账户上已有的 Gemini 订阅却被闲置。

NanoBridge 走另一扇门:它像浏览器一样进行身份验证,使用 Chrome 中已有的 __Secure-1PSID cookie,并消耗订阅的配额。无需粘贴任何内容,无需购买任何东西。

后端

认证方式

费用

web(默认)

从浏览器读取 Gemini cookie

已支付的套餐

api(备用)

GEMINI_API_KEY

按图像计费,且需要启用计费

nanobridge doctor 会报告当前使用的是哪个后端以及剩余配额。

Related MCP server: Nano Banana Pro MCP

安装

git clone https://github.com/NspxMiguel/NanoBridge.git
cd NanoBridge && ./install.sh

安装程序会构建一个 virtualenv,将 nanobridge 放到 PATH 上,向 Claude Code 注册 MCP 服务器,并安装智能体技能。Homebrew:

brew install --cask nspxmiguel/tap/nanobridge

要求:Python 3.11+,以及一个已登录 https://gemini.google.com 的浏览器。

从 shell 中使用

nanobridge doctor                        # backends, quota, config path
nanobridge sprite "a green slime" --style pixel --size 128
nanobridge icon "a compass rose" --style flat
nanobridge gen "a seamless stone wall texture, top-down, tileable"
nanobridge edit hero.png "make the sky stormy, keep everything else"

nanobridge sheet "a green slime" --grid 4x2 \
  --action "squash down and stretch back up, a bouncy idle loop" --fps 10

图集会被生成、切片成帧,并组装成保留透明度的循环 GIF——GIF 没有 alpha 通道,因此会为空白像素保留一个调色板索引。

有两个命令从不访问网络,因此不消耗配额,并且可以处理来自任何地方的图像:

nanobridge cut photo.jpg --transparent --trim --size 256
nanobridge slice sheet.png --grid 6x1 --size 96

从智能体中使用

MCP 服务器暴露了 generate_imagegenerate_spritegenerate_sprite_sheetgenerate_iconedit_imagecut_imageslice_sheetnanobridge_status

每个生成工具都会将图像返回给模型,缩小到 512px 预览,同时提供磁盘上的路径。这正是关键所在:一个看不到自己绘制内容的智能体,无法区分好的精灵图和坏的精灵图,只能盲目迭代。

手动注册:

claude mcp add nanobridge --scope user -- /path/to/.venv/bin/nanobridge mcp

后处理做了什么

模型返回的是纯色背景上的大尺寸 JPEG。精灵图需要相反的效果,因此流水线是工具的一部分,而不是事后补充:

  • 背景移除是边界连通的,而不是颜色匹配的。精灵图内部的白眼与背景的白色颜色相同;只有到达图像边界的区域才会被擦除。

  • 裁剪会裁切到绘图区域。

  • 缩放使用最近邻算法。 使用平滑滤镜重采样的像素艺术就不再像像素艺术了。

  • 切片是几何式的。 提示词中要求的网格就是用于切割的网格,各个帧会被单独写出——这正是你查看模型是否真正遵守了提示词的地方。

语言

屏幕文本为葡萄牙语和英语。系统区域设置决定默认语言,nanobridge lang pt|en 可保存选择,NANOBRIDGE_LANG=pt 可覆盖两者,仅对单次运行生效。

值得了解的局限

  • Web 后端依赖于浏览器会话。当会话过期时,请重新登录 https://gemini.google.comnanobridge doctor 会明确说明这一点。

  • 它交互的是 Google 未记录的接口,因此他们那边的更改可能会破坏它。api 后端是保持不变的备用方案。

  • 生成的图像带有 Google 的 SynthID 水印。

许可证

MIT。

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
2Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Generate images, video & speech with Nano Banana, Veo, Omni and Gemini TTS. Pay as you go.

  • Generate images, video, and audio with Glif's media-generation agent

  • Generate images, GIFs, and PDFs from HTML, URLs, or templates — from your AI agent.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NspxMiguel/NanoBridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server