Skip to main content
Glama
google-ai-history-mcp

google-ai-history-mcp

by travispflanz

google-ai-history-mcp — Google AI & Gemini Chat History Importer for Google Antigravity (MCP Server & CLI)

CI License: MIT MCP Server

google-ai-history-mcp is an open-source Model Context Protocol (MCP) server and CLI sync engine that brings all of your Google AI conversations, prompts, and search sessions onto your computer—indexed with SQLite FTS5 full-text search, mirrored as local Markdown files, and accessible by dropping any Google AI URL directly into chat—so you can continue sessions and build real projects from them inside Google Antigravity, Claude Code, Cursor, Windsurf, Cline, or Gemini CLI.


Why This Exists & How It Changes Your Workflow

1. Drop a URL & Say "Continue This Chat" or "Build a Project From This"

You don't even have to run a full sync first. You can paste a URL from gemini.google.com/app/..., a shared link (gemini.google.com/share/...), a Google Search AI Mode session (google.com/search?udm=50...), a Google AI Studio prompt (aistudio.google.com/prompts/...), or a NotebookLM notebook directly into Google Antigravity and say:

  • "I want to continue this chat: https://gemini.google.com/app/..."

  • "Build a project from this session: https://gemini.google.com/app/..."

  • "Start a new project in my workspace from this chat line: https://aistudio.google.com/prompts/..."

Antigravity automatically calls fetch_google_ai_chat_url, pulls every prompt, response, code block, and thinking trace from that URL, saves it locally as Markdown + SQLite FTS5, and picks up right where you left off.

2. Graduate a "Small One-Off Question" into a Full Project

Some of the best projects start by accident as a quick one-off interaction in the browser:

  • You do a Google Search, click "Show more" on the AI Overview, and start asking follow-up questions in "Ask anything" (AI Mode).

  • You brainstorm an app idea or debug a script in gemini.google.com on your phone or laptop.

  • You prototype a system prompt in Google AI Studio (aistudio.google.com).

When that "small one-off chat" turns into something bigger that needs real files, a Git repository, terminal execution, and autonomous subagents, you no longer have to copy-paste 30 turns of chat history or start from scratch. Just drop the URL (or search your synced history by keyword) in Google Antigravity and roll that conversation directly into a full engineering workspace.

3. New to Google Antigravity? Bring Your Entire Google AI History With You

When you start using Google Antigravity, months or years of your past conversations, architectural decisions, prompts, and research shouldn't stay trapped across disconnected web tabs (gemini.google.com, Google Search AI Mode, AI Studio, NotebookLM, Ask Maps, and YouTube AI). google-ai-history-mcp unifies all of your past Google AI interactions into a local, privacy-first knowledge base on your machine from day one.


Related MCP server: google-activity-assistant

Supported Google AI Surfaces & Storage Locations

Google stores your AI interactions across one central activity hub (myactivity.google.com) plus four product-specific thread stores:

Google AI Surface

Where Google Stores It

How google-ai-history-mcp Pulls It In

source Tag

1. Direct URL Drop (Any Surface)

Live web session (gemini.google.com/app/..., /share/..., udm=50, aistudio.google.com/prompts/..., notebooklm.google.com/notebook/...)

Instant on-demand extraction via fetch_google_ai_chat_url(url) or google-ai-history fetch <url>

browser_gemini, url_gemini_share, browser_aistudio, etc.

2. Central Google My Activity Hub (myactivity.google.com)

Unified chronological log of Gemini Apps, Search AI Mode, Circle to Search, Google Lens, Ask Maps, YouTube AI, and Assistant

Live Chrome CDP sync (--target myactivity) or Google Takeout (My Activity .zip/.json/.html)

myactivity_gemini, myactivity_search_ai, takeout_*

3. Gemini Web App (gemini.google.com/app)

Multi-turn sidebar conversation threads

Live Chrome CDP sidebar sync (--target gemini) + Takeout (My Activity → Gemini Apps)

browser_gemini, takeout_gemini

4. Google Search "AI Mode" & AI Overviews (google.com/search?udm=50)

When you click "Show more" on an AI Overview and "Ask anything" to continue chatting in AI Mode (udm=50 history sidebar)

