Gemini Webapi MCP logo

Gemini Webapi MCP

Community
AndyShaman

MCP server for Google Gemini — free image generation, editing & chat via browser cookies. No API keys needed.

PublisherAndyShaman
Repositorygemini-webapi-mcp
LanguagePython
Forks
26
Stars
55
Available tools
0
Transport typestdio
Categories
LicenseAGPL-3.0
Links
  • Connect tools to AI workflows

    Gemini Webapi MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    55 stars and 26 forks from the linked repository.


Возможности

  • Генерация изображений по текстовому описанию (Nano Banana 2 с поддержкой пропорций)
  • 2x разрешение — автоматически скачивает upscaled-версию (2048x2048 → 2816x1536 и выше)
  • Редактирование изображений — отправьте картинку + промпт и получите изменённую версию
  • Анализ файлов — видео, изображения, PDF, документы
  • Текстовый чат с Gemini (Flash, Pro, Flash-Thinking)
  • Авто-удаление вотермарки — sparkle-метка Gemini убирается встроенным детерминированным Reverse Alpha Blending (без внешних бинарников, ML-моделей и скачиваний)
  • Авто-аутентификация через cookies из Chrome

Быстрый старт

1. Войдите в Gemini

Откройте Chrome, перейдите на gemini.google.com и войдите в свой Google-аккаунт.

2. Установите MCP-сервер

Из GitHub (без клонирования):

bash
uv run --with "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git" gemini-webapi-mcp

Локальная установка:

bash
git clone https://github.com/AndyShaman/gemini-webapi-mcp.git
cd gemini-webapi-mcp
uv sync
uv run gemini-webapi-mcp

3. Добавьте MCP-конфиг

bash
claude mcp add-json gemini '{"command":"uv","args":["run","--with","gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git","gemini-webapi-mcp"]}'

Или добавьте вручную в .mcp.json в корне проекта:

json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Добавьте в конфиг Claude Desktop:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Используйте стандартный MCP stdio-конфиг:

json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Путь к файлу конфига зависит от вашего MCP-клиента.

json
"args": ["--directory", "/path/to/gemini-webapi-mcp", "run", "gemini-webapi-mcp"]

4. Установите скилл для Claude Code (опционально)

Папка skill/ содержит скилл для Claude Code — подсказки по промптингу, документацию по тулам и гайд по генерации изображений. Скилл автоматически активируется при работе с Gemini.

bash
cp -r skill ~/.claude/skills/gemini-mcp

5. Проверьте

Запустите сервер вручную — если инициализация прошла без ошибок, всё работает:

bash
uv run --with "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git" gemini-webapi-mcp

После этого откройте Claude Code или Claude Desktop и попробуйте: «Сгенерируй картинку кота в акварельном стиле через Gemini».

Аутентификация

Сервер автоматически читает cookies из Chrome через browser-cookie3.

Несколько Google-аккаунтов? Установите GEMINI_ACCOUNT_INDEX — номер аккаунта из Chrome (0 = первый, 1 = второй, ...). Посмотрите порядок: кликните на аватарку в gemini.google.com.

Gemini отвечает «Are you signed in?» или ошибкой 1096, хотя в Chrome вы залогинены? Сервер берёт cookies только с домена .google.com (версия от 2026-09-21); если у вас старая версия, а в Chrome есть cookies национальных доменов Google (.google.com.bd, .google.co.uk …), обновите сервер.

Если автоопределение cookies не работает, задайте их вручную:

  1. Откройте Chrome DevTools на gemini.google.com → Application → Cookies
  2. Скопируйте значения __Secure-1PSID и __Secure-1PSIDTS
  3. Добавьте в MCP-конфиг:
json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"],
      "env": {
        "GEMINI_PSID": "your__Secure-1PSID_value",
        "GEMINI_PSIDTS": "your__Secure-1PSIDTS_value"
      }
    }
  }
}

Переменные окружения

ПеременнаяОписаниеПо умолчанию
GEMINI_PSIDЗначение cookie __Secure-1PSIDавто из Chrome
GEMINI_PSIDTSЗначение cookie __Secure-1PSIDTSавто из Chrome
GEMINI_LANGUAGEЯзык ответов Gemini (ru, en, ja, ...)en
GEMINI_ACCOUNT_INDEXИндекс Google-аккаунта (0, 1, 2, ...)0

Высокое разрешение (2x)

