google-ai-history-mcp
This MCP server lets you import, search, retrieve, and sync Google AI chat history locally for use in MCP clients.
Fetch a Google AI chat/session directly from a URL to continue it or build from it.
Retrieve full conversations by chat ID, title, or URL.
Full-text search across synced prompts and responses with SQLite FTS5.
List locally stored chats with pagination and optional source filtering.
Import chats from Google Takeout, AI Studio Drive folders, NotebookLM, or JSON/Markdown files.
Sync chats from Chrome across Google AI surfaces such as Gemini, My Activity, AI Mode, and AI Studio.
Imports Google AI chat history from Gemini, Google Search AI Mode, Google AI Studio, NotebookLM, My Activity, and related Google AI surfaces, with URL fetching, full-text search, and local Markdown/SQLite storage.
Imports Google AI Studio prompt JSON files stored in Google Drive/Google AI Studio folders.
Imports Google Lens activity captured in Google My Activity/Takeout as part of the unified Google AI history sync.
Imports YouTube AI activity from Google My Activity/Takeout alongside other Google AI history.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-ai-history-mcp continue this chat: https://gemini.google.com/app/1a2b3c"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
google-ai-history-mcp — Google AI & Gemini Chat History Importer for Google Antigravity (MCP Server & CLI)
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.comon 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 |
|
1. Direct URL Drop (Any Surface) | Live web session ( | Instant on-demand extraction via |
|
2. Central Google My Activity Hub ( | Unified chronological log of Gemini Apps, Search AI Mode, Circle to Search, Google Lens, Ask Maps, YouTube AI, and Assistant | Live Chrome CDP sync ( |
|
3. Gemini Web App ( | Multi-turn sidebar conversation threads | Live Chrome CDP sidebar sync ( |
|
4. Google Search "AI Mode" & AI Overviews ( | When you click "Show more" on an AI Overview and "Ask anything" to continue chatting in AI Mode ( | Live Chrome CDP AI Mode sync ( |
|
5. Google AI Studio ( | Auto-saved as extensionless JSON files in | Direct folder/file import ( |
|
6. NotebookLM ( | NotebookLM notebooks, source summaries, and chat notes | Live Chrome sync ( |
|
7. Ask Maps, YouTube AI & Assistant | Logged under | Takeout |
|
MCP Tools Exposed to Google Antigravity & MCP Clients
MCP Tool Name | Parameters | What It Does |
|
| 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. |
|
| Retrieves the full multi-turn conversation transcript and local |
|
| Runs a fast SQLite FTS5 full-text search across all prompts and responses with highlighted snippets. |
|
| Lists locally synced/imported Google AI chats (optionally filtered by |
|
| Attaches to Chrome over CDP ( |
|
| Polls progress lines and final results for a background sync job started with |
|
| Imports a Google Takeout |
| (none) | Checks Python dependencies, Chrome/Edge path, and probes the SQLite |
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:
Google Chrome or Microsoft Edge installed locally (used via Playwright's
connect_over_cdpon127.0.0.1:9222for private URL fetching and browser syncing; note:playwright installis NOT needed because the tool uses your system Chrome/Edge rather than downloading bundled browsers).uv(Astral uv) and Python 3.11+ (3.11,3.12, or3.13).A Google Account signed into your Google AI surfaces (
gemini.google.com,myactivity.google.com,aistudio.google.com, etc.) — except when importing publicgemini.google.com/share/...links or offline Takeout files, which require no login.
Expected Process: Zero-Auth Share Links vs. First-Run Sign-In for Private Chats
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
batchexecuteRPC (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).
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-mcpmanages 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-mcplaunches 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-mcpautomatically 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.
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.
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.mdfor 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 | shVerify 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-groupsStep 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
Refresh the MCP Server Panel: After editing
mcp_config.jsonin 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."*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."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 Studiofolder and callimport_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_modeFrequently 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=85Automated 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) viagh 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/newwith a sanitized diagnostic summary. SeeAGENTS.mdfor the full agent reporting protocol.
Available Tools
6 toolsfetch_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
Scored across 6 tools
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.
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.
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.
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
Related MCP Connectors
Keeps your memory: WhatsApp, voice or any AI tool over MCP, Markdown you own, recall with sources
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Personal knowledge MCP: capture bookmarks, notes & todos by chat; archive pages; search memory.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSyncs AI conversations from multiple platforms to local Markdown files for your second brain, and provides browser automation tools via MCP for agentic workflows.AGPL 3.0
- AlicenseAqualityDmaintenanceMCP 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.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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
- AlicenseNot gradedqualityBmaintenanceExposes 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.3MIT