Live Chrome CDP AI Mode sync (--target aimode) + Takeout (My Activity → Search)

browser_search_ai_mode, takeout_search_ai_mode

5. Google AI Studio (aistudio.google.com)

Auto-saved as extensionless JSON files in Google Drive/Google AI Studio/ & aistudio.google.com/library

Direct folder/file import (chunkedPrompt & contents JSON, including thinking blocks) + Live Chrome sync (--target aistudio)

aistudio, browser_aistudio

6. NotebookLM (notebooklm.google.com)

NotebookLM notebooks, source summaries, and chat notes

Live Chrome sync (--target notebooklm) + Takeout NotebookLM folder import

browser_notebooklm, notebooklm

7. Ask Maps, YouTube AI & Assistant

Logged under My Activity → Maps / YouTube / Assistant

Takeout MyActivity.json / MyActivity.html importer

takeout_ask_maps, takeout_youtube_ai, takeout_assistant


MCP Tools Exposed to Google Antigravity & MCP Clients

MCP Tool Name

Parameters

What It Does

fetch_google_ai_chat_url

url, login_timeout_sec=45

Drop-a-URL tool: Pulls any single Google AI chat/session directly from its URL, saves it locally, and returns the full transcript so you can continue the chat or build a project from it.

get_google_ai_chat

chat_id, login_timeout_sec=45