Сервер автоматически запрашивает у Google увеличенную версию сгенерированного изображения — тот же механизм, что использует кнопка "Download" в веб-интерфейсе Gemini. Google выполняет server-side upscale, и вы получаете изображение в 2x разрешении:

МодельНативное2x (скачивается)
Flash-Thinking (16:9)1408x7682816x1536
Flash-Thinking (9:16)768x13761536x2752
Flash-Thinking (1:1)1024x10242048x2048

Если 2x-версия недоступна (таймаут, ошибка сети), сервер автоматически использует нативное разрешение.

Удаление вотермарки

Gemini добавляет sparkle-метку (четырёхконечную звёздочку) в правый нижний угол сгенерированных изображений. Сервер убирает её встроенным reverse-alpha-вычитанием — original = (L − A·shape·255) / (1 − A·shape) — без внешних бинарников, ML-моделей и скачиваний.

Метка всегда стоит в одном из двух фиксированных угловых якорей — на отступе 96 px или 32 px от правого нижнего угла (абсолютные отступы, не зависят от разрешения; логотип 48 px, ×2 при 2x-upscale). Сервер не детектирует метку по порогу корреляции — это ненадёжно на ярком фоне, где слабая полупрозрачная звёздочка почти не контрастирует. Вместо этого он детерминированно обрабатывает оба якоря:

  1. per-image прозрачность — сила метки оценивается из самого кадра (L = bg + A·shape·(255−bg), least-squares); на пустом якоре A ≈ 0, поэтому вычитание становится no-op;
  2. reverse-alpha в позиции якоря;
  3. self-check по |corr| — вычитание принимается, только если оно уменьшает корреляцию с формой звезды; иначе откатывается. Навредить пустому, текстурному или цветному-контентному якорю невозможно.

Подход не содержит ни одной захардкоженной «под разрешение» величины, поэтому работает на любом нативном разрешении и соотношении сторон — на светлом, тёмном и цветном фоне.

Единственный калиброванный инвариант — форма звезды в src/gemini_webapi_mcp/assets/wm_alpha_edit.npy. Чтобы временно отключить удаление (получить «сырой» водяной знак), задайте GEMINI_WM_KEEP=1.

Инструменты

ИнструментОписание
gemini_generate_imageГенерация новых или редактирование существующих изображений
gemini_upload_fileАнализ файлов — видео, изображения, PDF, документы
gemini_analyze_urlАнализ URL — YouTube-видео, веб-страницы, статьи
gemini_chatТекстовый чат (одиночный или multi-turn)
gemini_start_chatНачать multi-turn сессию
gemini_resetПереинициализация клиента при ошибках авторизации

Модели

МодельПо умолчанию дляПримечание
gemini-3.0-flashчат, анализ файловБыстрая
gemini-3.0-flash-thinkingгенерация изображенийNano Banana 2, поддержка пропорций
gemini-3.0-pro—Альтернативная модель

Примеры использования

После настройки MCP-конфига Claude сам вызывает нужные инструменты. Просто попросите в чате:

ЗадачаЧто написать Claude
Сгенерировать изображение«Сгенерируй через Gemini кота в акварельном стиле»
Отредактировать изображение«Отредактируй через Gemini /path/to/cat.png — сделай кота серым»
Итеративная правка«Теперь сделай фон темнее» (в том же разговоре)
Проанализировать видео«Проанализируй через Gemini это видео: https://youtube.com/watch?v=...»
Проанализировать файл«Загрузи в Gemini /path/to/doc.pdf и сделай краткое резюме»

Инструменты, которые Claude вызовет:

gemini_generate_image(prompt="кот в акварельном стиле")
gemini_generate_image(prompt="сделай кота серым", files=["/path/to/cat.png"])
gemini_generate_image(prompt="сделай фон темнее", conversation_id=["c_abc", "r_123", "rc_456"])
gemini_analyze_url(url="https://youtube.com/watch?v=...", prompt="О чём это видео?")
gemini_upload_file(file_path="/path/to/doc.pdf", prompt="Сделай краткое резюме")

Благодарности

Этот проект построен на основе библиотеки gemini-webapi от @HanaokaYuzu (форк @xob0t с поддержкой curl_cffi) — реверс-инжиниринговой асинхронной Python-обёртки для веб-приложения Google Gemini. Лицензия: AGPL-3.0.

