Skip to main content
Glama

NotebookLM MCP Server

讓您的 CLI 代理 (Claude, Cursor, Codex...) 直接與 NotebookLM 對話,根據您的筆記本獲得零幻覺的答案

TypeScript MCP npm Claude Code Skill GitHub

安裝 • 快速開始 • 為什麼選擇-notebooklm • 範例 • 文件


注意:本專案 fork 自 PleasePrompto/notebooklm-mcp.git,此版本為修改版。


問題

當您告訴 Claude Code 或 Cursor「搜尋我的本地文件」時,會發生以下情況:

  • 大量 Token 消耗:搜尋文件意味著重複讀取多個檔案

  • 檢索不準確:關鍵字搜尋會錯過文件之間的上下文和關聯

  • 幻覺:當它找不到東西時,它會編造聽起來合理的 API

  • 昂貴且緩慢:每個問題都需要重新讀取多個檔案

Related MCP server: notebooklm-claude-integration

解決方案

讓您的本地代理直接與 NotebookLM 對話 — Google 的 零幻覺知識庫,由 Gemini 2.5 提供支援,可從您的文件中提供智慧、綜合的答案。

您的任務 → 本地代理詢問 NotebookLM → Gemini 綜合答案 → 代理編寫正確的程式碼

真正的優勢:不再需要在 NotebookLM 和您的編輯器之間手動複製貼上。您的代理直接詢問 NotebookLM 並在 CLI 中直接獲得答案。它可以通過自動追問建立深刻的理解 — Claude 會按順序詢問多個問題,每個問題都建立在上一個問題的基礎上,獲取具體的實作細節、邊緣情況和最佳實踐。您可以將 NotebookLM 連結儲存到帶有標籤和描述的本地庫中,Claude 會根據您當前的任務自動選擇相關的筆記本。


為什麼選擇 NotebookLM 而不是本地 RAG?

方法

Token 成本

設定時間

幻覺

答案品質

將文件餵給 Claude

🔴 非常高 (多次讀取檔案)

即時

有 - 會填補空白

檢索變數

網路搜尋

🟡 中等

即時

高 - 來源不可靠

時好時壞

本地 RAG

🟡 中-高

數小時 (嵌入, 切塊)

中 - 檢索缺漏

取決於設定

NotebookLM MCP

🟢 極低

5 分鐘

零 - 未知則拒絕

專家級綜合

NotebookLM 有何過人之處?

  1. 由 Gemini 預處理:上傳文件一次,即可獲得即時的專家知識

  2. 自然語言問答:不僅僅是檢索 — 而是真正的理解和綜合

  3. 多來源關聯:連接 50 多個文件中的資訊

  4. 引用支援:每個答案都包含來源引用

  5. 無基礎設施:無需向量資料庫、嵌入或切塊策略


安裝

Claude Code

claude mcp add notebooklm npx notebooklm-mcp-zh@latest

Cursor

新增至 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "notebooklm": {
      "command": "npx",
      "args": ["-y", "notebooklm-mcp-zh@latest"]
    }
  }
}

快速開始

1. 安裝 MCP 伺服器 (見上方 安裝)

2. 驗證 (一次性)

在您的聊天 (Claude/Cursor) 中說:

"Log me in to NotebookLM" (登入 NotebookLM)

Chrome 視窗將開啟 → 使用 Google 登入

3. 建立您的知識庫

前往 notebooklm.google.com → 建立筆記本 → 上傳您的文件:

  • 📄 PDF, Google Docs, markdown 檔案

  • 🔗 網站, GitHub 儲存庫

  • 🎥 YouTube 影片

  • 📚 每個筆記本支援多個來源

分享:⚙️ Share (分享) → Anyone with link (任何擁有連結的人) → Copy (複製)

4. 讓 Claude 使用它

"I'm building with [library]. Here's my NotebookLM: [link]"
(我正在使用 [library] 進行開發。這是我的 NotebookLM:[連結])

就這樣。 Claude 現在會詢問 NotebookLM 它需要的任何資訊,在編寫程式碼之前建立專業知識。


真實案例

建立 n8n 工作流程而不產生幻覺

