agentleFS
jacob-bdjacob-bd/gemini-notebook-mcp-cli/AGENTS.md

gemini-notebook-mcp-cli

AGENTS.md6.2k starsChanged 2 months agoMITView on GitHub

This file provides guidance to Codex (Codex.ai/code) when working with code in this repository. Gemini Notebook (formerly Google NotebookLM) MCP Server & CLI - Provides programmatic access to Gemini Notebook (notebook.google.com) via both a Model Context Protocol server and a comprehensive command-line interface. Tested with personal/free tier accounts. May work with Google Workspace accounts but has not been tested. Python requirement: >=3.11 You only need to provide COOKIES! The CSRF token and session ID are now automatically extracted when needed.

Trending

More talk lately.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 2 mentionsSep 2026: 1 mentionOct 2026: 4 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the jacob-bd/gemini-notebook-mcp-cli repository that our weekly crawl found: only 7 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about jacob-bd/gemini-notebook-mcp-cli

The biggest 5 of 7 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 7

Talked about on GitHub (7 times).

On GitHub · 7

2 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

19 rules. About 1 is common, 10 are distinctive, and 8 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When API calls fail with auth errors, re-extract fresh cookies from Chrome DevTools.

    line 86
  2. Common:

    Safety rule for AI assistants: Never print decrypted credentials, cookies, or raw keystore values.

    line 143
  3. Very specific:

    All studio creation tools require confirm=True - show settings and get user approval first

    line 208
  4. Distinctive:

    Must match the current session

    line 226
  5. Distinctive:

    Verify you're logged into the correct account

    line 230
  6. Distinctive:

    Wait until the next day or upgrade to Plus

    line 234
  7. Distinctive:

    All discovered RPC endpoints and their parameters

    line 245
  8. Very specific:

    Only read API_REFERENCE.md when:

    line 252
  9. Distinctive:

    Use this test plan when:

    line 270
  10. Distinctive:

    When adding new features:

    line 277
  11. Distinctive:

    Use Chrome DevTools MCP to capture the network request

    line 279
  12. Very specific:

    Document the RPC ID in docs/API_REFERENCE.md

    line 280
  13. Distinctive:

    Add the param structure with comments

    line 281
  14. Very specific:

    Add the low-level API method in core/client.py

    line 282
  15. Very specific:

    Add business logic in the appropriate services/*.py module

    line 283
  16. Very specific:

    Add a thin wrapper in mcp/tools/*.py (for MCP) and cli/commands/*.py (for CLI)

    line 284
  17. Very specific:

    Write unit tests for the service function in tests/services/

    line 285
  18. Distinctive:

    Update the "Features NOT Yet Implemented" checklist

    line 286
  19. Very specific:

    Add test case to docs/MCP_TEST_PLAN.md

    line 287

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.

Project Overview

Gemini Notebook (formerly Google NotebookLM) MCP Server & CLI - Provides programmatic access to Gemini Notebook (notebook.google.com) via both a Model Context Protocol server and a comprehensive command-line interface.

Tested with personal/free tier accounts. May work with Google Workspace accounts but has not been tested.

Development Commands

# Install dependencies
uv tool install .

# Reinstall after code changes (ALWAYS clean cache first)
uv cache clean && uv tool install --force .

# Run the MCP server (stdio)
notebooklm-mcp

# Run with Debug logging
notebooklm-mcp --debug

# Run as HTTP server
notebooklm-mcp --transport http --port 8000

# Run tests
uv run pytest

# Run a single test
uv run pytest tests/test_file.py::test_function -v

Python requirement: >=3.11

Authentication (SIMPLIFIED!)

You only need to provide COOKIES! The CSRF token and session ID are now automatically extracted when needed.

Method 1: Chrome DevTools MCP (Recommended)

Option A - Fast (Recommended): Extract CSRF token and session ID directly from network request - no page fetch needed!

# 1. Navigate to NotebookLM page
navigate_page(url="https://notebook.google.com/")

# 2. Get a batchexecute request (any NotebookLM API call)
get_network_request(reqid=<any_batchexecute_request>)

# 3. Save with all three fields from the network request:
save_auth_tokens(
    cookies=<cookie_header>,
    request_body=<request_body>,  # Contains CSRF token
    request_url=<request_url>      # Contains session ID
)

Option B - Minimal (slower first call): Save only cookies, tokens extracted from page on first API call

save_auth_tokens(cookies=<cookie_header>)

Method 2: Environment Variables

VariableRequiredDescription
NOTEBOOKLM_COOKIESYesFull cookie header from Chrome DevTools
NOTEBOOKLM_CSRF_TOKENNo(DEPRECATED - auto-extracted)
NOTEBOOKLM_SESSION_IDNo(DEPRECATED - auto-extracted)
NOTEBOOKLM_BLNoOverride for build label / bl URL param (auto-extracted from page)
NOTEBOOKLM_HLNoInterface language and default artifact language (default: en)

Token Expiration

  • Cookies: Stable for weeks, but some rotate on each request
  • CSRF token: Auto-refreshed on each client initialization
  • Session ID: Auto-refreshed on each client initialization
  • Build label (bl): Auto-extracted during login and CSRF refresh; stays current with Google's build

When API calls fail with auth errors, re-extract fresh cookies from Chrome DevTools.

Architecture

src/notebooklm_tools/
├── __init__.py          # Package version
├── services/            # Shared service layer (v0.3.0+)
│   ├── errors.py        # ServiceError, ValidationError, NotFoundError, etc.
│   ├── chat.py          # Chat/query logic
│   ├── downloads.py     # Artifact downloading
│   ├── exports.py       # Google Docs/Sheets export
│   ├── notebooks.py     # Notebook CRUD + describe
│   ├── notes.py         # Note CRUD
│   ├── research.py      # Research start/poll/import
│   ├── sharing.py       # Public link, invite, status
│   ├── sources.py       # Source add/list/sync/delete
│   └── studio.py        # Artifact creation, status, rename, delete
├── cli/                 # CLI commands and formatting (thin wrapper)
├── mcp/                 # MCP server + tools (thin wrapper)
│   ├── server.py        # FastMCP server facade
│   └── tools/           # Modular tool definitions per domain
├── core/                # Low-level API client (no business logic)
│   ├── client.py        # Internal batchexecute API calls
│   ├── constants.py     # Code-name mappings (CodeMapper class)
│   └── auth.py          # AuthManager for profile-based token caching
└── utils/
    ├── config.py        # Configuration and storage paths
    └── cdp.py           # Chrome DevTools Protocol for cookie extraction

Layering Rules (v0.3.0+):

  • cli/ and mcp/ are thin wrappers: they handle UX concerns (prompts, spinners, JSON responses) and delegate to services/
  • services/ contains all business logic, validation, and error handling. Returns typed dicts.
  • cli/ and mcp/ must NOT import from core/ directly — always go through services/
  • services/ raises ServiceError/ValidationError — never raw exceptions

Storage Structure (~/.notebooklm-mcp-cli/):

├── config.toml                    # CLI settings (default_profile, output format)
├── aliases.json                   # Notebook aliases
├── installation.json              # Installation identity
├── locks/                         # Inter-process profile locks
├── operations/                    # Migration state & quarantine markers
├── profiles/<name>/
│   ├── metadata.json              # Non-secret metadata (email, host, storage mode)
│   ├── credentials.enc            # AES-256-GCM encrypted credentials (Protected mode)
│   └── cookies.json               # Plaintext cookies (File mode only)
├── auth.json                      # Root mirror of default profile (File mode only)
├── chrome-profile/                # Chrome session (single-profile/legacy)
└── chrome-profiles/<name>/        # Chrome sessions (multi-profile)

Credential Storage Modes:

  • Protected mode (recommended for personal computers): Credentials encrypted at rest (credentials.enc) with keys in OS keystore (macOS Keychain, Windows Credential Manager, Linux SecretService). Managed via nlm auth storage status, set protected|file, resolve, and relocate.
  • File mode (default / servers / cron / Docker): Plaintext cookies stored with 0600 permissions.
  • First login: for a NEW profile nlm login asks plain vs protected before the browser opens (only in a desktop terminal; --storage protected|file skips it). The marker is written right before the first save and rolled back if the save fails; the answer is recorded only after success.
  • Safety rule for AI assistants: Never print decrypted credentials, cookies, or raw keystore values. Output redacted diagnostics only.

Executables:

  • nlm - Command-line interface
  • notebooklm-mcp - The Gemini Notebook MCP server executable

Configured MCP name: gemini-notebook-mcp (the executable name remains notebooklm-mcp for compatibility). Claude Desktop setup detects regular and Relay AI/3P profiles, never creates missing profiles, and refuses to write while the selected Claude instance is running. User-level skill installation also requires the target tool to be detected. The nlm setup wizard flags entries still named notebooklm-mcp/notebooklm as "old name" and renames them on request. nlm skill package (cli/skill_package.py) builds the nlm-skill.zip upload file for Claude Desktop Chat/Cowork and claude.ai, which don't read local skill folders.

MCP Tools Provided

ToolPurpose
notebook_listList all notebooks
notebook_createCreate new notebook
notebook_getGet notebook details
notebook_describeGet AI-generated summary of notebook content with keywords
source_describeGet AI-generated summary and keyword chips for a source
source_get_contentGet raw text content from a source (no AI processing)
notebook_renameRename a notebook
chat_configureConfigure chat goal/style and response length
notebook_deleteDelete a notebook (REQUIRES confirmation)
source_addAdd source (url, text, drive, file)
notebook_queryAsk questions (AI answers!)
chat_listList chat sessions for a notebook
chat_getGet full transcript of a chat session (defaults to latest)
chat_exportExport a chat transcript to Markdown or JSON
chat_save_to_noteSave a chat (or one turn) as a Note
profileList saved accounts, show storage status, switch account for this MCP server (make_default=true also saves it as the default)
aliasManage notebook ID aliases; every tool's notebook_id accepts an alias
source_list_driveList sources with types, check Drive freshness
source_sync_driveSync stale Drive sources (REQUIRES confirmation)
source_renameRename a source in a notebook
source_deleteDelete a source from notebook (REQUIRES confirmation)
research_startStart Web or Drive research to discover sources
research_statusCheck research progress and get results
research_importImport discovered sources into notebook
studio_createGenerate unified content (audio, video, infographic, slides, etc.)
download_artifactDownload any artifact (audio, video, pdf, markdown, json)
export_artifactExport Data Tables to Google Sheets or Reports to Google Docs
studio_statusCheck studio artifact generation status
studio_deleteDelete studio artifacts (REQUIRES confirmation)
studio_reviseRevise slides in an existing slide deck (creates new artifact, REQUIRES confirmation)
reportInteractive report elements: action=get, elements (wait / review content), generate (plan; REQUIRES confirmation)
notebook_share_statusGet sharing settings and collaborators
notebook_share_publicEnable/disable public link access
notebook_share_inviteInvite collaborator by email
save_auth_tokensSave tokens extracted via Chrome DevTools MCP
refresh_authReload auth tokens or run headless auth
note_createCreate a note in a notebook
note_listList all notes in a notebook
note_updateUpdate a note's content or title
note_deleteDelete a note (REQUIRES confirmation)

IMPORTANT - Operations Requiring Confirmation:

  • notebook_delete requires confirm=True - deletion is IRREVERSIBLE
  • source_delete requires confirm=True - deletion is IRREVERSIBLE
  • source_sync_drive requires confirm=True - always show stale sources first via source_list_drive
  • All studio creation tools require confirm=True - show settings and get user approval first
  • studio_delete requires confirm=True - list artifacts first via studio_status, deletion is IRREVERSIBLE
  • studio_revise requires confirm=True - creates a new artifact with revisions applied
  • report(action="generate") requires confirm=True - starts Studio generation for the plan's elements (consumes AI usage)
  • note_delete requires confirm=True - deletion is IRREVERSIBLE

Features NOT Yet Implemented

None - all Gemini Notebook features that can be accessed programmatically are implemented.

Troubleshooting

"401 Unauthorized" or "403 Forbidden"

  • Cookies or CSRF token expired
  • Re-extract from Chrome DevTools

"Invalid CSRF token"

  • The at= value expired
  • Must match the current session

Empty notebook list

  • Session might be for a different Google account
  • Verify you're logged into the correct account

Rate limit errors

  • Free tier: ~50 queries/day
  • Wait until the next day or upgrade to Plus

Documentation

API Reference

For detailed API documentation (RPC IDs, parameter structures, response formats), see:

docs/API_REFERENCE.md

This includes:

  • All discovered RPC endpoints and their parameters
  • Source type structures (URL, text, Drive)
  • Studio content creation (audio, video, reports, etc.)
  • Research workflow details
  • Mind map generation process
  • Source metadata structures

Only read API_REFERENCE.md when:

  • Debugging API issues
  • Adding new features
  • Understanding internal API behavior

MCP Test Plan

For comprehensive MCP tool testing, see:

docs/MCP_CLI_TEST_PLAN.md

This includes:

  • Step-by-step test cases for all 53 MCP tools and CLI commands
  • Authentication and basic operations tests
  • Source management and Drive sync tests
  • Studio content generation tests (audio, video, infographics, etc.)
  • Quick copy-paste test prompts for validation

Use this test plan when:

  • Validating MCP server functionality after code changes
  • Testing new tool implementations
  • Debugging MCP tool issues

Contributing

When adding new features:

  1. Use Chrome DevTools MCP to capture the network request
  2. Document the RPC ID in docs/API_REFERENCE.md
  3. Add the param structure with comments
  4. Add the low-level API method in core/client.py
  5. Add business logic in the appropriate services/*.py module
  6. Add a thin wrapper in mcp/tools/*.py (for MCP) and cli/commands/*.py (for CLI)
  7. Write unit tests for the service function in tests/services/
  8. Update the "Features NOT Yet Implemented" checklist
  9. Add test case to docs/MCP_TEST_PLAN.md

License

MIT License

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.