Retrieves the full multi-turn conversation transcript and local .md file path by ID, partial title, or URL (automatically fetches live if the URL isn't cached yet).

search_google_ai_chats

query, limit=20

Runs a fast SQLite FTS5 full-text search across all prompts and responses with highlighted snippets.

list_google_ai_chats

limit=50, offset=0, source=None

Lists locally synced/imported Google AI chats (optionally filtered by source).

sync_google_ai_chats_from_browser

target="gemini", max_chats=50, login_timeout_sec=180, skip_existing=False, offset=0, time_budget_sec=140, background=False

Attaches to Chrome over CDP (port 9222) and syncs threads across surfaces. Use background=True + get_sync_status(job_id) for large syncs (max_chats > 20 or target="all").

get_sync_status

job_id=None

Polls progress lines and final results for a background sync job started with background=True.

import_google_ai_takeout_or_files

path

Imports a Google Takeout .zip, MyActivity.json, MyActivity.html, a Google AI Studio Drive folder, or exported JSON/Markdown files.

google_ai_history_auth_status

(none)

Checks Python dependencies, Chrome/Edge path, and probes the SQLite Cookies DB in chrome_profile (SID, SAPISID, __Secure-1PSID, __Secure-3PSID) so AI agents know whether private URLs are ready or need one-time sign-in.


System Requirements & Expected First-Run Process (For Humans & AI Agents)

Additional Requirements (Beyond Google Antigravity)

To run google-ai-history-mcp on your computer, you need:

  1. Google Chrome or Microsoft Edge installed locally (used via Playwright's connect_over_cdp on 127.0.0.1:9222 for private URL fetching and browser syncing; note: playwright install is NOT needed because the tool uses your system Chrome/Edge rather than downloading bundled browsers).

  2. uv (Astral uv) and Python 3.11+ (3.11, 3.12, or 3.13).

  3. A Google Account signed into your Google AI surfaces (gemini.google.com, myactivity.google.com, aistudio.google.com, etc.) — except when importing public gemini.google.com/share/... links or offline Takeout files, which require no login.

  1. Public Gemini Share Links (share.gemini.google/..., gemini.google.com/share/..., g.co/gemini/share/...) — Zero Browser & Zero Auth (~1s):

    • Public Gemini share links are fetched directly via HTTP + Google's batchexecute RPC (ujx1Bf) in ~1 second (method: "http_direct"), preserving 100% of the raw Markdown (tables, code blocks, inline backticks) without needing Chrome or a Google login at all (works even in headless Linux/WSL containers like Hermes Agent).

  2. Private Chats (gemini.google.com/app/..., AI Mode, AI Studio, My Activity) — One-Time Google Sign-In:

    • Even if you are already signed into Google in your normal everyday Chrome window, Google Chrome v136+ blocks external debugging connections (--remote-debugging-port) on your default Chrome profile while Chrome is open. To keep your main browser safe and untouched, google-ai-history-mcp manages a dedicated, persistent Chrome sync profile at ~/.gemini/google_ai_history/chrome_profile:

    • The first time you ask Antigravity to import a private URL or sync your history (or run google-ai-history setup), google-ai-history-mcp launches a visible Chrome window on your desktop (--remote-debugging-port=9222 --user-data-dir=~/.gemini/google_ai_history/chrome_profile) and automatically clicks the "Sign in" button if you aren't logged into that profile yet.

    • Sign into your Google account once in that Chrome window.

    • As soon as sign-in finishes, google-ai-history-mcp automatically navigates back to your exact target URL (e.g., https://gemini.google.com/app/<id>), waits for the conversation turns to render, extracts the full chat, writes the Markdown file to ~/.gemini/google_ai_history/markdown/, and indexes it in ~/.gemini/google_ai_history/chats.db.

  3. All Subsequent Runs (Zero Sign-In Needed):

    • Because your login cookies are persisted inside ~/.gemini/google_ai_history/chrome_profile, every future URL drop or sync reuses that authenticated session automatically without asking you to log in again.

  4. Critical Execution Rule for AI Agents (Antigravity, Claude Code, Cursor):

    • Always invoke the MCP tools (fetch_google_ai_chat_url, get_google_ai_chat, sync_google_ai_chats_from_browser) directly instead of running the CLI via a sandboxed shell command (run_command).

    • Why? On Windows, agent shell sandboxes often execute inside an isolated background desktop (WinSta0\exebox-...), which hides any GUI browser window spawned from the shell. By contrast, the MCP server process runs on the user's interactive desktop (WinSta0\Default), ensuring the Chrome window is always visible when a one-time login is needed.


Installation, AI Self-Bootstrap & Google Antigravity Setup

For AI Agents (Antigravity, Claude Code, Cursor, Windsurf): See AGENTS.md for the complete automated prerequisite check, installation, harness registration, and user walkthrough playbook. If a user drops this repository URL into chat and says "Install and set this up for me", follow the steps below automatically.

Step 1: Check & Auto-Install Missing Prerequisites (uv, Python 3.11+, Chrome/Edge)

If the user's machine is missing any prerequisite, the AI agent (or user) should install it first:

  • Install uv (which also auto-manages Python 3.11+):

    # Windows (PowerShell)
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    # macOS / Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
  • Verify Google Chrome or Microsoft Edge is installed:

    • Windows: winget install Google.Chrome (if neither Chrome nor Edge is present)

    • macOS: brew install --cask google-chrome

Step 2: Clone & Install google-ai-history-mcp

git clone https://github.com/travispflanz/google-ai-history-mcp.git
cd google-ai-history-mcp
uv sync --all-groups

Step 3: Register in Google Antigravity (mcp_config.json) & Refresh

Merge the "google-ai-history" entry into ~/.gemini/config/mcp_config.json (and ~/.gemini/antigravity/mcp_config.json on Windows):

{
  "mcpServers": {
    "google-ai-history": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/google-ai-history-mcp",
        "google-ai-history",
        "serve"
      ],
      "disabled": false
    }
  }
}

(Windows Reliability Note: Prefer "command": "uv" with "args": ["run", "--directory", "<repo-path>", "google-ai-history", "serve"] — or the full .venv\Scripts\google-ai-history.exe path — because spawning bare "google-ai-history" without .exe / PATHEXT resolution on Windows can fail with exit status 0xffffffff in Antigravity. On macOS/Linux, "command": "google-ai-history" from uv tool install --editable . --force also works cleanly.)

Step 4: How AI Agents Should Walk the User Through First-Time Activation

  1. Refresh the MCP Server Panel: After editing mcp_config.json in an active Antigravity session, instruct the user:

    *"Please open the MCP Servers panel in Antigravity and click Refresh / Restart next to google-ai-history, then let me know so I can run the import."*

  2. Explain the One-Time Chrome Sign-In Window: Before running the very first URL fetch or browser sync, tell the user:

    "A Chrome window is about to open on your desktop using a dedicated sync profile (~/.gemini/google_ai_history/chrome_profile). Please sign into your Google account once in that window—as soon as you sign in, the tool will automatically navigate to your chat, import it into Antigravity, and save your login session for all future imports."

  3. Offline Fallback Walkthrough: If the user prefers not to use Chrome or wants to import Ask Maps / YouTube AI / Google Takeout archives, guide them to Google Takeout (Deselect all → My Activity [JSON format: Gemini Apps, Search, Maps, YouTube]) or their Google Drive/Google AI Studio folder and call import_google_ai_takeout_or_files(path).


CLI Usage (google-ai-history)

# Check Python dependencies, Chrome/Edge availability, and authentication readiness
uv run google-ai-history doctor

# Open the dedicated Chrome profile and complete one-time Google sign-in
uv run google-ai-history setup

# Fetch a public Gemini share link in ~1s via direct HTTP (no browser or Google login needed!)
uv run google-ai-history fetch "https://share.gemini.google/RknF2GkWxLcp"

# Fetch a private Google AI chat/session directly by URL
uv run google-ai-history fetch "https://gemini.google.com/app/1a2b3c4d5e6f"

# Sync EVERYTHING from Chrome (Gemini + Search AI Mode + AI Studio + NotebookLM + My Activity Hub)
uv run google-ai-history sync --target all --max-chats 50

# Sync directly from Google's central My Activity AI hub (myactivity.google.com)
uv run google-ai-history sync --target myactivity

# Sync Google Search AI Mode ("Show more -> Ask anything" threads at google.com/search?udm=50)
uv run google-ai-history sync --target aimode

# Sync Google AI Studio library (aistudio.google.com/library)
uv run google-ai-history sync --target aistudio

# Import a Google Takeout archive (.zip, MyActivity.json, or MyActivity.html)
uv run google-ai-history import ~/Downloads/takeout.zip

# Import your Google Drive "Google AI Studio" folder (automatically parses extensionless JSON files)
uv run google-ai-history import "~/Google Drive/My Drive/Google AI Studio"

# Full-text search across all synced Google AI chats
uv run google-ai-history search "kubernetes ingress"

# List chats filtered by source tag
uv run google-ai-history list --source takeout_search_ai_mode

Frequently Asked Questions (FAQ for Humans & AI Agents)

Can I just drop a URL from a Gemini chat into Antigravity and say "Continue this chat" or "Build a project from this"?

Yes! Paste any URL from gemini.google.com/app/..., gemini.google.com/share/..., aistudio.google.com/prompts/..., google.com/search?udm=50..., or notebooklm.google.com/notebook/... into Antigravity and ask to continue the session or build a project from it. Antigravity will call fetch_google_ai_chat_url (or get_google_ai_chat) to pull the entire conversation into your workspace immediately.

How do I get all my chats from gemini.google.com to appear in Google Antigravity?

Install google-ai-history-mcp in your Antigravity mcp_config.json and either run sync_google_ai_chats_from_browser(target="all") (which opens Chrome with a persistent profile so you log in once and scrape your sidebar threads) or export your history from Google Takeout (My Activity → Gemini Apps & Search) and run import_google_ai_takeout_or_files(path). Every chat is indexed in SQLite FTS5 and saved as a .md file in ~/.gemini/google_ai_history/markdown/ so you can @-mention it in Antigravity.

How do I export Google Search "AI Overview" / "AI Mode" ("Ask anything") conversations?

When you click "Show more" on a Google Search AI Overview and continue chatting via "Ask anything", Google routes the session to Google Search AI Mode (google.com/search?udm=50). You can drop the URL directly into Antigravity, sync all threads from the AI Mode sidebar with uv run google-ai-history sync --target aimode, or pull from Google's central activity log (--target myactivity or Google Takeout My Activity → Search).

Where are Google AI Studio (aistudio.google.com) chats stored and how do I import them?

Google AI Studio automatically saves your prompts and chat histories as extensionless JSON files inside a Google AI Studio folder in your Google Drive. Point import_google_ai_takeout_or_files at that folder (or drop an aistudio.google.com/prompts/... URL / run --target aistudio), and google-ai-history-mcp extracts the runSettings, systemInstruction, thinking traces (isThought), and chunkedPrompt.chunks into searchable Markdown and SQLite FTS5 records.


Development, Pull Request Workflow & AI Issue Reporting

This repository follows a Feature Branch + Pull Request + CI Gate workflow using Ruff (linting & formatting), Mypy (static type checking), and Pytest (85%+ coverage gate) enforced via GitHub Actions across Ubuntu and Windows (Python 3.11, 3.12, 3.13).

uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest --cov=google_ai_history --cov-report=term-missing --cov-fail-under=85

Automated Issue Reporting for AI Agents

If an AI coding agent (Antigravity, Hermes Agent, Claude Code, Cursor, etc.) discovers a bug, edge case, or Google AI DOM selector change while using google-ai-history-mcp:

  • If the user has GitHub CLI (gh auth status) configured: The agent should ask the user for quick confirmation and submit a sanitized issue (never including private chat transcripts) via gh issue create --repo travispflanz/google-ai-history-mcp (or open a PR if it patched the issue locally).

  • If the user is not set up with GitHub CLI: The agent should simply suggest a 1-click pre-filled link to github.com/travispflanz/google-ai-history-mcp/issues/new with a sanitized diagnostic summary. See AGENTS.md for the full agent reporting protocol.

Available Tools

6 tools
fetch_google_ai_chat_urlFetch Google Ai Chat UrlC

Pull a Google AI chat/session directly from a URL to continue or build from it.

Inputs: url (required), login_timeout_sec. Returns: object

get_google_ai_chatGet Google Ai ChatB

Retrieve a full Google AI conversation by chat ID, title, or direct URL.

Inputs: chat_id (required), login_timeout_sec. Returns: object

import_google_ai_takeout_or_filesImport Google Ai Takeout Or FilesB

Import Google AI chats from Takeout, AI Studio Drive folder, NotebookLM, or JSON/MD.

Inputs: path (required). Returns: object

list_google_ai_chatsList Google Ai ChatsB

List locally stored Google AI chats (Gemini, Search AI Mode, AI Studio, Ask Maps, etc.).

Inputs: limit, offset, source. Returns: object

search_google_ai_chatsSearch Google Ai ChatsB

Full-text search (SQLite FTS5) across all synced Google AI prompts and responses.

Inputs: query (required), limit. Returns: object

sync_google_ai_chats_from_browserSync Google Ai Chats From BrowserC

Sync Google AI chats via Chrome ('all', 'myactivity', 'gemini', 'aimode', 'aistudio').

Inputs: target, max_chats, login_timeout_sec. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 6 tools

    Disambiguation3/5

    The three ingestion tools (import from files, sync from browser, fetch from URL) are distinguished by their source, and the descriptions do explain the differences. However, get_google_ai_chat explicitly accepts a 'direct URL' while fetch_google_ai_chat_url also pulls a chat by URL, creating a genuine overlap that could cause misselection.

    Naming Consistency4/5

    All tools use snake_case with a verb_noun pattern (import_*, sync_*, list_*, search_*, get_*, fetch_*). The two ingestion names are unusually long and tack on qualifiers ('_or_files', '_from_browser'), but the convention itself is readable and consistent.

    Tool Count4/5

    Six tools is a reasonable scope for a chat-archive server covering ingest, list, search, and retrieve. Nothing feels redundant in count, though the two URL/file ingestion paths could arguably be folded into fewer tools.

    Completeness4/5

    The ingestion-plus-retrieval lifecycle is well covered: import, sync, list, search, get, fetch. There are no delete, export, or tagging/metadata operations, but these are minor gaps an agent can work around outside the server.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for querying your local Google Takeout activity (Search/YouTube history) via SQLite/FTS5. Provides tools for keyword search, activity stats, and database info, enabling AI assistants to cite your personal history.
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to curate YouTube watch history and locally search selected transcripts using SQLite FTS5, ChromaDB embeddings, and reciprocal rank fusion, with tools to browse unindexed history and add videos.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes a unified local memory of conversations collected from Claude Code, Codex, Cursor, Gemini CLI, ChatGPT, claude.ai and Gemini over MCP, so any connected agent can search past work, browse and read conversations, and save notes that all tools can see. Optionally runs as a self-hosted node for web and mobile apps.
      3
      MIT