Алгоритм удаления вотермарки (Reverse Alpha Blending) изначально вдохновлён проектами gwt-mini от @allenk (Allen Kuo, MIT License) и gemini-watermark-remover от @GargantuaX (MIT License). В текущей версии сервер использует собственную встроенную реализацию и откалиброванные alpha-карты — внешние бинарники не требуются.

Лицензия

AGPL-3.0 — свободно используйте, модифицируйте и распространяйте при условии сохранения открытости исходного кода.

@AndyShaman · gemini-webapi-mcp



Features

  • Image generation from text descriptions (Nano Banana 2 with aspect ratio support)
  • 2x resolution — automatically downloads upscaled version (2048x2048 → 2816x1536 and above)
  • Image editing — send an image + prompt to get a modified version
  • File analysis — video, images, PDF, documents
  • Text chat with Gemini (Flash, Pro, Flash-Thinking)
  • Auto watermark removal — Gemini's sparkle mark is stripped by a built-in deterministic Reverse Alpha Blending pass (no external binaries, ML models, or downloads)
  • Auto-authentication via Chrome browser cookies

Quick Start

1. Log into Gemini

Open Chrome, go to gemini.google.com and sign in.

2. Install the MCP server

From GitHub (no clone needed):

bash
uv run --with "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git" gemini-webapi-mcp

Local install:

bash
git clone https://github.com/AndyShaman/gemini-webapi-mcp.git
cd gemini-webapi-mcp
uv sync
uv run gemini-webapi-mcp

3. Add MCP config

bash
claude mcp add-json gemini '{"command":"uv","args":["run","--with","gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git","gemini-webapi-mcp"]}'

Or add manually to .mcp.json in your project root:

json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Add to Claude Desktop config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Use the standard MCP stdio config:

json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}

Config file path depends on your MCP client.

json
"args": ["--directory", "/path/to/gemini-webapi-mcp", "run", "gemini-webapi-mcp"]

4. Install the skill for Claude Code (optional)

The skill/ folder contains a Claude Code skill — prompting tips, tool documentation and an image generation guide. The skill auto-activates when working with Gemini.

bash
cp -r skill ~/.claude/skills/gemini-mcp

5. Verify

Run the server manually — if it initializes without errors, everything works:

bash
uv run --with "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git" gemini-webapi-mcp

Then open Claude Code or Claude Desktop and try: "Generate a watercolor cat image with Gemini".

Authentication

The server reads cookies from Chrome automatically via browser-cookie3.

Multiple Google accounts? Set GEMINI_ACCOUNT_INDEX — the account number from Chrome (0 = first, 1 = second, ...). Check the order by clicking your avatar on gemini.google.com.

Gemini answers "Are you signed in?" or error 1096 while Chrome is logged in? The server takes cookies from the .google.com domain only (since 2026-09-21); on an older version, cookies of Google country domains in Chrome (.google.com.bd, .google.co.uk …) break auth — update the server.

If cookie auto-detection fails, set them manually:

  1. Open Chrome DevTools on gemini.google.com → Application → Cookies
  2. Copy __Secure-1PSID and __Secure-1PSIDTS values
  3. Add to your MCP config:
json
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"],
      "env": {
        "GEMINI_PSID": "your__Secure-1PSID_value",
        "GEMINI_PSIDTS": "your__Secure-1PSIDTS_value"
      }
    }
  }
}

Environment Variables

VariableDescriptionDefault
GEMINI_PSIDCookie value __Secure-1PSIDauto from Chrome
GEMINI_PSIDTSCookie value __Secure-1PSIDTSauto from Chrome
GEMINI_LANGUAGEGemini response language (ru, en, ja, ...)en
GEMINI_ACCOUNT_INDEXGoogle account index (0, 1, 2, ...)0

High Resolution (2x)

The server automatically requests an upscaled version of each generated image — the same mechanism used by the "Download" button in Gemini's web interface. Google performs server-side upscaling, delivering images at 2x resolution:

ModelNative2x (downloaded)
Flash-Thinking (16:9)1408x7682816x1536
Flash-Thinking (9:16)768x13761536x2752
Flash-Thinking (1:1)1024x10242048x2048

If the 2x version is unavailable (timeout, network error), the server automatically falls back to native resolution.

Watermark Removal

Gemini adds a sparkle watermark (4-point star) to the bottom-right corner of generated images. The server removes it with a built-in reverse alpha-blend — original = (L − A·shape·255) / (1 − A·shape) — with no external binaries, ML models, or downloads.

