Skip to main content
Glama
README.md
# Google Notebook MCP Gateway

<div align="center">

[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![CI](https://github.com/wdeldaybytebuster/google-notebook-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/wdeldaybytebuster/google-notebook-mcp/actions/workflows/ci.yml)
[![Wiki](https://img.shields.io/badge/docs-GitHub_Wiki-blueviolet.svg)](https://github.com/wdeldaybytebuster/google-notebook-mcp/wiki)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![MCP Protocol](https://img.shields.io/badge/Protocol-MCP-green.svg)](https://modelcontextprotocol.io)
[![Security](https://img.shields.io/badge/Security-Zero--Credential--Export-success.svg)](docs/security.md)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)

**A secure, zero-credential-export Model Context Protocol (MCP) gateway connecting AI coding agents to your private [Google Notebook](https://notebook.google.com) knowledge bases (formerly NotebookLM).**

[Quickstart](#quickstart) • [Wiki](https://github.com/wdeldaybytebuster/google-notebook-mcp/wiki) • [Supported Clients](#client-configuration) • [Tool Reference](#mcp-tool-reference) • [Documentation](docs/) • [Security Model](docs/security.md)

</div>

---

## Overview

**Google Notebook MCP** brings the grounded reasoning, multi-document synthesis, and citation capabilities of **Google NotebookLM** directly into your AI development workflow (**Claude Code, Cursor, Windsurf, Cline, Antigravity IDE, Zed**).

Unlike traditional API wrappers or unofficial scrapers that ask you to paste session cookies into configuration files, this gateway operates under a strict **Zero-Credential Export** architecture:
- All upstream Google requests execute **inside Google Chrome's native network process** via a Manifest V3 companion extension.
- Google session cookies (`SID`, `HSID`, `SSID`), CSRF tokens (`SNlM0e`), and hardware **Device Bound Session Credentials (DBSC)** never leave Chrome's native memory.
- Credentials are **never written to disk, never sent across local IPC sockets, and never visible to AI client prompt logs or transcripts**.

---

## Architecture

```mermaid
flowchart TD
    subgraph ClientLayer["AI Coding Assistant"]
        Client["Claude Code / Cursor / Windsurf / Cline"]
    end

    subgraph MCPGateway["MCP Gateway Layer"]
        Facade["MCP stdio Facade (cli.py mcp)"]
        Broker["Broker Daemon (Unix Socket / Named Pipe)"]
        Journal["SQLite WAL Mutation Journal"]
        Allowlist["Allowlist Authorization (allowlist.json)"]
        Scrubber["Zero-Leakage Secret Scrubber (secret_scrubber.py)"]
    end

    subgraph NativeBridge["Native Messaging Bridge"]
        NativeHost["Python Native Messaging Host (native_host.py)"]
    end

    subgraph BrowserLayer["Google Chrome (DBSC / TPM Containment)"]
        MV3["Companion Extension (MV3 Background Service Worker)"]
        ChromeNet["Chrome Native Network Stack (fetch credentials: 'include')"]
        NotebookLM["Google Notebook (notebook.google.com / notebooklm.google.com)"]
    end

    Client <-->|"JSON-RPC 2.0 (stdio)"| Facade
    Facade <-->|"Big-Endian Framed IPC"| Broker
    Broker <--> Journal
    Broker <--> Allowlist
    Broker <--> Scrubber
    Broker <-->|"Local Socket"| NativeHost
    NativeHost <-->|"Chrome stdio Framing (@I, <=512 KiB)"| MV3
    MV3 <-->|"Internal DOM fetch()"| ChromeNet
    ChromeNet <-->|"Authenticated TLS"| NotebookLM

    classDef secure fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    class BrowserLayer,Scrubber secure;
```

---

## Key Features

- **12 Production MCP Tools**: Grounded natural-language Q&A with Unicode citation spans, source cataloging, note creation/listing/deletion, binary file ingestion via Scotty, and studio artifact querying/metadata/extraction.
- **Self-Healing Wire Adapters & Upstream Drift Resilience**: Decoupled declarative wire specification (`wire_spec.v4.json`) with Ed25519 cryptographic signature verification, air-gapped User Vault isolation, dynamic DOM selector relay without extension reinstalls, and an automated 10-minute health window with atomic rollback to Last Known Good (LKG).
- **MCP 2025/2026 Protocol Standardization**: First-class MCP resources (`notebooklm://`), parameter-validated prompt templates (`prompts/*`), live progress notifications (`notifications/progress`), and standardized behavioral tool annotations (`readOnlyHint`, `idempotentHint`).
- **ADR-011 Interactive Session Lock**: Enforces single-notebook locking per session, preventing accidental cross-notebook queries or modifications.
- **Project Directory Binding (`.notebook_mcp.json`)**: Seamlessly binds local workspaces to their designated NotebookLM notebook with an interactive in-chat confirmation handshake.
- **Scotty 3-Step Resumable Uploads**: Upload PDFs, Markdown, Word documents, and text files directly into NotebookLM with automatic offset resumption and $\le 512\text{ KiB}$ IPC slicing.
- **Conservative Mutation Journaling**: SQLite WAL state machine guarantees zero duplicate writes and freezes ambiguous requests upon network disconnection.
- **Cross-Platform**: Built-in support for **Linux**, **macOS**, and **Windows** (including Windows Named Pipes and automatic path length bounds).

---

## Quickstart

### 🚀 Zero-Friction Automated Onboarding (Recommended)

Run the autonomous onboarding orchestrator directly from the repository root:

```bash
git clone https://github.com/wdeldaybytebuster/google-notebook-mcp.git
cd google-notebook-mcp

# 1. Install dependencies (pip or uv)
pip install -e .
# or: uv sync

# 2. Run the 6-stage autonomous onboarding wizard
python3 install_and_onboard.py

# Or via the CLI if installed:
gemini-notebook-mcp onboard
```

The orchestrator automatically:
1. Detects your compatible Chromium browser (bypassing ChromeOS Garcon bridges and configuring Wayland flags).
2. Registers the Chrome Native Messaging Host manifests across global and profile scopes.
3. Pre-seeds Developer mode and launches Chrome directly at `chrome://extensions`.
4. Injects or guides 1-click loading of the companion extension (with clipboard path assist) and verifies `service_worker.js`.
5. Navigates automatically to `notebook.google.com` with the companion extension already active.
6. Discovers all your notebooks and interactively seeds `allowlist.json` and `.notebook_mcp.json`.

---

### Manual Step-by-Step Setup

#### 1. Install

```bash
git clone https://github.com/wdeldaybytebuster/google-notebook-mcp.git
cd google-notebook-mcp

# Using pip:
pip install -e .

# Or using uv:
uv sync
```

#### 2. Register Chrome Native Messaging Host

Automatically registers the gateway bridge with Chrome:

```bash
gemini-notebook-mcp install
```

#### 3. Load Companion Extension in Chrome

1. Open Chrome and navigate to `chrome://extensions`.
2. Enable **Developer mode** (toggle in the top-right).
3. Click **Load unpacked** and select the `src/extension/` directory from this repository.
4. Copy the generated **Extension ID** (e.g., `abcdefghijklmnop...`) — or open the extension popup's **Setup Mode** banner — and run:
   ```bash
   python3 setup_native_host.py --extension-id <COPIED_EXTENSION_ID>
   # or: gemini-notebook-mcp install --extension-id <COPIED_EXTENSION_ID>
   ```

#### 4. Launch Gateway & Dedicated Browser

```bash
gemini-notebook-mcp launch
```

#### 5. Authorize Your Notebooks

Run the interactive allowlist wizard to choose which notebooks your AI agents can access:

```bash
gemini-notebook-mcp allowlist seed
```

---

## Client Configuration

Add the gateway to your favorite AI coding environment:

### Claude Desktop (`claude_desktop_config.json`)
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux:** `~/.config/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "gemini-notebook": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/google-notebook-mcp",
        "run",
        "gemini-notebook-mcp",
        "mcp"
      ],
      "env": {
        "UV_THREADPOOL_SIZE": "3"
      }
    }
  }
}
```
*(If installed globally or in an active environment, you can replace the command with `"python3"` and args with `["-m", "mcp_gateway.cli", "mcp"]`)*.

### Claude Code
Run in your terminal:
```bash
claude mcp add gemini-notebook -- python3 -m mcp_gateway.cli mcp
```
Or with `uv`:
```bash
claude mcp add gemini-notebook uv -- --directory /ABSOLUTE/PATH/TO/google-notebook-mcp run gemini-notebook-mcp mcp
```

### Cursor (`.cursor/mcp.json` or Global Settings)
```json
{
  "mcpServers": {
    "gemini-notebook": {
      "command": "python3",
      "args": ["-m", "mcp_gateway.cli", "mcp"],
      "env": {
        "UV_THREADPOOL_SIZE": "3"
      }
    }
  }
}
```

### Windsurf (`~/.codeium/windsurf/mcp_config.json`)
```json
{
  "mcpServers": {
    "gemini-notebook": {
      "command": "python3",
      "args": ["-m", "mcp_gateway.cli", "mcp"],
      "env": {
        "UV_THREADPOOL_SIZE": "3"
      }
    }
  }
}
```

> **Note on `MCP_BROKER_SOCKET`:** By default, both the broker daemon and MCP client automatically resolve the secure platform IPC path via `get_default_ipc_path()` (`$XDG_RUNTIME_DIR/notebooklm-mcp/broker.sock` or `~/.config/notebooklm-mcp-bridge/broker.sock` on Linux, `~/Library/Application Support/notebooklm-mcp/broker.sock` on macOS, and `\\.\pipe\notebooklm-mcp-broker` on Windows). Set `MCP_BROKER_SOCKET` in `env` only when overriding the socket path on both the broker and client.

### Cline / Roo Code (`cline_mcp_settings.json`)
```json
{
  "mcpServers": {
    "gemini-notebook": {
      "command": "python3",
      "args": ["-m", "mcp_gateway.cli", "mcp"],
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

*For detailed instructions on other clients (Zed, Antigravity IDE, Neovim), see the [Client Configuration Guide](docs/client-configuration.md).*

---

## MCP Tool Reference

| Tool | Type | Key Inputs | Description |
| :--- | :--- | :--- | :--- |
| `select_notebook` | Session | `notebook_id` or `title`, `save_for_project` | Locks session to a single notebook and binds local project config. |
| `list_notebooks` | Read | `page_size`, `cursor` | Lists allowlisted notebooks and returns active project binding status. |
| `get_notebook_metadata` | Read | `notebook_id` (auto-bound) | Fetches full metadata, source counts, and timestamps. |
| `list_sources` | Read | `page_size`, `cursor` | Extracts ingested sources and readiness states (`PROCESSING`, `READY`, `FAILED`). |
| `query_notebook` | Q&A | `question`, `request_key`, `source_ids` | Streams grounded Q&A with normalized Unicode citation offsets. |
| `add_source` | Write | `source`, `idempotency_key`, `wait_until_ready` | Ingests URLs, Google Drive files, pasted text, or local binary documents. |
| `create_note` | Write | `title`, `content`, `idempotency_key` | Creates a new user note journaled in SQLite. |
| `list_notes` | Read | `page_size`, `cursor` | Returns user notes with upstream schema anomaly detection. |
| `delete_note` | Write | `note_id`, `idempotency_key` | Deletes a user note by ID with pre-flight identity assertion. |
| `list_artifacts` | Read | `artifact_type`, `page_size`, `cursor` | Lists generated studio artifacts (audio overviews, study guides, mind maps, briefings). |
| `get_artifact_metadata` | Read | `artifact_id` | Fetches generation parameters, readiness state, duration, and download URI. |
| `extract_artifact` | Write/Export | `artifact_id`, `destination_path` | Streams artifact to tmpfs/disk in $\le 512\text{ KiB}$ chunks returning `FILE_PATH`. |

### MCP 2025/2026 Protocol Capabilities

In addition to tools, the gateway natively implements the modern MCP standard:
- **Resources (`resources/*`)**: Browse notebook contents using standard URIs: `notebooklm://notebooks/{nb_id}/{metadata|sources|notes|artifacts}[/{item_id}]`. Protected by Invariant 3 Universal Security Interceptor Gate.
- **Prompts (`prompts/*`)**: Ready-to-use prompt templates (`synthesize_sources`, `generate_study_guide`, `extract_action_items`, `adversarial_audit`) for AI coding agents.
- **Progress Notifications (`notifications/progress`)**: Out-of-band progress tracking for Scotty byte streaming and readiness polling.
- **Logging (`logging/setLevel`)**: Client-controllable diagnostic logging without stdio frame pollution.

*Full schema parameters and error envelopes are documented in the [Tools Reference](docs/tools-reference.md).*

---

## Project-Level Notebook Binding

When working inside a project repository, the gateway can automatically remember which NotebookLM knowledge base belongs to that project:

1. When calling `select_notebook`, setting `save_for_project: true` (the default) creates `.notebook_mcp.json` in your project root.
2. At the start of a chat, the AI assistant calls `list_notebooks`, discovers your project setting, and performs a conversational handshake:
   > *"This project is configured to use notebook **'Project Docs'**. Would you like to use this notebook, or select another from your allowlist?"*
3. Once confirmed, your session is locked and protected against accidental cross-notebook tampering.

---

## Packaged Agent Skills Ecosystem

The repository packages four production agent skills adhering to the Anthropic and OpenClaw specification:

| Skill | Trigger / Description |
| :--- | :--- |
| **`notebooklm-research-expert`** | Grounded technical research, multi-source cross-examination, and coordinate-normalized Unicode citation verification. Enforces Mitigation M-06 grounding barrier. |
| **`studio-artifact-harvester`** | Non-blocking discovery, asynchronous generation monitoring, and zero-OOM tmpfs binary streaming ($\le 512\text{ KiB}$) for Audio Overviews, Video Overviews, and Reports. |
| **`notebook-session-guard`** | Enforces ADR-011 single-notebook session lock lifecycle, project workspace binding (`.notebook_mcp.json`), and granular RBAC allowlists (`READ_ONLY` vs `INTERACTIVE`). |
| **`adversarial-consultation-planner`** | Closed-loop consultation planning with live models, spec-vs-plan decoupling, 5-domain adversarial red-team stress-testing, and remediation invariant synthesis. |

*Detailed skill instructions and state schemas are available in [docs/agent-skills.md](docs/agent-skills.md).*

---

## Self-Healing Wire Adapters & Upstream Drift Resilience

Google NotebookLM is an evolving web application that periodically updates internal RPC IDs, payload structures, DOM global property names, and batchexecute array layouts. The gateway incorporates a zero-friction, cryptographic self-healing engine to adapt automatically without requiring manual code changes or user intervention:

1. **Decoupled Wire Specification (`wire_spec.v4.json`)**: All volatile RPC IDs (`wXbhsf`, `rLM1Ne`, `CYK0Xb`, `tGMBJ`, `o4cbdc`, `izAoDd`, `GenerateFreeFormStreamed`), row array indices, endpoints, and DOM selector keys are defined declaratively outside compiled code.
2. **Cryptographic Ed25519 Pre-Validation**: Dynamic updates are cryptographically signed. The gateway verifies detached signatures strictly on raw un-parsed bytes using a pinned 32-byte Ed25519 public key before decoding JSON.
3. **Air-Gapped Vault Isolation**: The User Vault (`~/.config/notebooklm-mcp-bridge/`) containing `allowlist.json`, `.notebook_mcp.json`, and `journal.db` is strictly read-only to the update engine. All adapter files live in isolated Dynamic Adapter Storage (`~/.local/share/notebooklm-mcp-bridge/adapters/`).
4. **Dynamic DOM Relay Protocol**: Property paths and CSRF identifiers are relayed dynamically to the Chrome extension companion, allowing DOM target evolution without requiring Chrome Web Store extension updates.
5. **Atomic LKG Rollback & 10-Minute Health Window**: Every new candidate spec must pass synthetic canary parsing before activation. Once promoted, a 10-minute active health monitor tracks live request status; if 3 consecutive RPC failures or schema drift errors occur, the gateway automatically quarantines the spec hash and triggers an atomic rollback to Last Known Good (LKG) or the package-bundled static default.

---

## Documentation

- **[GitHub Wiki](https://github.com/wdeldaybytebuster/google-notebook-mcp/wiki)**: Comprehensive online wiki with interactive quickstarts, client guides, and FAQs.
- **[Getting Started Guide](docs/getting-started.md)**: Full walkthrough for Linux, macOS, and Windows.
- **[Client Configuration](docs/client-configuration.md)**: Setup guides for all major AI coding agents.
- **[Agent Skills Ecosystem](docs/agent-skills.md)**: Complete guide to the packaged skills for Claude Code, Cursor, Windsurf, and OpenClaw.
- **[Tools Reference](docs/tools-reference.md)**: Complete parameter reference, types, and error envelopes.
- **[Troubleshooting & FAQs](docs/troubleshooting.md)**: Diagnosing native messaging, permissions, and platform quirks.
- **[Security Architecture](docs/security.md)**: Deep dive into TPM/DBSC containment and secret scrubbing.
- **[Architecture Decision Records](docs/architecture.md)**: The 17 core architectural invariants (ADR-001 through ADR-017).
- **[GitHub Launch Completion Report](docs/github-launch-completion-report.md)**: Full project ledger and security audit from the public repository launch.

---

## Contributing

Contributions, bug reports, and suggestions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) before opening a pull request.

---

## Security Vulnerability Reporting

If you discover a potential security vulnerability, please refer to our [Security Policy](SECURITY.md) to report it responsibly.

---

## License

This project is licensed under the **Apache License 2.0**. See the [LICENSE](LICENSE) file for details.

TDQS

B3.2/5.0

Scored across 12 tools

Disambiguation4/5

Each tool targets a clear resource+action pair (notebooks, sources, notes, artifacts), and query_notebook vs create_note/add_source are well separated. Minor potential confusion between get_notebook_metadata and list_notebooks, and between get_artifact_metadata and extract_artifact, but the descriptions disambiguate them adequately.

Naming Consistency5/5

All twelve tools follow a uniform snake_case verb_noun pattern (list_notebooks, select_notebook, add_source, create_note, delete_note, extract_artifact, etc.). No mixed conventions or vague standalone verbs.

Tool Count5/5

12 tools is squarely in the well-scoped range for a multi-resource server (notebooks, sources, notes, artifacts). Each tool maps to a distinct operation rather than redundant variants.

Completeness3/5

Notes support create/list/delete but there is no read-single-note or update_note, and sources support list/add but no remove_source, leaving removal and update workflows as dead ends. Notebook creation/deletion being absent is defensible for a read-mostly client, but the missing source-delete and note-read/update operations are notable gaps.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues