notebooklm-mcp-2026
CLAUDE.md16 starsChanged 9 months agoMITView on GitHub
An MCP (Model Context Protocol) server that lets AI assistants query Google NotebookLM notebooks. Authenticates via Chrome CDP cookie extraction, communicates with Google's internal batchexecute RPC API, and exposes 9 tools over stdio JSON-RPC. Built with FastMCP, httpx, and Rich. All CLI subcommands support --debug for verbose logging. The setup command also supports --dry-run. 5-layer stack, each layer only calls the one below it: Data flow: MCP JSON-RPC → server.py dispatches → tool function → get_client() returns singleton → NotebookLMClient…
- Installs packages
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
All CLI subcommands support --debug for verbose logging.
- Very specific: line 56
All tool functions return {"status": "success"|"error", ...} dicts
- Very specific: line 57
All constants live in config.py — no other module hardcodes URLs, RPC IDs, headers, or timeouts
≈ “Common” is an estimate: at least 1 in 5 of the 28,029 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What This Project Is
An MCP (Model Context Protocol) server that lets AI assistants query Google NotebookLM notebooks. Authenticates via Chrome CDP cookie extraction, communicates with Google's internal batchexecute RPC API, and exposes 9 tools over stdio JSON-RPC. Built with FastMCP, httpx, and Rich.
Commands
# Install
pip install -e ".[dev]"
# Lint
ruff check src/ tests/
# Test
pytest -v --tb=short
pytest -k "not chrome" # skip Chrome-dependent tests
pytest tests/test_protocol.py -v # run one test file
pytest -k "test_build_rpc_body" # run one test by name
# Run
notebooklm-mcp-2026 serve # start MCP server (stdio)
notebooklm-mcp-2026 login # interactive Chrome login
notebooklm-mcp-2026 logout # remove stored credentials
notebooklm-mcp-2026 setup # interactive setup wizard
notebooklm-mcp-2026 doctor # diagnose common issues
notebooklm-mcp-2026 status # show auth + config status
notebooklm-mcp-2026 version # print version
notebooklm-mcp-2026 help # show help messageAll CLI subcommands support --debug for verbose logging. The setup command also supports --dry-run.
Architecture
5-layer stack, each layer only calls the one below it:
MCP Clients (Claude Desktop, etc.)
└─ server.py — FastMCP instance + global client singleton (get_client())
└─ tools/ — 9 tool functions: validate input → call client → return dict
└─ client.py — NotebookLMClient: HTTP requests, auth retry, backoff
└─ protocol.py — Pure functions: build RPC bodies, parse responses (zero I/O)
auth.py — Chrome CDP cookie extraction + secure disk storageData flow: MCP JSON-RPC → server.py dispatches → tool function → get_client() returns singleton → NotebookLMClient method → protocol.build_*() encodes request → httpx POST → protocol.parse_*() decodes → dict response back up the stack.
Key patterns:
server.get_client()lazy-initializes a singletonNotebookLMClientfrom disk-cached tokensprotocol.pyhas zero I/O — all encode/decode functions are pure and directly unit-testable- 2-layer auth recovery: CSRF refresh first, then full token reload from disk
- All tool functions return
{"status": "success"|"error", ...}dicts - All constants live in
config.py— no other module hardcodes URLs, RPC IDs, headers, or timeouts - CLI output goes to stderr (stdout reserved for MCP stdio transport)
Testing
conftest.pyprovides fixtures:sample_cookies,sample_batchexecute_response,sample_query_responsetest_tools.py— unit tests for all 9 MCP tool functions (mockserver.get_clientandauth.load_tokens)@pytest.mark.chrome— tests requiring Chrome, auto-skipped in CI@pytest.mark.integration— integration tests using FastMCP Clientasyncio_mode = "auto"— async tests just work without explicit markersprotocol.pytests need no mocking (pure functions)- Coverage:
pytest --cov=notebooklm_mcp_2026 --cov-report=term-missing
Code Conventions
- Python 3.11+,
from __future__ import annotationseverywhere - Ruff: line-length 100, target
py311 - Google-style docstrings (Args, Returns, Raises)
- Custom exceptions in
client.py:NotebookJulianError(base),AuthenticationError,APIError,ValidationError - Credentials stored at
platformdirs.user_data_dir("notebooklm-mcp-2026")/auth.jsonwith0o600permissions - Pre-commit hooks: ruff check + ruff format (
.pre-commit-config.yaml)
Environment Variables
NOTEBOOKLM_MCP_DATA_DIR— override storage directoryNOTEBOOKLM_BL— override Google build label when it rotatesNOTEBOOKLM_QUERY_TIMEOUT— override query timeout (default 120s)
CI
- GitHub Actions: runs on ubuntu, macos, windows × Python 3.11, 3.12, 3.13
- Ruff lint + pytest with coverage on every push/PR
- PyPI publish triggered by
v*tags via trusted publishing
Repo Structure
.github/FUNDING.yml— sponsor links (Buy Me a Coffee, Ko-fi).github/CODEOWNERS—@julianoczkowskias default reviewer.github/dependabot.yml— weekly dependency updates (pip + github-actions)CONTRIBUTING.md— contributor guideCODE_OF_CONDUCT.md— Contributor Covenant v2.1CHANGELOG.md— release historySECURITY.md— security policy + threat model.github/ISSUE_TEMPLATE/— bug report and feature request templatesexamples/— usage examples (basic_workflow.py, follow_up_conversation.py)
Skills (Slash Commands)
/release— lint, test, version bump, git tag, GitHub release, PyPI publish via CI/cleanup-branches— delete merged local + remote branches, prune stale refs/sync-docs— scan recent commits, update CLAUDE.md and CHANGELOG.md to match
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