The mark is always stamped at one of two fixed corner anchors — 96 px or 32 px from the bottom-right (absolute offsets that don't depend on resolution; the logo is 48 px, ×2 when 2x-upscaled). The server does not detect the mark by a correlation threshold — that's unreliable on bright backgrounds, where a faint translucent star barely contrasts. Instead it deterministically processes both anchors:

  1. per-image opacity — the mark's strength is fit from the frame itself (L = bg + A·shape·(255−bg), least-squares); on an empty anchor A ≈ 0, so the subtraction is a no-op;
  2. reverse alpha-blend at the anchor;
  3. |corr| self-check — a subtraction is accepted only if it reduces the correlation with the star shape; otherwise it is reverted. It can never damage an empty, textured, or coloured-content anchor.

The approach hard-codes no resolution-dependent values, so it works at any native resolution or aspect ratio — on light, dark, and coloured backgrounds alike.

The only calibrated invariant is the star shape in src/gemini_webapi_mcp/assets/wm_alpha_edit.npy. Set GEMINI_WM_KEEP=1 to disable removal (keep the raw watermark).

Tools

ToolDescription
gemini_generate_imageGenerate new or edit existing images
gemini_upload_fileAnalyze files — video, images, PDF, documents
gemini_analyze_urlAnalyze URLs — YouTube videos, webpages, articles
gemini_chatText chat (single or multi-turn)
gemini_start_chatStart a multi-turn session
gemini_resetRe-initialize client on auth errors

Models

ModelDefault forNotes
gemini-3.0-flashchat, file analysisFast
gemini-3.0-flash-thinkingimage generationNano Banana 2, supports aspect ratios
gemini-3.0-pro—Alternative model

Usage Examples

Once configured, Claude calls the right tools automatically. Just ask in chat:

TaskWhat to tell Claude
Generate an image"Generate a watercolor cat with Gemini"
Edit an image"Edit /path/to/cat.png with Gemini — make the cat gray"
Iterative refinement"Now make the background darker" (same conversation)
Analyze a video"Analyze this video with Gemini: https://youtube.com/watch?v=..."
Analyze a file"Upload /path/to/doc.pdf to Gemini and summarize it"

Tools that Claude will call:

gemini_generate_image(prompt="a cat in watercolor style")
gemini_generate_image(prompt="make it gray", files=["/path/to/cat.png"])
gemini_generate_image(prompt="make the background darker", conversation_id=["c_abc", "r_123", "rc_456"])
gemini_analyze_url(url="https://youtube.com/watch?v=...", prompt="Summarize this video")
gemini_upload_file(file_path="/path/to/doc.pdf", prompt="Summarize key points")

Acknowledgements

This project is built on top of gemini-webapi by @HanaokaYuzu (fork by @xob0t with curl_cffi support) — a reverse-engineered async Python wrapper for the Google Gemini web app. Licensed under AGPL-3.0.

The watermark-removal algorithm (Reverse Alpha Blending) was originally inspired by gwt-mini by @allenk (Allen Kuo, MIT License) and gemini-watermark-remover by @GargantuaX (MIT License). The current version uses its own built-in implementation and calibrated alpha maps — no external binaries required.

License

AGPL-3.0 — free to use, modify, and distribute, provided the source code remains open.

@AndyShaman · gemini-webapi-mcp

Installation

TypingMind
{
  "mcpServers": {
    "gemini-webapi-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "gemini-webapi-mcp[watermark] @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git",
        "gemini-webapi-mcp"
      ]
    }
  }
}

Use Gemini Webapi MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Gemini Webapi MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Gemini Webapi MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Gemini Webapi MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "gemini-webapi-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Gemini Webapi MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Gemini Webapi MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Gemini Webapi MCP to help me with this task?
Gemini Webapi MCP
Sure. I read it.
Here is what I found using Gemini Webapi MCP.

Frequently asked questions

What is the Gemini Webapi MCP MCP server used for?

Gemini Webapi MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Gemini Webapi MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Gemini Webapi MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Gemini Webapi MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Gemini Webapi MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Gemini Webapi MCP MCP to TypingMind?

Gemini Webapi MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Gemini Webapi MCP MCP provide in TypingMind?

Gemini Webapi MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Gemini Webapi MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Gemini Webapi MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