挑戰:n8n 的 API 很新 — Claude 經常對節點名稱和功能產生幻覺。

解決方案:

  1. 下載完整的 n8n 文件 → 合併成易於管理的區塊

  2. 上傳到 NotebookLM

  3. 告訴 Claude:"幫我建立一個 Gmail 垃圾郵件過濾工作流程。使用這個 NotebookLM:[連結]"

結果:第一次嘗試就獲得完美的工作流程。無需除錯幻覺產生的 API。


核心功能

零幻覺

如果資訊不在您的文件中,NotebookLM 會拒絕回答。不會有發明的 API。

自主研究

Claude 會自動詢問後續問題,在編碼前建立完整的理解。

智慧庫管理

使用標籤和描述儲存 NotebookLM 連結。Claude 會為您的任務自動選擇正確的筆記本。

"Add [link] to library tagged 'frontend, react, components'"

跨工具共享

設定一次,隨處使用。Claude Code, Codex, Cursor — 均共享同一個庫。

深度清理工具

隨時重新開始。掃描整個系統的 NotebookLM 資料並提供分類預覽。


工具設定檔 (Tool Profiles)

透過僅載入您需要的工具來減少 Token 使用量。

設定檔

工具數量

用途

minimal

5

僅查詢:ask_question, get_health, list_notebooks, select_notebook, get_notebook

standard

10

+ 庫管理:setup_auth, list_sessions, add_notebook, update_notebook, search_notebooks

full

16

所有工具,包含 cleanup_data, re_auth 等

設定方式:

npx notebooklm-mcp-zh config set profile minimal

常見指令

意圖

指令 (範例)

結果

驗證

"Log me in to NotebookLM"

開啟 Chrome 登入

新增筆記本

"Add [link] to library"

儲存筆記本與中繼資料

列出筆記本

"Show our notebooks"

列出所有儲存的筆記本

先行研究

"Research this in NotebookLM before coding"

多問題會話

選擇筆記本

"Use the React notebook"

設定當前活動筆記本


免責聲明

此工具自動化與 NotebookLM 的瀏覽器互動。

關於瀏覽器自動化: 雖然我已經加入了擬人化功能(真實的打字速度、自然延遲、滑鼠移動)以使自動化行為更自然,但我不能保證 Google 不會檢測或標記自動化使用。建議使用專用的 Google 帳戶進行自動化,而不是您的主要帳戶。

關於 CLI 工具和 AI 代理: 請謹慎使用:

  • 在提交或部署之前務必審查變更

  • 先在安全環境中測試

  • 備份重要工作


貢獻

發現錯誤?有功能想法?歡迎在 GitHub 上提交 issue 或 PR!

授權

MIT — 可在您的專案中自由使用。

Available Tools

16 tools
add_notebookA

PERMISSION REQUIRED — Only when user explicitly asks to add a notebook.

Conversation Workflow (Mandatory)

When the user says: "I have a NotebookLM with X"

  1. Ask URL: "What is the NotebookLM URL?"

  2. Ask content: "What knowledge is inside?" (1–2 sentences)

  3. Ask topics: "Which topics does it cover?" (3–5)

  4. Ask use cases: "When should we consult it?"

  5. Propose metadata and confirm:

    • Name: [suggested]

    • Description: [from user]

    • Topics: [list]

    • Use cases: [list] "Add it to your library now?"

  6. Only after explicit "Yes" → call this tool

Rules

  • Do not add without user permission

  • Do not guess metadata — ask concisely

  • Confirm summary before calling the tool

Example

User: "I have a notebook with n8n docs" You: Ask URL → content → topics → use cases; propose summary User: "Yes" You: Call add_notebook

Visit https://notebooklm.google/ → Login (free: 100 notebooks, 50 sources each, 500k words, 50 daily queries)

  1. Click "+ New" (top right) → Upload sources (docs, knowledge)

  2. Click "Share" (top right) → Select "Anyone with the link"

  3. Click "Copy link" (bottom left) → Give this link to Claude

(Upgraded: Google AI Pro/Ultra gives 5x higher limits)

Inputs: url (required), name (required), description (required), topics (required), +3 more.

