Get the FREE Ultimate OpenClaw Setup Guide →

gemini-webapi

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio andyshaman-gemini-webapi-mcp uv run --with gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git gemini-webapi-mcp \
  --env GEMINI_PSID="your __Secure-1PSID cookie value" \
  --env GEMINI_PSIDTS="your __Secure-1PSIDTS cookie value" \
  --env GEMINI_LANGUAGE="en" \
  --env GEMINI_ACCOUNT_INDEX="0"

How to use

gemini-webapi-mcp is a Python-based MCP server that integrates with Google Gemini to generate and edit images, perform file analysis, and chat via Gemini. It authenticates using cookies read from Chrome (via browser-cookie3) or manual cookie values provided through environment variables. The server exposes a set of tools you can invoke through MCP clients: gemini_generate_image for creating or editing images based on prompts, gemini_upload_file for analyzing images, videos, PDFs and documents, gemini_analyze_url for evaluating URLs, gemini_chat and gemini_start_chat for Gemini-powered text conversations, and gemini_reset to reinitialize the client after auth issues. When configured, Claude-like MCP clients can automatically trigger these tools from chat prompts. The server also supports auto-upscaling by requesting a 2x version from Gemini and removes watermark marks using a Reverse Alpha Blending method, all without requiring extra models. To use it, ensure your MCP client is configured to launch the server with the uv command and the proper with-args, then issue prompts like “Generate an image of a cat in watercolor through Gemini” or “Edit this image with a purple hue.”

How to install

Prerequisites:

  • Python 3.10+ installed on your system
  • uv (uvx) runtime available and in PATH
  • Git installed
  1. Install uv (if not already installed)
# Example using pipx (if you have it)
pipx install uvx
# Or follow uvx install guide for your platform
  1. Clone the repository (optional if you already have it)
git clone https://github.com/AndyShaman/gemini-webapi-mcp.git
cd gemini-webapi-mcp
  1. Install dependencies and sync (via uv)
uv sync
  1. Run the MCP server locally (example)
uv run --with "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git" gemini-webapi-mcp
  1. Add MCP config (example for local use)
{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": ["run", "--with", "gemini-webapi-mcp @ git+https://github.com/AndyShaman/gemini-webapi-mcp.git", "gemini-webapi-mcp"]
    }
  }
}
  1. Start using Claude Code/Desktop or another MCP client to invoke the Gemini tools through prompts.

Additional notes

Tips and notes:

  • If automatic cookie discovery fails, supply cookies manually via environment variables GEMINI_PSID and GEMINI_PSIDTS.
  • You can override the Gemini response language with GEMINI_LANGUAGE (default is en).
  • For multi-account setups in Chrome, set GEMINI_ACCOUNT_INDEX to choose the account order (0 = first).
  • The 2x upscaling relies on Google’s server-side upscaling; if it’s unavailable, the native resolution is used instead.
  • Ensure your MCP client supports the standard MCP json config format and points to the correct Python-based server binary via the uv command.
  • The watermark removal process uses the Reverse Alpha Blending algorithm; no additional assets or models are needed.
  • If you run behind proxies or restricted networks, ensure outbound access to Gemini services is allowed and that cookies can be read from browser storage.

Related MCP Servers

Sponsor this space

Reach thousands of developers