@roomi-fields/notebooklm-mcp 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +764 -715
  2. package/dist/__tests__/cleanup-manager.test.d.ts +2 -0
  3. package/dist/__tests__/cleanup-manager.test.d.ts.map +1 -0
  4. package/dist/__tests__/cleanup-manager.test.js +341 -0
  5. package/dist/__tests__/cleanup-manager.test.js.map +1 -0
  6. package/dist/__tests__/config-parsing.test.d.ts +2 -0
  7. package/dist/__tests__/config-parsing.test.d.ts.map +1 -0
  8. package/dist/__tests__/config-parsing.test.js +338 -0
  9. package/dist/__tests__/config-parsing.test.js.map +1 -0
  10. package/dist/__tests__/config.test.d.ts +2 -0
  11. package/dist/__tests__/config.test.d.ts.map +1 -0
  12. package/dist/__tests__/config.test.js +267 -0
  13. package/dist/__tests__/config.test.js.map +1 -0
  14. package/dist/__tests__/errors.test.d.ts +2 -0
  15. package/dist/__tests__/errors.test.d.ts.map +1 -0
  16. package/dist/__tests__/errors.test.js +166 -0
  17. package/dist/__tests__/errors.test.js.map +1 -0
  18. package/dist/__tests__/logger.test.d.ts +2 -0
  19. package/dist/__tests__/logger.test.d.ts.map +1 -0
  20. package/dist/__tests__/logger.test.js +324 -0
  21. package/dist/__tests__/logger.test.js.map +1 -0
  22. package/dist/__tests__/page-utils.test.d.ts +2 -0
  23. package/dist/__tests__/page-utils.test.d.ts.map +1 -0
  24. package/dist/__tests__/page-utils.test.js +349 -0
  25. package/dist/__tests__/page-utils.test.js.map +1 -0
  26. package/dist/__tests__/setup-verification.test.d.ts +2 -0
  27. package/dist/__tests__/setup-verification.test.d.ts.map +1 -0
  28. package/dist/__tests__/setup-verification.test.js +15 -0
  29. package/dist/__tests__/setup-verification.test.js.map +1 -0
  30. package/dist/__tests__/stealth-utils.test.d.ts +2 -0
  31. package/dist/__tests__/stealth-utils.test.d.ts.map +1 -0
  32. package/dist/__tests__/stealth-utils.test.js +413 -0
  33. package/dist/__tests__/stealth-utils.test.js.map +1 -0
  34. package/dist/__tests__/types.test.d.ts +2 -0
  35. package/dist/__tests__/types.test.d.ts.map +1 -0
  36. package/dist/__tests__/types.test.js +461 -0
  37. package/dist/__tests__/types.test.js.map +1 -0
  38. package/dist/auth/auth-manager.d.ts +2 -2
  39. package/dist/auth/auth-manager.d.ts.map +1 -1
  40. package/dist/auth/auth-manager.js +147 -145
  41. package/dist/auth/auth-manager.js.map +1 -1
  42. package/dist/auto-discovery/auto-discovery.d.ts.map +1 -1
  43. package/dist/auto-discovery/auto-discovery.js +17 -17
  44. package/dist/auto-discovery/auto-discovery.js.map +1 -1
  45. package/dist/cli/de-auth.js +19 -19
  46. package/dist/cli/help.js +60 -60
  47. package/dist/cli/setup-auth.js +39 -39
  48. package/dist/config.d.ts +1 -1
  49. package/dist/config.d.ts.map +1 -1
  50. package/dist/config.js +35 -20
  51. package/dist/config.js.map +1 -1
  52. package/dist/errors.d.ts.map +1 -1
  53. package/dist/errors.js +3 -3
  54. package/dist/errors.js.map +1 -1
  55. package/dist/http-wrapper.js +36 -30
  56. package/dist/http-wrapper.js.map +1 -1
  57. package/dist/index.js +104 -102
  58. package/dist/index.js.map +1 -1
  59. package/dist/library/notebook-library.d.ts +2 -2
  60. package/dist/library/notebook-library.d.ts.map +1 -1
  61. package/dist/library/notebook-library.js +24 -24
  62. package/dist/library/notebook-library.js.map +1 -1
  63. package/dist/session/browser-session.d.ts +4 -4
  64. package/dist/session/browser-session.d.ts.map +1 -1
  65. package/dist/session/browser-session.js +59 -55
  66. package/dist/session/browser-session.js.map +1 -1
  67. package/dist/session/session-manager.d.ts +3 -3
  68. package/dist/session/session-manager.d.ts.map +1 -1
  69. package/dist/session/session-manager.js +14 -14
  70. package/dist/session/session-manager.js.map +1 -1
  71. package/dist/session/shared-context-manager.d.ts +2 -2
  72. package/dist/session/shared-context-manager.d.ts.map +1 -1
  73. package/dist/session/shared-context-manager.js +60 -56
  74. package/dist/session/shared-context-manager.js.map +1 -1
  75. package/dist/tools/index.d.ts +6 -6
  76. package/dist/tools/index.d.ts.map +1 -1
  77. package/dist/tools/index.js +505 -505
  78. package/dist/tools/index.js.map +1 -1
  79. package/dist/types.d.ts +2 -2
  80. package/dist/utils/cleanup-manager.d.ts +1 -1
  81. package/dist/utils/cleanup-manager.d.ts.map +1 -1
  82. package/dist/utils/cleanup-manager.js +90 -92
  83. package/dist/utils/cleanup-manager.js.map +1 -1
  84. package/dist/utils/logger.d.ts +1 -2
  85. package/dist/utils/logger.d.ts.map +1 -1
  86. package/dist/utils/logger.js +15 -15
  87. package/dist/utils/page-utils.d.ts +1 -1
  88. package/dist/utils/page-utils.d.ts.map +1 -1
  89. package/dist/utils/page-utils.js +30 -30
  90. package/dist/utils/page-utils.js.map +1 -1
  91. package/dist/utils/stealth-utils.d.ts +2 -2
  92. package/dist/utils/stealth-utils.d.ts.map +1 -1
  93. package/dist/utils/stealth-utils.js +13 -13
  94. package/dist/utils/stealth-utils.js.map +1 -1
  95. package/docs/CHROME_PROFILE_LIMITATION.md +229 -212
  96. package/package.json +107 -79