ask_questionC

Conversational Research Partner (NotebookLM • Gemini 2.5 • Session RAG)

No Active Notebook

  • Visit https://notebooklm.google to create a notebook and get a share link

  • Use add_notebook to add it to your library (explains how to get the link)

  • Use list_notebooks to show available sources

  • Use select_notebook to set one active

Auth tip: If login is required, use the prompt 'notebooklm.auth-setup' and then verify with the 'get_health' tool. If authentication later fails (e.g., expired cookies), use the prompt 'notebooklm.auth-repair'.

Tip: Tell the user you can manage NotebookLM library and ask which notebook to use for the current task.

Inputs: question (required), session_id, notebook_id, notebook_url, +2 more.

cleanup_dataA

ULTRATHINK Deep Cleanup - Scans entire system for ALL NotebookLM MCP data files across 8 categories. Always runs in deep mode, shows categorized preview before deletion.

⚠️ CRITICAL: Close ALL Chrome/Chromium instances BEFORE running this tool! Open browsers can prevent cleanup and cause issues.

Categories scanned:

  1. Legacy Installation (notebooklm-mcp-nodejs) - Old paths with -nodejs suffix

  2. Current Installation (notebooklm-mcp) - Active data, browser profiles, library

  3. NPM/NPX Cache - Cached installations from npx

  4. Claude CLI MCP Logs - MCP server logs from Claude CLI

  5. Temporary Backups - Backup directories in system temp

  6. Claude Projects Cache - Project-specific cache (optional)

  7. Editor Logs (Cursor/VSCode) - MCP logs from code editors (optional)

  8. Trash Files - Deleted notebooklm files in system trash (optional)

Works cross-platform (Linux, Windows, macOS). Safe by design: shows detailed preview before deletion, requires explicit confirmation.

LIBRARY PRESERVATION: Set preserve_library=true to keep your notebook library.json file while cleaning everything else.

RECOMMENDED WORKFLOW for fresh start:

  1. Ask user to close ALL Chrome/Chromium instances

  2. Run cleanup_data(confirm=false, preserve_library=true) to preview

  3. Run cleanup_data(confirm=true, preserve_library=true) to execute

  4. Run setup_auth or re_auth for fresh browser session

Use cases: Clean reinstall, troubleshooting auth issues, removing all traces before uninstall, cleaning old browser sessions and installation data.

Inputs: confirm (required), preserve_library.

close_sessionA

Close a specific session by session ID. Ask before closing if the user might still need it.

Inputs: session_id (required).

get_healthA

Get server health status including authentication state, active sessions, and configuration. Use this to verify the server is ready before starting research workflows.

If authenticated=false and having persistent issues: Consider running cleanup_data(preserve_library=true) + setup_auth for fresh start with clean browser session.

Inputs: no named parameters.

get_library_statsA

Get statistics about your notebook library (total notebooks, usage, etc.)

Inputs: no named parameters.

get_notebookA

Get detailed information about a specific notebook by ID

Inputs: id (required).

list_notebooksA

List all library notebooks with metadata (name, topics, use cases, URL). Use this to present options, then ask which notebook to use for the task.

Inputs: no named parameters.

list_sessionsA

List all active sessions with stats (age, message count, last activity). Use to continue the most relevant session instead of starting from scratch.

Inputs: no named parameters.

re_authA

Switch to a different Google account or re-authenticate. Use this when:

  • NotebookLM rate limit is reached (50 queries/day for free accounts)

  • You want to switch to a different Google account

  • Authentication is broken and needs a fresh start

This will:

  1. Close all active browser sessions

  2. Delete all saved authentication data (cookies, Chrome profile)

  3. Open browser for fresh Google login

After completion, use 'get_health' to verify authentication.

TROUBLESHOOTING for persistent auth issues: If re_auth fails repeatedly:

  1. Ask user to close ALL Chrome/Chromium instances

  2. Run cleanup_data(confirm=false, preserve_library=true) to preview old files

  3. Run cleanup_data(confirm=true, preserve_library=true) to clean everything except library

  4. Run re_auth again for completely fresh start This removes old installation data and browser sessions that can cause conflicts.

