gemini-notebook-mcp-cli README

The project's README from github.com/jacob-bd/gemini-notebook-mcp-cli. As one markdown file: README.md.

Gemini Notebook (formerly Google NotebookLM) CLI & MCP Server

Gemini Notebook MCP Header

PyPI version PyPI downloads Total downloads Python License

Programmatic access to Gemini Notebook — via command-line interface (CLI) or Model Context Protocol (MCP) server.

Note: Personal/consumer accounts are tested regularly. Gemini Notebook Enterprise support is experimental. The documented notebook.cloud.google.com host has been live-verified with a project-qualified global deployment; other Enterprise host variants may require additional validation.

☕ If you find notebooklm-mcp-cli useful, consider buying me a coffee. It's free and built in my spare time — but testing every Gemini Notebook feature takes real time and resources. A coffee helps me cover it and keep shipping. Thank you! 🙏

Buy Me A Coffee

📺 Watch the Demos

Latest

Codex Setup + Cinematic Video & Slides
Latest

MCP Demos

General Overview Claude Desktop Perplexity Desktop MCP Super Assistant
General Claude Perplexity MCP SuperAssistant

CLI Demos

CLI Overview CLI, MCP & Skills Setup, Doctor & mcpb Infographics Support
CLI Overview CLI, MCP & Skills Setup, Doctor & mcpb Infographics

Two Ways to Use

🖥️ Command-Line Interface (CLI)

Use nlm directly in your terminal for scripting, automation, or interactive use:

nlm notebook list                              # List all notebooks
nlm notebook create "Research Project"         # Create a notebook
nlm source add <notebook> --url "https://..."  # Add sources
nlm audio create <notebook> --confirm          # Generate podcast
nlm download audio <notebook> --id <artifact-id>    # Download audio file
nlm download all <notebook> -d ./exports       # Download every artifact
nlm share public <notebook>                    # Enable public link

Run nlm --ai for comprehensive AI-assistant documentation.

🤖 MCP Server (for AI Agents)

Connect AI assistants (Claude, Gemini, Cursor, etc.) to Gemini Notebook:

# Automatic setup — picks the right config for each tool
nlm setup add claude-code
nlm setup add claude-desktop
nlm setup add gemini
nlm setup add github-copilot
nlm setup add cursor
nlm setup add cline
nlm setup add antigravity

# Generate JSON config for any other tool
nlm setup add json

Then use natural language: "Create a notebook about quantum computing and generate a podcast"

Features

Capability CLI Command MCP Tool
List notebooks nlm notebook list notebook_list
Create notebook nlm notebook create notebook_create
Add Sources (URL, Text, Drive, File) nlm source add source_add
Query notebook (persists to web UI) nlm notebook query notebook_query
List/view/export chat sessions nlm chats list/get/export chat_list/chat_get/chat_export
Create Studio Content (Audio, Video, etc.) nlm studio create studio_create
Revise slide decks nlm slides revise studio_revise
Download artifacts nlm download <type> download_artifact
Download all artifacts (one or all notebooks) nlm download all download_all_artifacts
Web/Drive research nlm research start research_start
Share notebook nlm share public/invite notebook_share_*
Sync Drive sources nlm source sync source_sync_drive
Batch operations nlm batch query/create/delete batch
Cross-notebook query nlm cross query cross_notebook_query
Pipelines (multi-step workflows) nlm pipeline run/list pipeline
Tag & smart select nlm tag add/list/select tag
Configure AI tools nlm setup add/remove/list —
Install AI Skills nlm skill install/update —
Diagnose issues nlm doctor —

📚 More Documentation:

Important Disclaimer

This MCP and CLI use internal APIs that:

Use at your own risk for personal/experimental purposes.

Installation

🆕 Claude Desktop users: Download the extension (.mcpb file) → double-click → done! One-click install, no config needed.

Install from PyPI. This single package includes both the CLI and MCP server:

uv tool install notebooklm-mcp-cli

Using uvx (Run Without Install)

uvx --from notebooklm-mcp-cli nlm --help
uvx --from notebooklm-mcp-cli notebooklm-mcp

Using pip

pip install notebooklm-mcp-cli

Using pipx

pipx install notebooklm-mcp-cli

After installation, you get:

Alternative: Install from Source
# Clone the repository
git clone https://github.com/jacob-bd/gemini-notebook-mcp-cli.git
cd notebooklm-mcp

# Install with uv
uv tool install .

Upgrading

# Using uv
uv tool upgrade notebooklm-mcp-cli

# Using pip
pip install --upgrade notebooklm-mcp-cli

# Using pipx
pipx upgrade notebooklm-mcp-cli

After upgrading, restart your AI tool to reconnect to the updated MCP server:

Upgrading from Legacy Versions

If you previously installed the separate CLI and MCP packages, you need to migrate to the unified package.

Step 1: Check What You Have Installed

uv tool list | grep notebooklm

Legacy packages to remove:

Package What it was
notebooklm-cli Old CLI-only package
notebooklm-mcp-server Old MCP-only package

Step 2: Uninstall Legacy Packages

# Remove old CLI package (if installed)
uv tool uninstall notebooklm-cli