package/README.md CHANGED
@@ -1,715 +1,764 @@
1
- <div align="center">
2
-
3
- # NotebookLM MCP Server
4
-
5
- > **Forked from** [PleasePrompto/notebooklm-mcp](https://github.com/PleasePrompto/notebooklm-mcp)
6
-
7
- **Chat directly with NotebookLM for zero-hallucination answers based on your own notebooks**
8
-
9
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/)
10
- [![MCP](https://img.shields.io/badge/MCP-2025-green.svg)](https://modelcontextprotocol.io/)
11
- [![npm](https://img.shields.io/npm/v/@roomi-fields/notebooklm-mcp.svg)](https://www.npmjs.com/package/@roomi-fields/notebooklm-mcp)
12
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13
- [![Claude Code](https://img.shields.io/badge/Claude_Code-MCP-8A2BE2)](https://claude.ai/claude-code)
14
- [![n8n](https://img.shields.io/badge/n8n-HTTP_API-orange)](./deployment/docs/04-N8N-INTEGRATION.md)
15
- [![GitHub](https://img.shields.io/github/stars/roomi-fields/notebooklm-mcp?style=social)](https://github.com/roomi-fields/notebooklm-mcp)
16
-
17
- [MCP Installation](#mcp-installation) • [HTTP REST API](#http-rest-api) • [Why NotebookLM](#why-notebooklm-not-local-rag) • [Examples](#real-world-example) • [Documentation](./deployment/docs/)
18
-
19
- </div>
20
-
21
- ---
22
-
23
- > **⚠️ Current Limitation (v1.3.2):** HTTP and MCP stdio modes cannot run simultaneously due to Chrome profile locking. Choose one mode at a time, or see [Chrome Profile Limitation](./docs/CHROME_PROFILE_LIMITATION.md) for details. This will be fixed in v1.4.0 with automatic profile separation.
24
-
25
- ---
26
-
27
- ## 🚀 Two Ways to Use This Server
28
-
29
- ### 1️⃣ **HTTP REST API** (New! Recommended for n8n, Zapier, Make.com)
30
-
31
- Use NotebookLM from **any tool** via HTTP REST API:
32
-
33
- **Option A: Install from npm**
34
- ```bash
35
- # Install globally
36
- npm install -g @roomi-fields/notebooklm-mcp
37
-
38
- # For MCP stdio mode (Claude Code, Cursor)
39
- notebooklm-mcp
40
-
41
- # For HTTP server mode
42
- # Note: Currently requires cloning the repo for HTTP mode
43
- # See Option B below
44
- ```
45
-
46
- **Option B: Install from source (Required for HTTP mode)**
47
- ```bash
48
- # Clone and install
49
- git clone https://github.com/roomi-fields/notebooklm-mcp.git
50
- cd notebooklm-mcp
51
- npm install
52
- npm run build
53
- npm run start:http
54
- ```
55
-
56
- **Query the API:**
57
- ```bash
58
- curl -X POST http://localhost:3000/ask \
59
- -H "Content-Type: application/json" \
60
- -d '{"question": "Explain X", "notebook_id": "my-notebook"}'
61
- ```
62
-
63
- **Perfect for:**
64
- - ✅ n8n workflows and automation
65
- - ✅ Zapier, Make.com integrations
66
- - ✅ Custom web applications
67
- - ✅ Backend APIs
68
-
69
- **👉 Full HTTP setup guide:** [deployment/docs/01-INSTALL.md](./deployment/docs/01-INSTALL.md)
70
-
71
- ---
72
-
73
- ### 2️⃣ **MCP stdio** (For Claude Code, Cursor, Codex)
74
-
75
- Use NotebookLM directly from your AI coding assistant:
76
-
77
- ```bash
78
- # Claude Code
79
- claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
80
-
81
- # Codex
82
- codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
83
-
84
- # Cursor (add to ~/.cursor/mcp.json)
85
- {
86
- "mcpServers": {
87
- "notebooklm": {
88
- "command": "npx",
89
- "args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
90
- }
91
- }
92
- }
93
- ```
94
-
95
- **Perfect for:**
96
- - ✅ Claude Code, Cursor, Codex
97
- - ✅ Any MCP-compatible AI assistant
98
- - ✅ Direct CLI integration
99
-
100
- ---
101
-
102
- ## The Problem
103
-
104
- When you tell Claude Code or Cursor to "search through my local documentation", here's what happens:
105
- - **Massive token consumption**: Searching through documentation means reading multiple files repeatedly
106
- - **Inaccurate retrieval**: Searches for keywords, misses context and connections between docs
107
- - **Hallucinations**: When it can't find something, it invents plausible-sounding APIs
108
- - **Expensive & slow**: Each question requires re-reading multiple files
109
-
110
- ## The Solution
111
-
112
- Let your tools chat directly with [**NotebookLM**](https://notebooklm.google/) — Google's **zero-hallucination knowledge base** powered by Gemini 2.5 that provides intelligent, synthesized answers from your docs.
113
-
114
- ```
115
- Your Task → Agent/n8n asks NotebookLM → Gemini synthesizes answer → Correct output
116
- ```
117
-
118
- **The real advantage**: No more manual copy-paste. Your agent/workflow asks NotebookLM directly and gets answers back. Build deep understanding through automatic follow-ups.
119
-
120
- ---
121
-
122
- ## Why NotebookLM, Not Local RAG?
123
-
124
- | Approach | Token Cost | Setup Time | Hallucinations | Answer Quality |
125
- |----------|------------|------------|----------------|----------------|
126
- | **Feed docs to Claude** | 🔴 Very high (multiple file reads) | Instant | Yes - fills gaps | Variable retrieval |
127
- | **Web search** | 🟡 Medium | Instant | High - unreliable sources | Hit or miss |
128
- | **Local RAG** | 🟡 Medium-High | Hours (embeddings, chunking) | Medium - retrieval gaps | Depends on setup |
129
- | **NotebookLM MCP** | 🟢 Minimal | 5 minutes | **Zero** - refuses if unknown | Expert synthesis |
130
-
131
- ### What Makes NotebookLM Superior?
132
-
133
- 1. **Pre-processed by Gemini**: Upload docs once, get instant expert knowledge
134
- 2. **Natural language Q&A**: Not just retrieval actual understanding and synthesis
135
- 3. **Multi-source correlation**: Connects information across 50+ documents
136
- 4. **Citation-backed**: Every answer includes source references
137
- 5. **No infrastructure**: No vector DBs, embeddings, or chunking strategies needed
138
-
139
- ---
140
-
141
- ## HTTP REST API
142
-
143
- ### Quick Start
144
-
145
- ```powershell
146
- # 1. Clone and install
147
- git clone <repo-url> D:\notebooklm-http
148
- cd D:\notebooklm-http
149
- npm install
150
- npm run build
151
-
152
- # 2. Configure authentication (one-time)
153
- npm run setup-auth
154
- # Chrome opens → log in with Google → close Chrome
155
-
156
- # 3. Start the server
157
-
158
- # Option A: Foreground mode (terminal stays open)
159
- npm run start:http
160
-
161
- # Option B: Background daemon mode (recommended for production)
162
- npm run daemon:start # Start in background
163
- npm run daemon:logs # View logs
164
- npm run daemon:status # Check status
165
- npm run daemon:stop # Stop server
166
-
167
- # 4. Add your first notebook (in another terminal if using Option A)
168
- curl -X POST http://localhost:3000/notebooks \
169
- -H "Content-Type: application/json" \
170
- -d '{
171
- "url": "https://notebooklm.google.com/notebook/YOUR-NOTEBOOK-ID",
172
- "name": "My Knowledge Base",
173
- "description": "My documentation",
174
- "topics": ["docs", "api"]
175
- }'
176
-
177
- # 5. Query NotebookLM
178
- curl -X POST http://localhost:3000/ask \
179
- -H "Content-Type: application/json" \
180
- -d '{"question": "Explain X"}'
181
-
182
- # 6. Validate installation (optional)
183
- .\deployment\scripts\test-server.ps1
184
- ```
185
-
186
- **👉 See [Testing Guide](./deployment/scripts/README.md) for automated test suite**
187
-
188
- ### API Endpoints
189
-
190
- | Method | Endpoint | Description |
191
- |--------|----------|-------------|
192
- | `GET` | `/health` | Check server health |
193
- | `POST` | `/ask` | Ask a question to NotebookLM |
194
- | `GET` | `/notebooks` | List all notebooks |
195
- | `POST` | `/notebooks` | Add notebook (with live validation) |
196
- | `POST` | `/notebooks/auto-discover` | Auto-generate notebook metadata |
197
- | `DELETE` | `/notebooks/:id` | Remove a notebook |
198
- | `PUT` | `/notebooks/:id/activate` | Set active notebook |
199
- | `GET` | `/sessions` | List active sessions |
200
- | `DELETE` | `/sessions/:id` | Close a session |
201
-
202
- **👉 Full API documentation:** [deployment/docs/03-API.md](./deployment/docs/03-API.md)
203
-
204
- ### n8n Integration
205
-
206
- Perfect for n8n workflows:
207
-
208
- ```json
209
- {
210
- "nodes": [
211
- {
212
- "name": "Ask NotebookLM",
213
- "type": "n8n-nodes-base.httpRequest",
214
- "parameters": {
215
- "method": "POST",
216
- "url": "http://your-server:3000/ask",
217
- "jsonParameters": true,
218
- "bodyParametersJson": {
219
- "question": "{{ $json.query }}",
220
- "notebook_id": "my-notebook"
221
- }
222
- }
223
- }
224
- ]
225
- }
226
- ```
227
-
228
- **👉 n8n guide:** [deployment/docs/04-N8N-INTEGRATION.md](./deployment/docs/04-N8N-INTEGRATION.md)
229
-
230
- ---
231
-
232
- ## 🔍 Auto-Discovery : Self-Organizing Documentation
233
-
234
- Autonomous resource discovery enables AI orchestrators to find and use relevant documentation without manual intervention.
235
-
236
- ### How it works
237
-
238
- **1. Add notebook** (zero manual metadata):
239
- ```bash
240
- curl -X POST http://localhost:3000/notebooks/auto-discover \
241
- -H "Content-Type: application/json" \
242
- -d '{"url": "https://notebooklm.google.com/notebook/YOUR_ID"}'
243
- ```
244
-
245
- **2. System queries NotebookLM** to auto-generate:
246
- - Kebab-case name (3 words max)
247
- - Concise description (2 sentences)
248
- - Relevant tags (8-10 keywords)
249
-
250
- **3. Orchestrators discover autonomously**:
251
- - Claude Code finds relevant docs without prompting
252
- - n8n workflows auto-select documentation
253
- - Cursor matches context to notebooks
254
-
255
- ### Progressive disclosure pattern
256
-
257
- Inspired by [Claude Skills best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#progressive-disclosure-patterns):
258
-
259
- - **Level 0** (startup): Lightweight metadata loaded (~500 tokens)
260
- - **Level 1** (matching): Local tag/description search (0 NotebookLM queries)
261
- - **Level 2** (deep query): Targeted NotebookLM query only when needed
262
-
263
- ### Why this matters
264
-
265
- **Before**: Manual library management, orchestrators can't discover resources autonomously
266
-
267
- **After**: Self-organizing library, autonomous documentation discovery
268
-
269
- Perfect for:
270
- - Teams with 10+ documentation notebooks
271
- - ✅ n8n workflows needing dynamic doc access
272
- - Claude Code autonomous research
273
- - ✅ Onboarding new developers without manual setup
274
-
275
- ### Example workflow
276
-
277
- ```bash
278
- # 1. Add documentation notebooks (auto-discover metadata)
279
- curl -X POST /notebooks/auto-discover -d '{"url": "https://notebooklm.google.com/notebook/n8n-docs"}'
280
- curl -X POST /notebooks/auto-discover -d '{"url": "https://notebooklm.google.com/notebook/react-guide"}'
281
-
282
- # 2. Claude Code autonomously discovers relevant notebook
283
- User: "Build Gmail automation with n8n"
284
- → System matches: "n8n-docs" (tags: ["n8n", "gmail", "automation"])
285
- Query NotebookLM: "Gmail node configuration?"
286
- → Claude implements with accurate info
287
-
288
- # 3. Zero hallucinations, zero manual intervention
289
- ```
290
-
291
- ---
292
-
293
- ### Background Daemon Mode
294
-
295
- Run the HTTP server as a background process without keeping a terminal window open:
296
-
297
- ```bash
298
- # Start server in background
299
- npm run daemon:start
300
-
301
- # View real-time logs
302
- npm run daemon:logs
303
-
304
- # Check server status
305
- npm run daemon:status
306
-
307
- # Restart server
308
- npm run daemon:restart
309
-
310
- # Stop server
311
- npm run daemon:stop
312
-
313
- # Remove from PM2 process list
314
- npm run daemon:delete
315
- ```
316
-
317
- **Features:**
318
- - Runs in background without terminal window
319
- - ✅ Auto-restart on crash
320
- - Centralized log management (logs/pm2-*.log)
321
- - Memory limit protection (1GB max)
322
- - ✅ Production-ready process management
323
-
324
- **Configuration:** Edit `ecosystem.config.cjs` to customize PM2 behavior (env vars, restart policy, etc.)
325
-
326
- ### Installation & Documentation
327
-
328
- - 📖 [**Installation Guide**](./deployment/docs/01-INSTALL.md) — Step-by-step setup
329
- - 🔧 [**Configuration**](./deployment/docs/02-CONFIGURATION.md) Environment variables, security
330
- - 📡 [**API Reference**](./deployment/docs/03-API.md) Complete endpoint documentation
331
- - 📚 [**Notebook Library**](./deployment/docs/06-NOTEBOOK-LIBRARY.md) — Multi-notebook management
332
- - ✅ [**Testing Suite**](./deployment/scripts/README.md) Automated validation scripts
333
- - 🐛 [**Troubleshooting**](./deployment/docs/05-TROUBLESHOOTING.md) Common issues
334
-
335
- ---
336
-
337
- ## MCP Installation
338
-
339
- <details>
340
- <summary>Claude Code</summary>
341
-
342
- ```bash
343
- claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
344
- ```
345
- </details>
346
-
347
- <details>
348
- <summary>Codex</summary>
349
-
350
- ```bash
351
- codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
352
- ```
353
- </details>
354
-
355
- <details>
356
- <summary>Gemini</summary>
357
-
358
- ```bash
359
- gemini mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
360
- ```
361
- </details>
362
-
363
- <details>
364
- <summary>Cursor</summary>
365
-
366
- Add to `~/.cursor/mcp.json`:
367
- ```json
368
- {
369
- "mcpServers": {
370
- "notebooklm": {
371
- "command": "npx",
372
- "args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
373
- }
374
- }
375
- }
376
- ```
377
- </details>
378
-
379
- <details>
380
- <summary>amp</summary>
381
-
382
- ```bash
383
- amp mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
384
- ```
385
- </details>
386
-
387
- <details>
388
- <summary>VS Code</summary>
389
-
390
- ```bash
391
- code --add-mcp '{"name":"notebooklm","command":"npx","args":["@roomi-fields/notebooklm-mcp@latest"]}'
392
- ```
393
- </details>
394
-
395
- <details>
396
- <summary>Other MCP clients</summary>
397
-
398
- **Generic MCP config:**
399
- ```json
400
- {
401
- "mcpServers": {
402
- "notebooklm": {
403
- "command": "npx",
404
- "args": ["@roomi-fields/notebooklm-mcp@latest"]
405
- }
406
- }
407
- }
408
- ```
409
- </details>
410
-
411
- ### MCP Quick Start
412
-
413
- 1. **Install** the MCP server (see above)
414
-
415
- 2. **Authenticate** (one-time)
416
-
417
- Say in your chat (Claude/Codex):
418
- ```
419
- "Log me in to NotebookLM"
420
- ```
421
- *A Chrome window opens → log in with Google*
422
-
423
- 3. **Create your knowledge base**
424
-
425
- Go to [notebooklm.google.com](https://notebooklm.google.com) → Create notebook → Upload your docs:
426
- - 📄 PDFs, Google Docs, markdown files
427
- - 🔗 Websites, GitHub repos
428
- - 🎥 YouTube videos
429
- - 📚 Multiple sources per notebook
430
-
431
- Share: **⚙️ Share → Anyone with link → Copy**
432
-
433
- 4. **Let Claude use it**
434
-
435
- ```
436
- "I'm building with [library]. Here's my NotebookLM: [link]"
437
- ```
438
-
439
- **That's it.** Claude now asks NotebookLM whatever it needs, building expertise before writing code.
440
-
441
- ---
442
-
443
- ## Related Project: Claude Code Skill (by original author)
444
-
445
- The original author [PleasePrompto](https://github.com/PleasePrompto) also created a **Python-based Claude Code Skill** as an alternative approach:
446
-
447
- 🔗 **[NotebookLM Claude Code Skill](https://github.com/PleasePrompto/notebooklm-skill)** - Python skill for Claude Code
448
-
449
- ### When to use which approach?
450
-
451
- | Feature | This Project (MCP + HTTP) | Original Skill (Python) |
452
- |---------|---------------------------|-------------------------|
453
- | **Protocol** | MCP (Model Context Protocol) | Claude Skills |
454
- | **Installation** | `claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp` | Clone to `~/.claude/skills/` |
455
- | **Sessions** | ✅ Persistent browser sessions | Fresh browser per query |
456
- | **Compatibility** | ✅ Claude Code, Cursor, Codex, any MCP client | Claude Code only |
457
- | **HTTP API** | ✅ Works with n8n, Zapier, Make.com | ❌ Not available |
458
- | **Language** | TypeScript | Python |
459
- | **Use case** | Long conversations, automation workflows | Quick one-off queries |
460
-
461
- ### Which one should you choose?
462
-
463
- - **Use this MCP project** if you want:
464
- - Persistent sessions (faster repeated queries)
465
- - Compatibility with multiple tools (Cursor, Codex, etc.)
466
- - HTTP REST API for n8n/Zapier automation
467
- - TypeScript-based development
468
-
469
- - **Use the original Skill** if you prefer:
470
- - Python-based workflow
471
- - Simpler clone-and-use installation
472
- - Stateless queries (no session management)
473
- - Only using Claude Code locally
474
-
475
- Both use the same Patchright browser automation technology and provide zero-hallucination answers from NotebookLM.
476
-
477
- ---
478
-
479
- ## Real-World Example
480
-
481
- ### Building an n8n Workflow Without Hallucinations
482
-
483
- **Challenge**: n8n's API is new — Claude hallucinates node names and functions.
484
-
485
- **Solution**:
486
- 1. Downloaded complete n8n documentation merged into manageable chunks
487
- 2. Uploaded to NotebookLM
488
- 3. Told Claude: *"Build me a Gmail spam filter workflow. Use this NotebookLM: [link]"*
489
-
490
- **Watch the AI-to-AI conversation:**
491
-
492
- ```
493
- Claude "How does Gmail integration work in n8n?"
494
- NotebookLM "Use Gmail Trigger with polling, or Gmail node with Get Many..."
495
-
496
- Claude "How to decode base64 email body?"
497
- NotebookLM → "Body is base64url encoded in payload.parts, use Function node..."
498
-
499
- Claude → "How to parse OpenAI response as JSON?"
500
- NotebookLM → "Set responseFormat to json, use {{ $json.spam }} in IF node..."
501
-
502
- Claude "What about error handling if the API fails?"
503
- NotebookLM → "Use Error Trigger node with Continue On Fail enabled..."
504
-
505
- Claude → ✅ "Here's your complete workflow JSON..."
506
- ```
507
-
508
- **Result**: Perfect workflow on first try. No debugging hallucinated APIs.
509
-
510
- ---
511
-
512
- ## Core Features
513
-
514
- ### **Zero Hallucinations**
515
- NotebookLM refuses to answer if information isn't in your docs. No invented APIs.
516
-
517
- ### **Multi-Notebook Library**
518
- Manage multiple NotebookLM notebooks with automatic validation, duplicate detection, and smart selection.
519
-
520
- ### **Autonomous Research**
521
- Claude asks follow-up questions automatically, building complete understanding before coding.
522
-
523
- ### **Deep, Iterative Research**
524
- - Claude automatically asks follow-up questions to build complete understanding
525
- - Each answer triggers deeper questions until Claude has all the details
526
- - Example: For n8n workflow, Claude asked multiple sequential questions about Gmail integration, error handling, and data transformation
527
-
528
- ### **HTTP REST API**
529
- Use NotebookLM from n8n, Zapier, Make.com, or any HTTP client. No MCP required.
530
-
531
- ### **Cross-Tool Sharing**
532
- Set up once, use everywhere. Claude Code, Codex, Cursor, n8n — all can access the same library.
533
-
534
- ---
535
-
536
- ## Architecture
537
-
538
- ```mermaid
539
- graph LR
540
- A[Your Task] --> B[Claude/n8n/HTTP Client]
541
- B --> C[MCP/HTTP Server]
542
- C --> D[Chrome Automation]
543
- D --> E[NotebookLM]
544
- E --> F[Gemini 2.5]
545
- F --> G[Your Docs]
546
- G --> F
547
- F --> E
548
- E --> D
549
- D --> C
550
- C --> B
551
- B --> H[Accurate Output]
552
- ```
553
-
554
- ---
555
-
556
- ## Common Commands (MCP Mode)
557
-
558
- | Intent | Say | Result |
559
- |--------|-----|--------|
560
- | Authenticate | *"Open NotebookLM auth setup"* or *"Log me in to NotebookLM"* | Chrome opens for login |
561
- | Add notebook | *"Add [link] to library"* | Saves notebook with metadata |
562
- | List notebooks | *"Show our notebooks"* | Lists all saved notebooks |
563
- | Research first | *"Research this in NotebookLM before coding"* | Multi-question session |
564
- | Select notebook | *"Use the React notebook"* | Sets active notebook |
565
- | Update notebook | *"Update notebook tags"* | Modify metadata |
566
- | Remove notebook | *"Remove [notebook] from library"* | Deletes from library |
567
- | View browser | *"Show me the browser"* | Watch live NotebookLM chat |
568
- | Fix auth | *"Repair NotebookLM authentication"* | Clears and re-authenticates |
569
- | Switch account | *"Re-authenticate with different Google account"* | Changes account |
570
- | Clean restart | *"Run NotebookLM cleanup"* | Removes all data for fresh start |
571
-
572
- ---
573
-
574
- ## Comparison to Alternatives
575
-
576
- ### vs. Downloading docs locally
577
- - **You**: Download docs → Claude: "search through these files"
578
- - **Problem**: Claude reads thousands of files → massive token usage, often misses connections
579
- - **NotebookLM**: Pre-indexed by Gemini, semantic understanding across all docs
580
-
581
- ### vs. Web search
582
- - **You**: "Research X online"
583
- - **Problem**: Outdated info, hallucinated examples, unreliable sources
584
- - **NotebookLM**: Only your trusted docs, always current, with citations
585
-
586
- ### vs. Local RAG setup
587
- - **You**: Set up embeddings, vector DB, chunking strategy, retrieval pipeline
588
- - **Problem**: Hours of setup, tuning retrieval, still gets "creative" with gaps
589
- - **NotebookLM**: Upload docs done. Google handles everything.
590
-
591
- ---
592
-
593
- ## FAQ
594
-
595
- **Is it really zero hallucinations?**
596
- Yes. NotebookLM is specifically designed to only answer from uploaded sources. If it doesn't know, it says so.
597
-
598
- **What about rate limits?**
599
- Free tier has daily query limits per Google account. Quick account switching supported for continued research.
600
-
601
- **How secure is this?**
602
- Chrome runs locally. Your credentials never leave your machine. Use a dedicated Google account if concerned.
603
-
604
- **Can I see what's happening?**
605
- Yes! Say *"Show me the browser"* (MCP mode) or set `HEADLESS=false` (HTTP mode) to watch the live NotebookLM conversation.
606
-
607
- **What makes this better than Claude's built-in knowledge?**
608
- Your docs are always current. No training cutoff. No hallucinations. Perfect for new libraries, internal APIs, or fast-moving projects.
609
-
610
- ---
611
-
612
- ## The Bottom Line
613
-
614
- **Without NotebookLM**: Write code → Find it's wrong → Debug hallucinated APIs → Repeat
615
-
616
- **With NotebookLM**: Research first Write correct code Ship faster
617
-
618
- Stop debugging hallucinations. Start shipping accurate code.
619
-
620
- ---
621
-
622
- ## Disclaimer
623
-
624
- This tool automates browser interactions with NotebookLM to make your workflow more efficient. However, a few friendly reminders:
625
-
626
- **About browser automation:**
627
- While I've built in humanization features (realistic typing speeds, natural delays, mouse movements) to make the automation behave more naturally, I can't guarantee Google won't detect or flag automated usage. I recommend using a dedicated Google account for automation rather than your primary account—think of it like web scraping: probably fine, but better safe than sorry!
628
-
629
- **About CLI tools and AI agents:**
630
- CLI tools like Claude Code, Codex, and similar AI-powered assistants are incredibly powerful, but they can make mistakes. Please use them with care and awareness:
631
- - Always review changes before committing or deploying
632
- - Test in safe environments first
633
- - Keep backups of important work
634
- - Remember: AI agents are assistants, not infallible oracles
635
-
636
- I built this tool for myself because I was tired of the copy-paste dance between NotebookLM and my editor. I'm sharing it in the hope it helps others too, but I can't take responsibility for any issues, data loss, or account problems that might occur. Use at your own discretion and judgment.
637
-
638
- That said, if you run into problems or have questions, feel free to open an issue on GitHub. I'm happy to help troubleshoot!
639
-
640
- ---
641
-
642
- ## Roadmap
643
-
644
- ### ✅ Implemented in v1.3.2
645
-
646
- **🤖 Auto-Discovery: Autonomous Resource Discovery**
647
- - Automatically generate notebook name, description, and tags via NotebookLM
648
- - ✅ Progressive disclosure pattern inspired by Claude Skills best practices
649
- - Zero-friction notebook addition (30 seconds vs 5 minutes)
650
- - ✅ Validation of auto-generated metadata (kebab-case, description length, tags count)
651
- - Orchestrators discover relevant documentation autonomously
652
-
653
- **👉 See [Auto-Discovery Documentation](./deployment/docs/07-AUTO-DISCOVERY.md) for details**
654
-
655
- ### 🔜 Planned for v1.4.0+
656
-
657
- **🔥 Separate Chrome Profiles by Mode (Priority):**
658
- - Enable HTTP and MCP stdio modes to run simultaneously
659
- - Automatic profile detection: `chrome_profile_http` vs `chrome_profile_stdio`
660
- - No user configuration needed - just works
661
- - Solves Chrome profile locking issue for dual-mode users
662
- - **👉 See [Chrome Profile Limitation](./docs/CHROME_PROFILE_LIMITATION.md) for details**
663
-
664
- **Smart Metadata Refresh:**
665
- - Auto-detect when notebook content has changed
666
- - Re-query NotebookLM to update metadata
667
- - Endpoint: `PATCH /notebooks/:id/refresh`
668
-
669
- **Semantic Matching:**
670
- - Use embeddings for advanced notebook matching beyond tags
671
- - Endpoint: `GET /notebooks/match?query=gmail&semantic=true`
672
-
673
- **Usage Analytics:**
674
- - Track which notebooks are queried together
675
- - Suggest related notebooks based on usage patterns
676
- - Endpoint: `GET /notebooks/:id/related`
677
-
678
- ### 🚀 Previously Implemented
679
-
680
- **✅ PM2 Daemon Mode (v1.1.2):**
681
- - Cross-platform process manager with auto-restart
682
- - Commands: `npm run daemon:start`, `daemon:logs`, `daemon:status`
683
- - Built-in log rotation and monitoring
684
-
685
- **✅ Multi-Notebook Library (v1.1.2):**
686
- - Live validation of notebooks
687
- - Duplicate detection
688
- - Smart notebook selection
689
-
690
- ### 💡 Have an idea?
691
- [Open a discussion](https://github.com/roomi-fields/notebooklm-mcp/discussions) to suggest new features!
692
-
693
- ---
694
-
695
- ## Contributing
696
-
697
- Found a bug? Have a feature idea? [Open an issue](https://github.com/roomi-fields/notebooklm-mcp/issues) or submit a PR!
698
-
699
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
700
-
701
- ## License
702
-
703
- MIT Use freely in your projects.
704
-
705
- See [LICENSE](./LICENSE) for details.
706
-
707
- ---
708
-
709
- <div align="center">
710
-
711
- Built with frustration about hallucinated APIs, powered by Google's NotebookLM
712
-
713
- [Star on GitHub](https://github.com/roomi-fields/notebooklm-mcp) if this saves you debugging time!
714
-
715
- </div>
1
+ <div align="center">
2
+
3
+ # NotebookLM MCP Server
4
+
5
+ > **Forked from** [PleasePrompto/notebooklm-mcp](https://github.com/PleasePrompto/notebooklm-mcp)
6
+
7
+ **Chat directly with NotebookLM for zero-hallucination answers based on your own notebooks**
8
+
9
+ <!-- Badges -->
10
+
11
+ [![CI](https://github.com/roomi-fields/notebooklm-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/roomi-fields/notebooklm-mcp/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/%40roomi-fields%2Fnotebooklm-mcp.svg)](https://www.npmjs.com/package/@roomi-fields/notebooklm-mcp) [![npm downloads](https://img.shields.io/npm/dm/@roomi-fields/notebooklm-mcp.svg)](https://www.npmjs.com/package/@roomi-fields/notebooklm-mcp) [![codecov](https://codecov.io/gh/roomi-fields/notebooklm-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/roomi-fields/notebooklm-mcp) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/) [![Node.js](https://img.shields.io/badge/Node.js->=18-green.svg)](https://nodejs.org/)
12
+
13
+ [![MCP](https://img.shields.io/badge/MCP-2025-green.svg)](https://modelcontextprotocol.io/) [![Claude Code](https://img.shields.io/badge/Claude_Code-MCP-8A2BE2)](https://claude.ai/claude-code) [![n8n](https://img.shields.io/badge/n8n-HTTP_API-orange)](./deployment/docs/04-N8N-INTEGRATION.md) [![GitHub](https://img.shields.io/github/stars/roomi-fields/notebooklm-mcp?style=social)](https://github.com/roomi-fields/notebooklm-mcp)
14
+
15
+ <!-- End Badges -->
16
+
17
+ [MCP Installation](#mcp-installation) • [HTTP REST API](#http-rest-api) • [Why NotebookLM](#why-notebooklm-not-local-rag) • [Examples](#real-world-example) • [Documentation](./deployment/docs/)
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ > **⚠️ Current Limitation (v1.3.2):** HTTP and MCP stdio modes cannot run simultaneously due to Chrome profile locking. Choose one mode at a time, or see [Chrome Profile Limitation](./docs/CHROME_PROFILE_LIMITATION.md) for details. This will be fixed in v1.4.0 with automatic profile separation.
24
+
25
+ ---
26
+
27
+ ## 🚀 Two Ways to Use This Server
28
+
29
+ ### 1️⃣ **HTTP REST API** (New! Recommended for n8n, Zapier, Make.com)
30
+
31
+ Use NotebookLM from **any tool** via HTTP REST API:
32
+
33
+ **Option A: Install from npm**
34
+
35
+ ```bash
36
+ # Install globally
37
+ npm install -g @roomi-fields/notebooklm-mcp
38
+
39
+ # For MCP stdio mode (Claude Code, Cursor)
40
+ notebooklm-mcp
41
+
42
+ # For HTTP server mode
43
+ # Note: Currently requires cloning the repo for HTTP mode
44
+ # See Option B below
45
+ ```
46
+
47
+ **Option B: Install from source (Required for HTTP mode)**
48
+
49
+ ```bash
50
+ # Clone and install
51
+ git clone https://github.com/roomi-fields/notebooklm-mcp.git
52
+ cd notebooklm-mcp
53
+ npm install
54
+ npm run build
55
+ npm run start:http
56
+ ```
57
+
58
+ **Query the API:**
59
+
60
+ ```bash
61
+ curl -X POST http://localhost:3000/ask \
62
+ -H "Content-Type: application/json" \
63
+ -d '{"question": "Explain X", "notebook_id": "my-notebook"}'
64
+ ```
65
+
66
+ **Perfect for:**
67
+
68
+ - ✅ n8n workflows and automation
69
+ - Zapier, Make.com integrations
70
+ - ✅ Custom web applications
71
+ - ✅ Backend APIs
72
+
73
+ **👉 Full HTTP setup guide:** [deployment/docs/01-INSTALL.md](./deployment/docs/01-INSTALL.md)
74
+
75
+ ---
76
+
77
+ ### 2️⃣ **MCP stdio** (For Claude Code, Cursor, Codex)
78
+
79
+ Use NotebookLM directly from your AI coding assistant:
80
+
81
+ ```bash
82
+ # Claude Code
83
+ claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
84
+
85
+ # Codex
86
+ codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
87
+
88
+ # Cursor (add to ~/.cursor/mcp.json)
89
+ {
90
+ "mcpServers": {
91
+ "notebooklm": {
92
+ "command": "npx",
93
+ "args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ **Perfect for:**
100
+
101
+ - ✅ Claude Code, Cursor, Codex
102
+ - Any MCP-compatible AI assistant
103
+ - ✅ Direct CLI integration
104
+
105
+ ---
106
+
107
+ ## The Problem
108
+
109
+ When you tell Claude Code or Cursor to "search through my local documentation", here's what happens:
110
+
111
+ - **Massive token consumption**: Searching through documentation means reading multiple files repeatedly
112
+ - **Inaccurate retrieval**: Searches for keywords, misses context and connections between docs
113
+ - **Hallucinations**: When it can't find something, it invents plausible-sounding APIs
114
+ - **Expensive & slow**: Each question requires re-reading multiple files
115
+
116
+ ## The Solution
117
+
118
+ Let your tools chat directly with [**NotebookLM**](https://notebooklm.google/) Google's **zero-hallucination knowledge base** powered by Gemini 2.5 that provides intelligent, synthesized answers from your docs.
119
+
120
+ ```
121
+ Your Task → Agent/n8n asks NotebookLM → Gemini synthesizes answer → Correct output
122
+ ```
123
+
124
+ **The real advantage**: No more manual copy-paste. Your agent/workflow asks NotebookLM directly and gets answers back. Build deep understanding through automatic follow-ups.
125
+
126
+ ---
127
+
128
+ ## Why NotebookLM, Not Local RAG?
129
+
130
+ | Approach | Token Cost | Setup Time | Hallucinations | Answer Quality |
131
+ | ----------------------- | ---------------------------------- | ---------------------------- | ----------------------------- | ------------------ |
132
+ | **Feed docs to Claude** | 🔴 Very high (multiple file reads) | Instant | Yes - fills gaps | Variable retrieval |
133
+ | **Web search** | 🟡 Medium | Instant | High - unreliable sources | Hit or miss |
134
+ | **Local RAG** | 🟡 Medium-High | Hours (embeddings, chunking) | Medium - retrieval gaps | Depends on setup |
135
+ | **NotebookLM MCP** | 🟢 Minimal | 5 minutes | **Zero** - refuses if unknown | Expert synthesis |
136
+
137
+ ### What Makes NotebookLM Superior?
138
+
139
+ 1. **Pre-processed by Gemini**: Upload docs once, get instant expert knowledge
140
+ 2. **Natural language Q&A**: Not just retrieval — actual understanding and synthesis
141
+ 3. **Multi-source correlation**: Connects information across 50+ documents
142
+ 4. **Citation-backed**: Every answer includes source references
143
+ 5. **No infrastructure**: No vector DBs, embeddings, or chunking strategies needed
144
+
145
+ ---
146
+
147
+ ## HTTP REST API
148
+
149
+ ### Quick Start
150
+
151
+ ```powershell
152
+ # 1. Clone and install
153
+ git clone <repo-url> D:\notebooklm-http
154
+ cd D:\notebooklm-http
155
+ npm install
156
+ npm run build
157
+
158
+ # 2. Configure authentication (one-time)
159
+ npm run setup-auth
160
+ # Chrome opens → log in with Google → close Chrome
161
+
162
+ # 3. Start the server
163
+
164
+ # Option A: Foreground mode (terminal stays open)
165
+ npm run start:http
166
+
167
+ # Option B: Background daemon mode (recommended for production)
168
+ npm run daemon:start # Start in background
169
+ npm run daemon:logs # View logs
170
+ npm run daemon:status # Check status
171
+ npm run daemon:stop # Stop server
172
+
173
+ # 4. Add your first notebook (in another terminal if using Option A)
174
+ curl -X POST http://localhost:3000/notebooks \
175
+ -H "Content-Type: application/json" \
176
+ -d '{
177
+ "url": "https://notebooklm.google.com/notebook/YOUR-NOTEBOOK-ID",
178
+ "name": "My Knowledge Base",
179
+ "description": "My documentation",
180
+ "topics": ["docs", "api"]
181
+ }'
182
+
183
+ # 5. Query NotebookLM
184
+ curl -X POST http://localhost:3000/ask \
185
+ -H "Content-Type: application/json" \
186
+ -d '{"question": "Explain X"}'
187
+
188
+ # 6. Validate installation (optional)
189
+ .\deployment\scripts\test-server.ps1
190
+ ```
191
+
192
+ **👉 See [Testing Guide](./deployment/scripts/README.md) for automated test suite**
193
+
194
+ ### API Endpoints
195
+
196
+ | Method | Endpoint | Description |
197
+ | -------- | -------------------------- | ----------------------------------- |
198
+ | `GET` | `/health` | Check server health |
199
+ | `POST` | `/ask` | Ask a question to NotebookLM |
200
+ | `GET` | `/notebooks` | List all notebooks |
201
+ | `POST` | `/notebooks` | Add notebook (with live validation) |
202
+ | `POST` | `/notebooks/auto-discover` | Auto-generate notebook metadata |
203
+ | `DELETE` | `/notebooks/:id` | Remove a notebook |
204
+ | `PUT` | `/notebooks/:id/activate` | Set active notebook |
205
+ | `GET` | `/sessions` | List active sessions |
206
+ | `DELETE` | `/sessions/:id` | Close a session |
207
+
208
+ **👉 Full API documentation:** [deployment/docs/03-API.md](./deployment/docs/03-API.md)
209
+
210
+ ### n8n Integration
211
+
212
+ Perfect for n8n workflows:
213
+
214
+ ```json
215
+ {
216
+ "nodes": [
217
+ {
218
+ "name": "Ask NotebookLM",
219
+ "type": "n8n-nodes-base.httpRequest",
220
+ "parameters": {
221
+ "method": "POST",
222
+ "url": "http://your-server:3000/ask",
223
+ "jsonParameters": true,
224
+ "bodyParametersJson": {
225
+ "question": "{{ $json.query }}",
226
+ "notebook_id": "my-notebook"
227
+ }
228
+ }
229
+ }
230
+ ]
231
+ }
232
+ ```
233
+
234
+ **👉 n8n guide:** [deployment/docs/04-N8N-INTEGRATION.md](./deployment/docs/04-N8N-INTEGRATION.md)
235
+
236
+ ---
237
+
238
+ ## 🔍 Auto-Discovery : Self-Organizing Documentation
239
+
240
+ Autonomous resource discovery enables AI orchestrators to find and use relevant documentation without manual intervention.
241
+
242
+ ### How it works
243
+
244
+ **1. Add notebook** (zero manual metadata):
245
+
246
+ ```bash
247
+ curl -X POST http://localhost:3000/notebooks/auto-discover \
248
+ -H "Content-Type: application/json" \
249
+ -d '{"url": "https://notebooklm.google.com/notebook/YOUR_ID"}'
250
+ ```
251
+
252
+ **2. System queries NotebookLM** to auto-generate:
253
+
254
+ - Kebab-case name (3 words max)
255
+ - Concise description (2 sentences)
256
+ - Relevant tags (8-10 keywords)
257
+
258
+ **3. Orchestrators discover autonomously**:
259
+
260
+ - Claude Code finds relevant docs without prompting
261
+ - n8n workflows auto-select documentation
262
+ - Cursor matches context to notebooks
263
+
264
+ ### Progressive disclosure pattern
265
+
266
+ Inspired by [Claude Skills best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#progressive-disclosure-patterns):
267
+
268
+ - **Level 0** (startup): Lightweight metadata loaded (~500 tokens)
269
+ - **Level 1** (matching): Local tag/description search (0 NotebookLM queries)
270
+ - **Level 2** (deep query): Targeted NotebookLM query only when needed
271
+
272
+ ### Why this matters
273
+
274
+ **Before**: Manual library management, orchestrators can't discover resources autonomously
275
+
276
+ **After**: Self-organizing library, autonomous documentation discovery
277
+
278
+ Perfect for:
279
+
280
+ - Teams with 10+ documentation notebooks
281
+ - ✅ n8n workflows needing dynamic doc access
282
+ - Claude Code autonomous research
283
+ - Onboarding new developers without manual setup
284
+
285
+ ### Example workflow
286
+
287
+ ```bash
288
+ # 1. Add documentation notebooks (auto-discover metadata)
289
+ curl -X POST /notebooks/auto-discover -d '{"url": "https://notebooklm.google.com/notebook/n8n-docs"}'
290
+ curl -X POST /notebooks/auto-discover -d '{"url": "https://notebooklm.google.com/notebook/react-guide"}'
291
+
292
+ # 2. Claude Code autonomously discovers relevant notebook
293
+ User: "Build Gmail automation with n8n"
294
+ → System matches: "n8n-docs" (tags: ["n8n", "gmail", "automation"])
295
+ Query NotebookLM: "Gmail node configuration?"
296
+ → Claude implements with accurate info
297
+
298
+ # 3. Zero hallucinations, zero manual intervention
299
+ ```
300
+
301
+ ---
302
+
303
+ ### Background Daemon Mode
304
+
305
+ Run the HTTP server as a background process without keeping a terminal window open:
306
+
307
+ ```bash
308
+ # Start server in background
309
+ npm run daemon:start
310
+
311
+ # View real-time logs
312
+ npm run daemon:logs
313
+
314
+ # Check server status
315
+ npm run daemon:status
316
+
317
+ # Restart server
318
+ npm run daemon:restart
319
+
320
+ # Stop server
321
+ npm run daemon:stop
322
+
323
+ # Remove from PM2 process list
324
+ npm run daemon:delete
325
+ ```
326
+
327
+ **Features:**
328
+
329
+ - Runs in background without terminal window
330
+ - Auto-restart on crash
331
+ - Centralized log management (logs/pm2-\*.log)
332
+ - ✅ Memory limit protection (1GB max)
333
+ - Production-ready process management
334
+
335
+ **Configuration:** Edit `ecosystem.config.cjs` to customize PM2 behavior (env vars, restart policy, etc.)
336
+
337
+ ### Installation & Documentation
338
+
339
+ - 📖 [**Installation Guide**](./deployment/docs/01-INSTALL.md) — Step-by-step setup
340
+ - 🔧 [**Configuration**](./deployment/docs/02-CONFIGURATION.md) — Environment variables, security
341
+ - 📡 [**API Reference**](./deployment/docs/03-API.md) — Complete endpoint documentation
342
+ - 📚 [**Notebook Library**](./deployment/docs/06-NOTEBOOK-LIBRARY.md) — Multi-notebook management
343
+ - [**Testing Suite**](./deployment/scripts/README.md) Automated validation scripts
344
+ - 🐛 [**Troubleshooting**](./deployment/docs/05-TROUBLESHOOTING.md) — Common issues
345
+
346
+ ---
347
+
348
+ ## MCP Installation
349
+
350
+ <details>
351
+ <summary>Claude Code</summary>
352
+
353
+ ```bash
354
+ claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
355
+ ```
356
+
357
+ </details>
358
+
359
+ <details>
360
+ <summary>Codex</summary>
361
+
362
+ ```bash
363
+ codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
364
+ ```
365
+
366
+ </details>
367
+
368
+ <details>
369
+ <summary>Gemini</summary>
370
+
371
+ ```bash
372
+ gemini mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
373
+ ```
374
+
375
+ </details>
376
+
377
+ <details>
378
+ <summary>Cursor</summary>
379
+
380
+ Add to `~/.cursor/mcp.json`:
381
+
382
+ ```json
383
+ {
384
+ "mcpServers": {
385
+ "notebooklm": {
386
+ "command": "npx",
387
+ "args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
388
+ }
389
+ }
390
+ }
391
+ ```
392
+
393
+ </details>
394
+
395
+ <details>
396
+ <summary>amp</summary>
397
+
398
+ ```bash
399
+ amp mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
400
+ ```
401
+
402
+ </details>
403
+
404
+ <details>
405
+ <summary>VS Code</summary>
406
+
407
+ ```bash
408
+ code --add-mcp '{"name":"notebooklm","command":"npx","args":["@roomi-fields/notebooklm-mcp@latest"]}'
409
+ ```
410
+
411
+ </details>
412
+
413
+ <details>
414
+ <summary>Other MCP clients</summary>
415
+
416
+ **Generic MCP config:**
417
+
418
+ ```json
419
+ {
420
+ "mcpServers": {
421
+ "notebooklm": {
422
+ "command": "npx",
423
+ "args": ["@roomi-fields/notebooklm-mcp@latest"]
424
+ }
425
+ }
426
+ }
427
+ ```
428
+
429
+ </details>
430
+
431
+ ### MCP Quick Start
432
+
433
+ 1. **Install** the MCP server (see above)
434
+
435
+ 2. **Authenticate** (one-time)
436
+
437
+ Say in your chat (Claude/Codex):
438
+
439
+ ```
440
+ "Log me in to NotebookLM"
441
+ ```
442
+
443
+ _A Chrome window opens log in with Google_
444
+
445
+ 3. **Create your knowledge base**
446
+
447
+ Go to [notebooklm.google.com](https://notebooklm.google.com) Create notebook Upload your docs:
448
+
449
+ - 📄 PDFs, Google Docs, markdown files
450
+ - 🔗 Websites, GitHub repos
451
+ - 🎥 YouTube videos
452
+ - 📚 Multiple sources per notebook
453
+
454
+ Share: **⚙️ Share Anyone with link Copy**
455
+
456
+ 4. **Let Claude use it**
457
+
458
+ ```
459
+ "I'm building with [library]. Here's my NotebookLM: [link]"
460
+ ```
461
+
462
+ **That's it.** Claude now asks NotebookLM whatever it needs, building expertise before writing code.
463
+
464
+ ---
465
+
466
+ ## Related Project: Claude Code Skill (by original author)
467
+
468
+ The original author [PleasePrompto](https://github.com/PleasePrompto) also created a **Python-based Claude Code Skill** as an alternative approach:
469
+
470
+ 🔗 **[NotebookLM Claude Code Skill](https://github.com/PleasePrompto/notebooklm-skill)** - Python skill for Claude Code
471
+
472
+ ### When to use which approach?
473
+
474
+ | Feature | This Project (MCP + HTTP) | Original Skill (Python) |
475
+ | ----------------- | ------------------------------------------------------------ | ---------------------------- |
476
+ | **Protocol** | MCP (Model Context Protocol) | Claude Skills |
477
+ | **Installation** | `claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp` | Clone to `~/.claude/skills/` |
478
+ | **Sessions** | ✅ Persistent browser sessions | Fresh browser per query |
479
+ | **Compatibility** | ✅ Claude Code, Cursor, Codex, any MCP client | Claude Code only |
480
+ | **HTTP API** | ✅ Works with n8n, Zapier, Make.com | ❌ Not available |
481
+ | **Language** | TypeScript | Python |
482
+ | **Use case** | Long conversations, automation workflows | Quick one-off queries |
483
+
484
+ ### Which one should you choose?
485
+
486
+ - **Use this MCP project** if you want:
487
+ - Persistent sessions (faster repeated queries)
488
+ - Compatibility with multiple tools (Cursor, Codex, etc.)
489
+ - HTTP REST API for n8n/Zapier automation
490
+ - TypeScript-based development
491
+
492
+ - **Use the original Skill** if you prefer:
493
+ - Python-based workflow
494
+ - Simpler clone-and-use installation
495
+ - Stateless queries (no session management)
496
+ - Only using Claude Code locally
497
+
498
+ Both use the same Patchright browser automation technology and provide zero-hallucination answers from NotebookLM.
499
+
500
+ ---
501
+
502
+ ## Real-World Example
503
+
504
+ ### Building an n8n Workflow Without Hallucinations
505
+
506
+ **Challenge**: n8n's API is new — Claude hallucinates node names and functions.
507
+
508
+ **Solution**:
509
+
510
+ 1. Downloaded complete n8n documentation → merged into manageable chunks
511
+ 2. Uploaded to NotebookLM
512
+ 3. Told Claude: _"Build me a Gmail spam filter workflow. Use this NotebookLM: [link]"_
513
+
514
+ **Watch the AI-to-AI conversation:**
515
+
516
+ ```
517
+ Claude "How does Gmail integration work in n8n?"
518
+ NotebookLM "Use Gmail Trigger with polling, or Gmail node with Get Many..."
519
+
520
+ Claude "How to decode base64 email body?"
521
+ NotebookLM "Body is base64url encoded in payload.parts, use Function node..."
522
+
523
+ Claude "How to parse OpenAI response as JSON?"
524
+ NotebookLM "Set responseFormat to json, use {{ $json.spam }} in IF node..."
525
+
526
+ Claude "What about error handling if the API fails?"
527
+ NotebookLM → "Use Error Trigger node with Continue On Fail enabled..."
528
+
529
+ Claude "Here's your complete workflow JSON..."
530
+ ```
531
+
532
+ **Result**: Perfect workflow on first try. No debugging hallucinated APIs.
533
+
534
+ ---
535
+
536
+ ## Core Features
537
+
538
+ ### **Zero Hallucinations**
539
+
540
+ NotebookLM refuses to answer if information isn't in your docs. No invented APIs.
541
+
542
+ ### **Multi-Notebook Library**
543
+
544
+ Manage multiple NotebookLM notebooks with automatic validation, duplicate detection, and smart selection.
545
+
546
+ ### **Autonomous Research**
547
+
548
+ Claude asks follow-up questions automatically, building complete understanding before coding.
549
+
550
+ ### **Deep, Iterative Research**
551
+
552
+ - Claude automatically asks follow-up questions to build complete understanding
553
+ - Each answer triggers deeper questions until Claude has all the details
554
+ - Example: For n8n workflow, Claude asked multiple sequential questions about Gmail integration, error handling, and data transformation
555
+
556
+ ### **HTTP REST API**
557
+
558
+ Use NotebookLM from n8n, Zapier, Make.com, or any HTTP client. No MCP required.
559
+
560
+ ### **Cross-Tool Sharing**
561
+
562
+ Set up once, use everywhere. Claude Code, Codex, Cursor, n8n — all can access the same library.
563
+
564
+ ---
565
+
566
+ ## Architecture
567
+
568
+ ```mermaid
569
+ graph LR
570
+ A[Your Task] --> B[Claude/n8n/HTTP Client]
571
+ B --> C[MCP/HTTP Server]
572
+ C --> D[Chrome Automation]
573
+ D --> E[NotebookLM]
574
+ E --> F[Gemini 2.5]
575
+ F --> G[Your Docs]
576
+ G --> F
577
+ F --> E
578
+ E --> D
579
+ D --> C
580
+ C --> B
581
+ B --> H[Accurate Output]
582
+ ```
583
+
584
+ ---
585
+
586
+ ## Common Commands (MCP Mode)
587
+
588
+ | Intent | Say | Result |
589
+ | --------------- | ------------------------------------------------------------- | -------------------------------- |
590
+ | Authenticate | _"Open NotebookLM auth setup"_ or _"Log me in to NotebookLM"_ | Chrome opens for login |
591
+ | Add notebook | _"Add [link] to library"_ | Saves notebook with metadata |
592
+ | List notebooks | _"Show our notebooks"_ | Lists all saved notebooks |
593
+ | Research first | _"Research this in NotebookLM before coding"_ | Multi-question session |
594
+ | Select notebook | _"Use the React notebook"_ | Sets active notebook |
595
+ | Update notebook | _"Update notebook tags"_ | Modify metadata |
596
+ | Remove notebook | _"Remove [notebook] from library"_ | Deletes from library |
597
+ | View browser | _"Show me the browser"_ | Watch live NotebookLM chat |
598
+ | Fix auth | _"Repair NotebookLM authentication"_ | Clears and re-authenticates |
599
+ | Switch account | _"Re-authenticate with different Google account"_ | Changes account |
600
+ | Clean restart | _"Run NotebookLM cleanup"_ | Removes all data for fresh start |
601
+
602
+ ---
603
+
604
+ ## Comparison to Alternatives
605
+
606
+ ### vs. Downloading docs locally
607
+
608
+ - **You**: Download docs Claude: "search through these files"
609
+ - **Problem**: Claude reads thousands of files → massive token usage, often misses connections
610
+ - **NotebookLM**: Pre-indexed by Gemini, semantic understanding across all docs
611
+
612
+ ### vs. Web search
613
+
614
+ - **You**: "Research X online"
615
+ - **Problem**: Outdated info, hallucinated examples, unreliable sources
616
+ - **NotebookLM**: Only your trusted docs, always current, with citations
617
+
618
+ ### vs. Local RAG setup
619
+
620
+ - **You**: Set up embeddings, vector DB, chunking strategy, retrieval pipeline
621
+ - **Problem**: Hours of setup, tuning retrieval, still gets "creative" with gaps
622
+ - **NotebookLM**: Upload docs → done. Google handles everything.
623
+
624
+ ---
625
+
626
+ ## FAQ
627
+
628
+ **Is it really zero hallucinations?**
629
+ Yes. NotebookLM is specifically designed to only answer from uploaded sources. If it doesn't know, it says so.
630
+
631
+ **What about rate limits?**
632
+ Free tier has daily query limits per Google account. Quick account switching supported for continued research.
633
+
634
+ **How secure is this?**
635
+ Chrome runs locally. Your credentials never leave your machine. Use a dedicated Google account if concerned.
636
+
637
+ **Can I see what's happening?**
638
+ Yes! Say _"Show me the browser"_ (MCP mode) or set `HEADLESS=false` (HTTP mode) to watch the live NotebookLM conversation.
639
+
640
+ **What makes this better than Claude's built-in knowledge?**
641
+ Your docs are always current. No training cutoff. No hallucinations. Perfect for new libraries, internal APIs, or fast-moving projects.
642
+
643
+ ---
644
+
645
+ ## The Bottom Line
646
+
647
+ **Without NotebookLM**: Write code Find it's wrong Debug hallucinated APIs → Repeat
648
+
649
+ **With NotebookLM**: Research first Write correct code Ship faster
650
+
651
+ Stop debugging hallucinations. Start shipping accurate code.
652
+
653
+ ---
654
+
655
+ ## Disclaimer
656
+
657
+ This tool automates browser interactions with NotebookLM to make your workflow more efficient. However, a few friendly reminders:
658
+
659
+ **About browser automation:**
660
+ While I've built in humanization features (realistic typing speeds, natural delays, mouse movements) to make the automation behave more naturally, I can't guarantee Google won't detect or flag automated usage. I recommend using a dedicated Google account for automation rather than your primary account—think of it like web scraping: probably fine, but better safe than sorry!
661
+
662
+ **About CLI tools and AI agents:**
663
+ CLI tools like Claude Code, Codex, and similar AI-powered assistants are incredibly powerful, but they can make mistakes. Please use them with care and awareness:
664
+
665
+ - Always review changes before committing or deploying
666
+ - Test in safe environments first
667
+ - Keep backups of important work
668
+ - Remember: AI agents are assistants, not infallible oracles
669
+
670
+ I built this tool for myself because I was tired of the copy-paste dance between NotebookLM and my editor. I'm sharing it in the hope it helps others too, but I can't take responsibility for any issues, data loss, or account problems that might occur. Use at your own discretion and judgment.
671
+
672
+ That said, if you run into problems or have questions, feel free to open an issue on GitHub. I'm happy to help troubleshoot!
673
+
674
+ ---
675
+
676
+ ## Roadmap
677
+
678
+ ### Implemented in v1.3.2
679
+
680
+ **🤖 Auto-Discovery: Autonomous Resource Discovery**
681
+
682
+ - Automatically generate notebook name, description, and tags via NotebookLM
683
+ - Progressive disclosure pattern inspired by Claude Skills best practices
684
+ - ✅ Zero-friction notebook addition (30 seconds vs 5 minutes)
685
+ - ✅ Validation of auto-generated metadata (kebab-case, description length, tags count)
686
+ - Orchestrators discover relevant documentation autonomously
687
+
688
+ **👉 See [Auto-Discovery Documentation](./deployment/docs/07-AUTO-DISCOVERY.md) for details**
689
+
690
+ ### 🔧 Minor Fixes (v1.3.5)
691
+
692
+ **Cosmetic improvements:**
693
+
694
+ - Fix PowerShell `CursorPosition` error in test scripts (non-interactive terminal)
695
+ - Add strict type validation for `show_browser` parameter (return 400 on invalid types)
696
+
697
+ ### 🔜 Planned for v1.4.0+
698
+
699
+ **🔥 Separate Chrome Profiles by Mode (Priority):**
700
+
701
+ - Enable HTTP and MCP stdio modes to run simultaneously
702
+ - Automatic profile detection: `chrome_profile_http` vs `chrome_profile_stdio`
703
+ - No user configuration needed - just works
704
+ - Solves Chrome profile locking issue for dual-mode users
705
+ - **👉 See [Chrome Profile Limitation](./docs/CHROME_PROFILE_LIMITATION.md) for details**
706
+
707
+ **Smart Metadata Refresh:**
708
+
709
+ - Auto-detect when notebook content has changed
710
+ - Re-query NotebookLM to update metadata
711
+ - Endpoint: `PATCH /notebooks/:id/refresh`
712
+
713
+ **Semantic Matching:**
714
+
715
+ - Use embeddings for advanced notebook matching beyond tags
716
+ - Endpoint: `GET /notebooks/match?query=gmail&semantic=true`
717
+
718
+ **Usage Analytics:**
719
+
720
+ - Track which notebooks are queried together
721
+ - Suggest related notebooks based on usage patterns
722
+ - Endpoint: `GET /notebooks/:id/related`
723
+
724
+ ### 🚀 Previously Implemented
725
+
726
+ **✅ PM2 Daemon Mode (v1.1.2):**
727
+
728
+ - Cross-platform process manager with auto-restart
729
+ - Commands: `npm run daemon:start`, `daemon:logs`, `daemon:status`
730
+ - Built-in log rotation and monitoring
731
+
732
+ **✅ Multi-Notebook Library (v1.1.2):**
733
+
734
+ - Live validation of notebooks
735
+ - Duplicate detection
736
+ - Smart notebook selection
737
+
738
+ ### 💡 Have an idea?
739
+
740
+ [Open a discussion](https://github.com/roomi-fields/notebooklm-mcp/discussions) to suggest new features!
741
+
742
+ ---
743
+
744
+ ## Contributing
745
+
746
+ Found a bug? Have a feature idea? [Open an issue](https://github.com/roomi-fields/notebooklm-mcp/issues) or submit a PR!
747
+
748
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
749
+
750
+ ## License
751
+
752
+ MIT — Use freely in your projects.
753
+
754
+ See [LICENSE](./LICENSE) for details.
755
+
756
+ ---
757
+
758
+ <div align="center">
759
+
760
+ Built with frustration about hallucinated APIs, powered by Google's NotebookLM
761
+
762
+ ⭐ [Star on GitHub](https://github.com/roomi-fields/notebooklm-mcp) if this saves you debugging time!
763
+
764
+ </div>