Inputs: show_browser, browser_options.

remove_notebookA

Dangerous — requires explicit user confirmation.

Confirmation Workflow

  1. User requests removal ("Remove the React notebook")

  2. Look up full name to confirm

  3. Ask: "Remove '[notebook_name]' from your library? (Does not delete the actual NotebookLM notebook)"

  4. Only on explicit "Yes" → call remove_notebook

Never remove without permission or based on assumptions.

Example: User: "Delete the old React notebook" You: "Remove 'React Best Practices' from your library?" User: "Yes" → call remove_notebook

Inputs: id (required).

reset_sessionA

Reset a session's chat history (keep same session ID). Use for a clean slate when the task changes; ask the user before resetting.

Inputs: session_id (required).

search_notebooksA

Search library by query (name, description, topics, tags). Use to propose relevant notebooks for the task and then ask which to use.

Inputs: query (required).

select_notebookA

Set a notebook as the active default (used when ask_question has no notebook_id).

When To Use

  • User switches context: "Let's work on React now"

  • User asks explicitly to activate a notebook

  • Obvious task change requires another notebook

Auto-Switching

  • Safe to auto-switch if the context is clear and you announce it: "Switching to React notebook for this task..."

  • If ambiguous, ask: "Switch to [notebook] for this task?"

Example

User: "Now let's build the React frontend" You: "Switching to React notebook..." (call select_notebook)

Inputs: id (required).

setup_authA

Google authentication for NotebookLM access - opens a browser window for manual login to your Google account. Returns immediately after opening the browser. You have up to 10 minutes to complete the login. Use 'get_health' tool afterwards to verify authentication was saved successfully. Use this for first-time authentication or when auto-login credentials are not available. For switching accounts or rate-limit workarounds, use 're_auth' tool instead.

TROUBLESHOOTING for persistent auth issues: If setup_auth fails or you encounter browser/session issues:

  1. Ask user to close ALL Chrome/Chromium instances

  2. Run cleanup_data(confirm=true, preserve_library=true) to clean old data

  3. Run setup_auth again for fresh start This helps resolve conflicts from old browser sessions and installation data.

Inputs: show_browser, browser_options.

update_notebookA

Update notebook metadata based on user intent.

Pattern

  1. Identify target notebook and fields (topics, description, use_cases, tags, url)

  2. Propose the exact change back to the user

  3. After explicit confirmation, call this tool

Examples

  • User: "React notebook also covers Next.js 14" You: "Add 'Next.js 14' to topics for React?" User: "Yes" → call update_notebook

  • User: "Include error handling in n8n description" You: "Update the n8n description to mention error handling?" User: "Yes" → call update_notebook

Tip: You may update multiple fields at once if requested.

Inputs: id (required), name, description, topics, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 16 tools

    Disambiguation3/5

    Most tools have distinct purposes, but there is some overlap between close_session and reset_session (both manage sessions), and between setup_auth and re_auth (both handle authentication). The descriptions help clarify differences, but an agent might occasionally misselect between these pairs.

    Naming Consistency4/5

    Tool names follow a consistent verb_noun pattern (e.g., add_notebook, list_notebooks, get_health), with minor deviations like cleanup_data (noun_verb) and ask_question (verb_noun but less structured). Overall, the naming is readable and mostly predictable.

    Tool Count4/5

    16 tools are reasonable for managing NotebookLM notebooks, sessions, authentication, and cleanup. It covers core workflows without being overly heavy, though some tools like cleanup_data are specialized and might be used infrequently.

    Completeness5/5

    The tool set provides complete CRUD/lifecycle coverage for NotebookLM notebooks (add, list, get, update, remove, search, select) and sessions (list, close, reset), plus authentication, health checks, and cleanup. No obvious gaps exist for the server's purpose.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables citation-backed Q&A and full Studio content generation (audio, video, infographics, reports, presentations, data tables, flashcards, quizzes, mind maps) against Google NotebookLM, with multi-account rotation and auto-reauth. Serves both MCP clients like Claude Code and Cursor and a 33-endpoint HTTP REST API for no-code tools such as n8n, Zapier, and Make.
      5,121 npm
      MIT