# Remove old MCP package (if installed)
uv tool uninstall notebooklm-mcp-server

Step 3: Reinstall the Unified Package

After removing legacy packages, reinstall to fix symlinks:

uv tool install --force notebooklm-mcp-cli

Why --force? When multiple packages provide the same executable, uv can leave broken symlinks after uninstalling. The --force flag ensures clean symlinks.

Step 4: Verify Installation

uv tool list | grep notebooklm

You should see only:

notebooklm-mcp-cli v0.2.0
- nlm
- notebooklm-mcp

Step 5: Re-authenticate

Your existing cookies should still work, but if you encounter auth issues:

nlm login

Note: The configured MCP server name is now gemini-notebook-mcp. The executable remains notebooklm-mcp for compatibility with existing installations.

Getting Started

If you are setting up the tool for the first time — or migrating from a browser-based Gemini Notebook MCP — see the Getting Started Guide. It covers install, login, agent registration, and a step-by-step migration path that avoids the "two Gemini Notebook servers registered" trap.

Uninstalling

To completely remove the MCP:

# Using uv
uv tool uninstall notebooklm-mcp-cli

# Using pip
pip uninstall notebooklm-mcp-cli

# Using pipx
pipx uninstall notebooklm-mcp-cli

# Remove cached auth tokens and data (optional)
rm -rf ~/.notebooklm-mcp-cli

Also remove from your AI tools:

nlm setup remove claude-code
nlm setup remove cursor
# ... or any configured tool

Authentication

Before using the CLI or MCP, you need to authenticate with Gemini Notebook:

# Auto mode: launches your browser, you log in, cookies extracted automatically
nlm login

# Check if already authenticated
nlm login --check

# Use a named profile (for multiple Google accounts)
nlm login --profile work
nlm login --profile personal

# Manual mode: import cookies from a file
nlm login --manual --file cookies.txt

# External CDP provider (e.g., OpenClaw-managed browser)
nlm login --provider openclaw --cdp-url http://127.0.0.1:18800

Profile management:

nlm login --check                    # Show current auth status
nlm login switch <profile>           # Switch the default profile
nlm login profile list               # List all profiles with email addresses
nlm login profile delete <profile>   # Delete a profile
nlm login profile rename <old> <new> # Rename a profile

Unattended / scheduled refresh:

A live session self-heals — when Google's short-lived cookies age out, the client automatically runs a headless refresh. For unattended machines you can also refresh proactively from a scheduler so a session never lapses:

nlm auth refresh                     # Headless, no interaction; exits non-zero on failure
nlm auth refresh --profile work      # Refresh a named profile

Run it on a timer (cron/launchd). It needs a saved Chrome profile from a prior nlm login, and does not apply when NOTEBOOKLM_COOKIES is set as an environment variable (that value overrides saved credentials).

Enterprise Authentication (Gemini Notebook Enterprise)

For organizations using Gemini Notebook Enterprise via Google Cloud, ask your Enterprise administrator for the project ID or number, the deployment location/multi-region, and confirmation that your account has access. The current documented host is notebook.cloud.google.com; older deployments may use notebooklm.cloud.google.com or vertexaisearch.cloud.google.com.

  1. Set Base URL, GCP Project ID & Location:

    export NOTEBOOKLM_BASE_URL="https://notebook.cloud.google.com"
    # Required: your GCP project ID or project number from your administrator
    export NOTEBOOKLM_PROJECT_ID="your-gcp-project-id-or-number"
    # Optional: GCP location/multi-region from your administrator: global (default), us, or eu
    export NOTEBOOKLM_LOCATION="global"
    
  2. Save an Enterprise Auth Profile: This opens the configured Enterprise URL in an isolated browser profile. Sign in with your organization account:

    nlm login --profile enterprise
    nlm login switch enterprise
    

    You can switch back to a personal profile at any time:

    unset NOTEBOOKLM_BASE_URL NOTEBOOKLM_PROJECT_ID NOTEBOOKLM_LOCATION
    nlm login switch personal
    
  3. Configure MCP Server with Enterprise Environment Variables: When adding the MCP server to AI assistants (Claude, Cursor, etc.), pass NOTEBOOKLM_BASE_URL, NOTEBOOKLM_PROJECT_ID, and optionally NOTEBOOKLM_LOCATION:

    {
      "mcpServers": {
        "gemini-notebook-mcp": {
          "command": "notebooklm-mcp",
          "env": {
            "NOTEBOOKLM_BASE_URL": "https://notebook.cloud.google.com",
            "NOTEBOOKLM_PROJECT_ID": "your-gcp-project-id-or-number",
            "NOTEBOOKLM_LOCATION": "global"
          }
        }
      }
    }
    

Each profile gets its own isolated browser session, so you can be logged into multiple Google accounts simultaneously. Enterprise environment variables apply to the current process, so keep them in an Enterprise-only shell or MCP configuration when you also use a personal account.

Standalone Auth Tool

If you only need the MCP server (not the CLI):

nlm login              # Auto mode (launches browser)
nlm login --manual     # Manual file mode

