← Về thư mục
📄 / / root / ceo / integrations / notebooklm-mcp-cli / GEMINI.md

GEMINI.md

Project Overview

NotebookLM MCP Server & CLI

This project implements a Model Context Protocol (MCP) server and a full-featured Command Line Interface (CLI) that provides programmatic access to NotebookLM. It allows AI agents, developers, and power users to interact with NotebookLM notebooks, sources, query capabilities, and download generated artifacts (Audio, Video, PDF, etc.).

Tested with personal/free tier accounts. May work with Google Workspace accounts but has not been tested. This project relies on internal APIs (batchexecute RPCs).

Environment & Setup

The project uses uv for dependency management and tool installation.

Prerequisites

Installation

From PyPI (Recommended):

uv tool install notebooklm-mcp-cli
# or: pip install notebooklm-mcp-cli

From Source (Development):

git clone https://github.com/YOUR_USERNAME/notebooklm-mcp.git
cd notebooklm-mcp
uv tool install .

Authentication

Preferred: Run the automated authentication CLI:

nlm login

This launches Chrome, you log in, and cookies are extracted automatically. Your login is saved to a Chrome profile for future use.

Auto-refresh (v0.1.9+): The server now automatically handles token expiration: 1. Refreshes CSRF tokens on expiry (immediate) 2. Reloads cookies from disk if updated externally 3. Runs headless Chrome auth if profile has saved login

If headless auth fails (Google login fully expired), you'll see a message to run nlm login again.

Explicit refresh (MCP tool):

refresh_auth()  # Reload tokens from disk or run headless auth

Fallback: Manual extraction (if CLI fails) If the automated tool doesn't work, extract cookies via Chrome DevTools: 1. Open Chrome DevTools on notebooklm.google.com 2. Go to Network tab, find a batchexecute request 3. Copy the Cookie header and call save_auth_tokens(cookies=...)

Environment variable (advanced):

export NOTEBOOKLM_COOKIES="SID=xxx; HSID=xxx; SSID=xxx; ..."

Cookies last for weeks. The server auto-refreshes as long as Chrome profile login is valid.

Development Workflow

Building and Running

Reinstalling after changes: Because uv tool install installs into an isolated environment, you must reinstall to see changes during development.

uv cache clean
uv tool install --force .

Running the Server:

# Standard mode (stdio)
notebooklm-mcp

# Debug mode (verbose logging)
notebooklm-mcp --debug

# HTTP Server mode
notebooklm-mcp --transport http --port 8000

Testing

Run the test suite using pytest via uv:

# Run all tests
uv run pytest

# Run a specific test file
uv run pytest tests/test_api_client.py

Project Structure

Key Conventions

Recent Additions