How it works: Auto mode launches a dedicated browser profile (supports Chrome, Arc, Dia, Comet, Brave, Edge, Chromium, Firefox, and more), you log in to Google, and cookies are extracted automatically. Your login persists for future auth refreshes.

Prefer a specific browser? Set it with nlm config set auth.browser chromium (or comet, dia, brave, arc, edge, chrome, firefox, etc.). Falls back to auto-detection if the preferred named browser is not found. For any other Chromium-compatible browser, set its executable with nlm config set auth.browser_path /path/to/browser or NLM_BROWSER_PATH; an invalid explicit path fails closed instead of launching a different browser. When Chromium/CDP is unavailable, auto can fall back to Firefox.

For detailed instructions and troubleshooting, see docs/AUTHENTICATION.md.

MCP Configuration

⚠️ Context Window Warning: This MCP provides 43 tools. Disable it when not using Gemini Notebook to preserve context. In Claude Code: @gemini-notebook-mcp to toggle. To keep it on but expose only a subset, see Selective tool exposure.

Use nlm setup to automatically configure the MCP server for your AI tools — no manual JSON editing required:

# Add to any supported tool
nlm setup add claude-code
nlm setup add claude-desktop
nlm setup add claude-desktop --profile 3p  # Relay AI / Claude 3P
nlm setup add gemini
nlm setup add github-copilot
nlm setup add cursor
nlm setup add windsurf

# Generate JSON config for any other tool
nlm setup add json

# Check which tools are configured
nlm setup list

# Diagnose installation & auth issues
nlm doctor

Claude Desktop setup only writes to profiles that are detected as present. If both regular and Relay AI/3P profiles exist, the CLI asks whether to configure regular, 3P, or both. For scripts, use --profile regular|3p|both. If no Claude Desktop profile is detected, nothing is created or changed.

Removal uses the same profile selection, for example nlm setup remove claude-desktop --profile regular. Removal only offers detected profiles containing this MCP or a recognized legacy entry; unrelated MCP servers are left untouched.

Before adding or removing the MCP, fully quit the selected Claude Desktop profile. The CLI detects running regular and Relay AI/3P instances and refuses to write while they are open, because Claude may rewrite the config and discard the change. Reopen Claude Desktop after setup completes.

Install AI Skills (Optional)

Install the Gemini Notebook expert guide for your AI assistant to help it use the tools effectively. Supported for Cline, Antigravity, OpenClaw, Codex, OpenCode, Claude Code, and Gemini CLI.

# Install skill files
nlm skill install cline
nlm skill install openclaw
nlm skill install codex
nlm skill install antigravity

# Update skills
nlm skill u

gemini-notebook-mcp-cli (jacob-bd/gemini-notebook-mcp-cli)

Searching Database…

这是什么?这是一个命令行工具(CLI)和 MCP 服务器,可以通过程序访问 Google 的 Gemini Notebook(原名 NotebookLM)。你可以在终端里,或通过 Claude 等 AI 智能体,创建和查询笔记本、添加来源,并生成 Studio 内容,例如播客和视频。
这是命令行工具、MCP 服务器,还是两者都是?两者都是:'nlm' 命令可以单独作为命令行工具使用,同一个包还能运行 'notebooklm-mcp',这是一个 MCP 服务器,Claude、Cursor 或 Gemini CLI 等 AI 助手都可以连接它。
我该怎么安装和设置?用 uv、uvx、pip 或 pipx 从 PyPI 安装统一包,然后完成身份验证,让命令行工具能从浏览器配置文件中提取 Google 会话 Cookie;Claude Desktop 用户也可以直接下载 .mcpb 扩展,双击即可一键安装。
我需要专门的 API 密钥或登录流程吗?不需要单独的 API 密钥:你用现有的 Google 账号登录,工具会从真实浏览器(Chrome、Arc、Brave、Edge、Firefox 等)中提取会话 Cookie 来完成身份验证。
长期依赖它安全吗?它依赖 Gemini Notebook 内部未公开的 API,这些接口可能随时变更,所以功能可能会意外失效;而且企业版账号的支持仍处于实验阶段。
哪些 AI 工具真正能用 MCP 服务器?自动设置命令可以配置 Claude Desktop、Claude Code、Cursor 和 Gemini CLI;此外还可以为 Cline、Antigravity、OpenClaw、Codex 和 OpenCode 安装 AI Skills。
在笔记本里,我到底能创建什么?除了与来源对话,你还可以生成 Studio 内容,例如音频播客、视频、信息图和幻灯片,然后用一条命令下载生成的成果文件。
为什么 MCP 服务器会提醒上下文窗口的占用?它一次性暴露了 43 个 MCP 工具,会占用大量上下文,所以 README 建议在不主动使用 Gemini Notebook 时禁用该服务器,或只开放部分工具。
有没有办法运行更大的工作流,而不只是单条命令?有的,该工具支持批量操作、跨笔记本查询,以及多步骤流水线(nlm pipeline run/list),可以把一个或多个笔记本上的操作串联起来。
Creator
jacob-bd
Size
4.7 MB
Stars
6.3K
Age
9mo
Commits · 90 Days