@roomi-fields/notebooklm-mcp 1.1.2
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.
- package/LICENSE +22 -0
- package/README.md +548 -0
- package/dist/auth/auth-manager.d.ts +139 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.js +981 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/config.d.ts +89 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +216 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/http-wrapper.d.ts +8 -0
- package/dist/http-wrapper.d.ts.map +1 -0
- package/dist/http-wrapper.js +221 -0
- package/dist/http-wrapper.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +499 -0
- package/dist/index.js.map +1 -0
- package/dist/library/notebook-library.d.ts +81 -0
- package/dist/library/notebook-library.d.ts.map +1 -0
- package/dist/library/notebook-library.js +362 -0
- package/dist/library/notebook-library.js.map +1 -0
- package/dist/library/types.d.ts +67 -0
- package/dist/library/types.d.ts.map +1 -0
- package/dist/library/types.js +8 -0
- package/dist/library/types.js.map +1 -0
- package/dist/session/browser-session.d.ts +108 -0
- package/dist/session/browser-session.d.ts.map +1 -0
- package/dist/session/browser-session.js +630 -0
- package/dist/session/browser-session.js.map +1 -0
- package/dist/session/session-manager.d.ts +76 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +273 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/shared-context-manager.d.ts +107 -0
- package/dist/session/shared-context-manager.d.ts.map +1 -0
- package/dist/session/shared-context-manager.js +447 -0
- package/dist/session/shared-context-manager.js.map +1 -0
- package/dist/tools/index.d.ts +225 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +1396 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +133 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +673 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +92 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/page-utils.d.ts +54 -0
- package/dist/utils/page-utils.d.ts.map +1 -0
- package/dist/utils/page-utils.js +422 -0
- package/dist/utils/page-utils.js.map +1 -0
- package/dist/utils/stealth-utils.d.ts +135 -0
- package/dist/utils/stealth-utils.d.ts.map +1 -0
- package/dist/utils/stealth-utils.js +398 -0
- package/dist/utils/stealth-utils.js.map +1 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Please Prompto! (Original NotebookLM MCP Server)
|
|
4
|
+
Copyright (c) 2025 Romain Peyrichou - HTTP REST API Wrapper (Developed with Claude Code - Anthropic Claude Sonnet 4.5)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# NotebookLM MCP Server
|
|
4
|
+
|
|
5
|
+
**Chat directly with NotebookLM for zero-hallucination answers based on your own notebooks**
|
|
6
|
+
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://modelcontextprotocol.io/)
|
|
9
|
+
[](https://www.npmjs.com/package/@roomi-fields/notebooklm-mcp)
|
|
10
|
+
[](https://github.com/roomi-fields/notebooklm-mcp-http)
|
|
11
|
+
|
|
12
|
+
[MCP Installation](#mcp-installation) • [HTTP REST API](#http-rest-api) • [Why NotebookLM](#why-notebooklm-not-local-rag) • [Examples](#real-world-example) • [Documentation](./deployment/docs/)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🚀 Two Ways to Use This Server
|
|
19
|
+
|
|
20
|
+
### 1️⃣ **HTTP REST API** (New! Recommended for n8n, Zapier, Make.com)
|
|
21
|
+
|
|
22
|
+
Use NotebookLM from **any tool** via HTTP REST API:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install and start HTTP server
|
|
26
|
+
npm install
|
|
27
|
+
npm run build
|
|
28
|
+
npm run start:http
|
|
29
|
+
|
|
30
|
+
# Query NotebookLM via REST
|
|
31
|
+
curl -X POST http://localhost:3000/ask \
|
|
32
|
+
-H "Content-Type: application/json" \
|
|
33
|
+
-d '{"question": "Explain X", "notebook_id": "my-notebook"}'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Perfect for:**
|
|
37
|
+
- ✅ n8n workflows and automation
|
|
38
|
+
- ✅ Zapier, Make.com integrations
|
|
39
|
+
- ✅ Custom web applications
|
|
40
|
+
- ✅ Backend APIs
|
|
41
|
+
|
|
42
|
+
**👉 Full HTTP setup guide:** [deployment/docs/01-INSTALL.md](./deployment/docs/01-INSTALL.md)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### 2️⃣ **MCP stdio** (For Claude Code, Cursor, Codex)
|
|
47
|
+
|
|
48
|
+
Use NotebookLM directly from your AI coding assistant:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Claude Code
|
|
52
|
+
claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
|
|
53
|
+
|
|
54
|
+
# Codex
|
|
55
|
+
codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
|
|
56
|
+
|
|
57
|
+
# Cursor (add to ~/.cursor/mcp.json)
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"notebooklm": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Perfect for:**
|
|
69
|
+
- ✅ Claude Code, Cursor, Codex
|
|
70
|
+
- ✅ Any MCP-compatible AI assistant
|
|
71
|
+
- ✅ Direct CLI integration
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## The Problem
|
|
76
|
+
|
|
77
|
+
When you tell Claude Code or Cursor to "search through my local documentation", here's what happens:
|
|
78
|
+
- **Massive token consumption**: Searching through documentation means reading multiple files repeatedly
|
|
79
|
+
- **Inaccurate retrieval**: Searches for keywords, misses context and connections between docs
|
|
80
|
+
- **Hallucinations**: When it can't find something, it invents plausible-sounding APIs
|
|
81
|
+
- **Expensive & slow**: Each question requires re-reading multiple files
|
|
82
|
+
|
|
83
|
+
## The Solution
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Your Task → Agent/n8n asks NotebookLM → Gemini synthesizes answer → Correct output
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**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.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Why NotebookLM, Not Local RAG?
|
|
96
|
+
|
|
97
|
+
| Approach | Token Cost | Setup Time | Hallucinations | Answer Quality |
|
|
98
|
+
|----------|------------|------------|----------------|----------------|
|
|
99
|
+
| **Feed docs to Claude** | 🔴 Very high (multiple file reads) | Instant | Yes - fills gaps | Variable retrieval |
|
|
100
|
+
| **Web search** | 🟡 Medium | Instant | High - unreliable sources | Hit or miss |
|
|
101
|
+
| **Local RAG** | 🟡 Medium-High | Hours (embeddings, chunking) | Medium - retrieval gaps | Depends on setup |
|
|
102
|
+
| **NotebookLM MCP** | 🟢 Minimal | 5 minutes | **Zero** - refuses if unknown | Expert synthesis |
|
|
103
|
+
|
|
104
|
+
### What Makes NotebookLM Superior?
|
|
105
|
+
|
|
106
|
+
1. **Pre-processed by Gemini**: Upload docs once, get instant expert knowledge
|
|
107
|
+
2. **Natural language Q&A**: Not just retrieval — actual understanding and synthesis
|
|
108
|
+
3. **Multi-source correlation**: Connects information across 50+ documents
|
|
109
|
+
4. **Citation-backed**: Every answer includes source references
|
|
110
|
+
5. **No infrastructure**: No vector DBs, embeddings, or chunking strategies needed
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## HTTP REST API
|
|
115
|
+
|
|
116
|
+
### Quick Start
|
|
117
|
+
|
|
118
|
+
```powershell
|
|
119
|
+
# 1. Clone and install
|
|
120
|
+
git clone <repo-url> D:\notebooklm-http
|
|
121
|
+
cd D:\notebooklm-http
|
|
122
|
+
npm install
|
|
123
|
+
npm run build
|
|
124
|
+
|
|
125
|
+
# 2. Configure authentication (one-time)
|
|
126
|
+
npm run setup-auth
|
|
127
|
+
# Chrome opens → log in with Google → close Chrome
|
|
128
|
+
|
|
129
|
+
# 3. Add your first notebook
|
|
130
|
+
npm run start:http
|
|
131
|
+
# In another terminal:
|
|
132
|
+
curl -X POST http://localhost:3000/notebooks \
|
|
133
|
+
-H "Content-Type: application/json" \
|
|
134
|
+
-d '{
|
|
135
|
+
"url": "https://notebooklm.google.com/notebook/YOUR-NOTEBOOK-ID",
|
|
136
|
+
"name": "My Knowledge Base",
|
|
137
|
+
"description": "My documentation",
|
|
138
|
+
"topics": ["docs", "api"]
|
|
139
|
+
}'
|
|
140
|
+
|
|
141
|
+
# 4. Query NotebookLM
|
|
142
|
+
curl -X POST http://localhost:3000/ask \
|
|
143
|
+
-H "Content-Type: application/json" \
|
|
144
|
+
-d '{"question": "Explain X"}'
|
|
145
|
+
|
|
146
|
+
# 5. Validate installation (optional)
|
|
147
|
+
.\deployment\scripts\test-server.ps1
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**👉 See [Testing Guide](./deployment/scripts/README.md) for automated test suite**
|
|
151
|
+
|
|
152
|
+
### API Endpoints
|
|
153
|
+
|
|
154
|
+
| Method | Endpoint | Description |
|
|
155
|
+
|--------|----------|-------------|
|
|
156
|
+
| `GET` | `/health` | Check server health |
|
|
157
|
+
| `POST` | `/ask` | Ask a question to NotebookLM |
|
|
158
|
+
| `GET` | `/notebooks` | List all notebooks |
|
|
159
|
+
| `POST` | `/notebooks` | Add notebook (with live validation) |
|
|
160
|
+
| `DELETE` | `/notebooks/:id` | Remove a notebook |
|
|
161
|
+
| `PUT` | `/notebooks/:id/activate` | Set active notebook |
|
|
162
|
+
| `GET` | `/sessions` | List active sessions |
|
|
163
|
+
| `DELETE` | `/sessions/:id` | Close a session |
|
|
164
|
+
|
|
165
|
+
**👉 Full API documentation:** [deployment/docs/03-API.md](./deployment/docs/03-API.md)
|
|
166
|
+
|
|
167
|
+
### n8n Integration
|
|
168
|
+
|
|
169
|
+
Perfect for n8n workflows:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"nodes": [
|
|
174
|
+
{
|
|
175
|
+
"name": "Ask NotebookLM",
|
|
176
|
+
"type": "n8n-nodes-base.httpRequest",
|
|
177
|
+
"parameters": {
|
|
178
|
+
"method": "POST",
|
|
179
|
+
"url": "http://your-server:3000/ask",
|
|
180
|
+
"jsonParameters": true,
|
|
181
|
+
"bodyParametersJson": {
|
|
182
|
+
"question": "{{ $json.query }}",
|
|
183
|
+
"notebook_id": "my-notebook"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**👉 n8n guide:** [deployment/docs/04-N8N-INTEGRATION.md](./deployment/docs/04-N8N-INTEGRATION.md)
|
|
192
|
+
|
|
193
|
+
### Installation & Documentation
|
|
194
|
+
|
|
195
|
+
- 📖 [**Installation Guide**](./deployment/docs/01-INSTALL.md) — Step-by-step setup
|
|
196
|
+
- 🔧 [**Configuration**](./deployment/docs/02-CONFIGURATION.md) — Environment variables, security
|
|
197
|
+
- 📡 [**API Reference**](./deployment/docs/03-API.md) — Complete endpoint documentation
|
|
198
|
+
- 📚 [**Notebook Library**](./deployment/docs/06-NOTEBOOK-LIBRARY.md) — Multi-notebook management
|
|
199
|
+
- ✅ [**Testing Suite**](./deployment/scripts/README.md) — Automated validation scripts
|
|
200
|
+
- 🐛 [**Troubleshooting**](./deployment/docs/05-TROUBLESHOOTING.md) — Common issues
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## MCP Installation
|
|
205
|
+
|
|
206
|
+
<details>
|
|
207
|
+
<summary>Claude Code</summary>
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
claude mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
|
|
211
|
+
```
|
|
212
|
+
</details>
|
|
213
|
+
|
|
214
|
+
<details>
|
|
215
|
+
<summary>Codex</summary>
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
codex mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
|
|
219
|
+
```
|
|
220
|
+
</details>
|
|
221
|
+
|
|
222
|
+
<details>
|
|
223
|
+
<summary>Gemini</summary>
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
gemini mcp add notebooklm npx @roomi-fields/notebooklm-mcp@latest
|
|
227
|
+
```
|
|
228
|
+
</details>
|
|
229
|
+
|
|
230
|
+
<details>
|
|
231
|
+
<summary>Cursor</summary>
|
|
232
|
+
|
|
233
|
+
Add to `~/.cursor/mcp.json`:
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"mcpServers": {
|
|
237
|
+
"notebooklm": {
|
|
238
|
+
"command": "npx",
|
|
239
|
+
"args": ["-y", "@roomi-fields/notebooklm-mcp@latest"]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
</details>
|
|
245
|
+
|
|
246
|
+
<details>
|
|
247
|
+
<summary>amp</summary>
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
amp mcp add notebooklm -- npx @roomi-fields/notebooklm-mcp@latest
|
|
251
|
+
```
|
|
252
|
+
</details>
|
|
253
|
+
|
|
254
|
+
<details>
|
|
255
|
+
<summary>VS Code</summary>
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
code --add-mcp '{"name":"notebooklm","command":"npx","args":["@roomi-fields/notebooklm-mcp@latest"]}'
|
|
259
|
+
```
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
<details>
|
|
263
|
+
<summary>Other MCP clients</summary>
|
|
264
|
+
|
|
265
|
+
**Generic MCP config:**
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"mcpServers": {
|
|
269
|
+
"notebooklm": {
|
|
270
|
+
"command": "npx",
|
|
271
|
+
"args": ["@roomi-fields/notebooklm-mcp@latest"]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
</details>
|
|
277
|
+
|
|
278
|
+
### MCP Quick Start
|
|
279
|
+
|
|
280
|
+
1. **Install** the MCP server (see above)
|
|
281
|
+
|
|
282
|
+
2. **Authenticate** (one-time)
|
|
283
|
+
|
|
284
|
+
Say in your chat (Claude/Codex):
|
|
285
|
+
```
|
|
286
|
+
"Log me in to NotebookLM"
|
|
287
|
+
```
|
|
288
|
+
*A Chrome window opens → log in with Google*
|
|
289
|
+
|
|
290
|
+
3. **Create your knowledge base**
|
|
291
|
+
|
|
292
|
+
Go to [notebooklm.google.com](https://notebooklm.google.com) → Create notebook → Upload your docs:
|
|
293
|
+
- 📄 PDFs, Google Docs, markdown files
|
|
294
|
+
- 🔗 Websites, GitHub repos
|
|
295
|
+
- 🎥 YouTube videos
|
|
296
|
+
- 📚 Multiple sources per notebook
|
|
297
|
+
|
|
298
|
+
Share: **⚙️ Share → Anyone with link → Copy**
|
|
299
|
+
|
|
300
|
+
4. **Let Claude use it**
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
"I'm building with [library]. Here's my NotebookLM: [link]"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**That's it.** Claude now asks NotebookLM whatever it needs, building expertise before writing code.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Alternative: Claude Code Skill
|
|
311
|
+
|
|
312
|
+
**Prefer Claude Code Skills over MCP?** This server is now also available as a native Claude Code Skill with a simpler setup:
|
|
313
|
+
|
|
314
|
+
**NotebookLM Claude Code Skill** - Available separately for advanced Claude Code workflows
|
|
315
|
+
|
|
316
|
+
**Key differences:**
|
|
317
|
+
- **MCP Server** (this repo): Persistent sessions, works with Claude Code, Codex, Cursor, and other MCP clients
|
|
318
|
+
- **HTTP REST API** (this repo): Works with n8n, Zapier, Make.com, any HTTP client
|
|
319
|
+
- **Claude Code Skill**: Simpler setup, Python-based, stateless queries, works only with local Claude Code
|
|
320
|
+
|
|
321
|
+
All use the same browser automation technology and provide zero-hallucination answers from your NotebookLM notebooks.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Real-World Example
|
|
326
|
+
|
|
327
|
+
### Building an n8n Workflow Without Hallucinations
|
|
328
|
+
|
|
329
|
+
**Challenge**: n8n's API is new — Claude hallucinates node names and functions.
|
|
330
|
+
|
|
331
|
+
**Solution**:
|
|
332
|
+
1. Downloaded complete n8n documentation → merged into manageable chunks
|
|
333
|
+
2. Uploaded to NotebookLM
|
|
334
|
+
3. Told Claude: *"Build me a Gmail spam filter workflow. Use this NotebookLM: [link]"*
|
|
335
|
+
|
|
336
|
+
**Watch the AI-to-AI conversation:**
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
Claude → "How does Gmail integration work in n8n?"
|
|
340
|
+
NotebookLM → "Use Gmail Trigger with polling, or Gmail node with Get Many..."
|
|
341
|
+
|
|
342
|
+
Claude → "How to decode base64 email body?"
|
|
343
|
+
NotebookLM → "Body is base64url encoded in payload.parts, use Function node..."
|
|
344
|
+
|
|
345
|
+
Claude → "How to parse OpenAI response as JSON?"
|
|
346
|
+
NotebookLM → "Set responseFormat to json, use {{ $json.spam }} in IF node..."
|
|
347
|
+
|
|
348
|
+
Claude → "What about error handling if the API fails?"
|
|
349
|
+
NotebookLM → "Use Error Trigger node with Continue On Fail enabled..."
|
|
350
|
+
|
|
351
|
+
Claude → ✅ "Here's your complete workflow JSON..."
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Result**: Perfect workflow on first try. No debugging hallucinated APIs.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Core Features
|
|
359
|
+
|
|
360
|
+
### **Zero Hallucinations**
|
|
361
|
+
NotebookLM refuses to answer if information isn't in your docs. No invented APIs.
|
|
362
|
+
|
|
363
|
+
### **Multi-Notebook Library**
|
|
364
|
+
Manage multiple NotebookLM notebooks with automatic validation, duplicate detection, and smart selection.
|
|
365
|
+
|
|
366
|
+
### **Autonomous Research**
|
|
367
|
+
Claude asks follow-up questions automatically, building complete understanding before coding.
|
|
368
|
+
|
|
369
|
+
### **Deep, Iterative Research**
|
|
370
|
+
- Claude automatically asks follow-up questions to build complete understanding
|
|
371
|
+
- Each answer triggers deeper questions until Claude has all the details
|
|
372
|
+
- Example: For n8n workflow, Claude asked multiple sequential questions about Gmail integration, error handling, and data transformation
|
|
373
|
+
|
|
374
|
+
### **HTTP REST API**
|
|
375
|
+
Use NotebookLM from n8n, Zapier, Make.com, or any HTTP client. No MCP required.
|
|
376
|
+
|
|
377
|
+
### **Cross-Tool Sharing**
|
|
378
|
+
Set up once, use everywhere. Claude Code, Codex, Cursor, n8n — all can access the same library.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Architecture
|
|
383
|
+
|
|
384
|
+
```mermaid
|
|
385
|
+
graph LR
|
|
386
|
+
A[Your Task] --> B[Claude/n8n/HTTP Client]
|
|
387
|
+
B --> C[MCP/HTTP Server]
|
|
388
|
+
C --> D[Chrome Automation]
|
|
389
|
+
D --> E[NotebookLM]
|
|
390
|
+
E --> F[Gemini 2.5]
|
|
391
|
+
F --> G[Your Docs]
|
|
392
|
+
G --> F
|
|
393
|
+
F --> E
|
|
394
|
+
E --> D
|
|
395
|
+
D --> C
|
|
396
|
+
C --> B
|
|
397
|
+
B --> H[Accurate Output]
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Common Commands (MCP Mode)
|
|
403
|
+
|
|
404
|
+
| Intent | Say | Result |
|
|
405
|
+
|--------|-----|--------|
|
|
406
|
+
| Authenticate | *"Open NotebookLM auth setup"* or *"Log me in to NotebookLM"* | Chrome opens for login |
|
|
407
|
+
| Add notebook | *"Add [link] to library"* | Saves notebook with metadata |
|
|
408
|
+
| List notebooks | *"Show our notebooks"* | Lists all saved notebooks |
|
|
409
|
+
| Research first | *"Research this in NotebookLM before coding"* | Multi-question session |
|
|
410
|
+
| Select notebook | *"Use the React notebook"* | Sets active notebook |
|
|
411
|
+
| Update notebook | *"Update notebook tags"* | Modify metadata |
|
|
412
|
+
| Remove notebook | *"Remove [notebook] from library"* | Deletes from library |
|
|
413
|
+
| View browser | *"Show me the browser"* | Watch live NotebookLM chat |
|
|
414
|
+
| Fix auth | *"Repair NotebookLM authentication"* | Clears and re-authenticates |
|
|
415
|
+
| Switch account | *"Re-authenticate with different Google account"* | Changes account |
|
|
416
|
+
| Clean restart | *"Run NotebookLM cleanup"* | Removes all data for fresh start |
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Comparison to Alternatives
|
|
421
|
+
|
|
422
|
+
### vs. Downloading docs locally
|
|
423
|
+
- **You**: Download docs → Claude: "search through these files"
|
|
424
|
+
- **Problem**: Claude reads thousands of files → massive token usage, often misses connections
|
|
425
|
+
- **NotebookLM**: Pre-indexed by Gemini, semantic understanding across all docs
|
|
426
|
+
|
|
427
|
+
### vs. Web search
|
|
428
|
+
- **You**: "Research X online"
|
|
429
|
+
- **Problem**: Outdated info, hallucinated examples, unreliable sources
|
|
430
|
+
- **NotebookLM**: Only your trusted docs, always current, with citations
|
|
431
|
+
|
|
432
|
+
### vs. Local RAG setup
|
|
433
|
+
- **You**: Set up embeddings, vector DB, chunking strategy, retrieval pipeline
|
|
434
|
+
- **Problem**: Hours of setup, tuning retrieval, still gets "creative" with gaps
|
|
435
|
+
- **NotebookLM**: Upload docs → done. Google handles everything.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## FAQ
|
|
440
|
+
|
|
441
|
+
**Is it really zero hallucinations?**
|
|
442
|
+
Yes. NotebookLM is specifically designed to only answer from uploaded sources. If it doesn't know, it says so.
|
|
443
|
+
|
|
444
|
+
**What about rate limits?**
|
|
445
|
+
Free tier has daily query limits per Google account. Quick account switching supported for continued research.
|
|
446
|
+
|
|
447
|
+
**How secure is this?**
|
|
448
|
+
Chrome runs locally. Your credentials never leave your machine. Use a dedicated Google account if concerned.
|
|
449
|
+
|
|
450
|
+
**Can I see what's happening?**
|
|
451
|
+
Yes! Say *"Show me the browser"* (MCP mode) or set `HEADLESS=false` (HTTP mode) to watch the live NotebookLM conversation.
|
|
452
|
+
|
|
453
|
+
**What makes this better than Claude's built-in knowledge?**
|
|
454
|
+
Your docs are always current. No training cutoff. No hallucinations. Perfect for new libraries, internal APIs, or fast-moving projects.
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## The Bottom Line
|
|
459
|
+
|
|
460
|
+
**Without NotebookLM**: Write code → Find it's wrong → Debug hallucinated APIs → Repeat
|
|
461
|
+
|
|
462
|
+
**With NotebookLM**: Research first → Write correct code → Ship faster
|
|
463
|
+
|
|
464
|
+
Stop debugging hallucinations. Start shipping accurate code.
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## Disclaimer
|
|
469
|
+
|
|
470
|
+
This tool automates browser interactions with NotebookLM to make your workflow more efficient. However, a few friendly reminders:
|
|
471
|
+
|
|
472
|
+
**About browser automation:**
|
|
473
|
+
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!
|
|
474
|
+
|
|
475
|
+
**About CLI tools and AI agents:**
|
|
476
|
+
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:
|
|
477
|
+
- Always review changes before committing or deploying
|
|
478
|
+
- Test in safe environments first
|
|
479
|
+
- Keep backups of important work
|
|
480
|
+
- Remember: AI agents are assistants, not infallible oracles
|
|
481
|
+
|
|
482
|
+
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.
|
|
483
|
+
|
|
484
|
+
That said, if you run into problems or have questions, feel free to open an issue on GitHub. I'm happy to help troubleshoot!
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## Roadmap
|
|
489
|
+
|
|
490
|
+
Future features planned for upcoming releases:
|
|
491
|
+
|
|
492
|
+
### 🚀 Stateless Server Mode
|
|
493
|
+
**Goal**: Run the HTTP server without keeping a terminal window open permanently.
|
|
494
|
+
|
|
495
|
+
**Planned options:**
|
|
496
|
+
- **PM2 integration** (Recommended): Cross-platform process manager with auto-restart, monitoring, and logs
|
|
497
|
+
- Simple setup: `pm2 start npm --name "notebooklm-http" -- run start:http`
|
|
498
|
+
- Automatic startup on system boot
|
|
499
|
+
- Built-in log rotation and monitoring
|
|
500
|
+
- **Windows Service**: Native Windows service installation via `nssm` or `node-windows`
|
|
501
|
+
- **Serverless-ready mode**: Lambda/cold-start compatible with lazy browser session initialization
|
|
502
|
+
|
|
503
|
+
**Status**: Planned for v1.2.0
|
|
504
|
+
|
|
505
|
+
### 🤖 Auto-fill Notebook Metadata
|
|
506
|
+
**Goal**: Automatically generate notebook name, description, and keywords when adding a notebook.
|
|
507
|
+
|
|
508
|
+
**How it works:**
|
|
509
|
+
1. When adding a notebook with empty metadata, automatically ask NotebookLM:
|
|
510
|
+
- "If you had to name this notebook in one word, what would it be?"
|
|
511
|
+
- "Give me 10 relevant keywords for this content"
|
|
512
|
+
- "Describe this notebook in one sentence"
|
|
513
|
+
2. Parse the response and auto-populate metadata fields
|
|
514
|
+
3. Available as both automatic mode (on add) and manual command (`/notebooks/:id/auto-fill`)
|
|
515
|
+
|
|
516
|
+
**Benefits:**
|
|
517
|
+
- No more manual metadata entry
|
|
518
|
+
- Consistent, AI-generated descriptions
|
|
519
|
+
- Better notebook organization and searchability
|
|
520
|
+
|
|
521
|
+
**Status**: Planned for v1.2.0 or v1.3.0
|
|
522
|
+
|
|
523
|
+
### 💡 Have an idea?
|
|
524
|
+
[Open a discussion](https://github.com/roomi-fields/notebooklm-mcp-http/discussions) to suggest new features!
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## Contributing
|
|
529
|
+
|
|
530
|
+
Found a bug? Have a feature idea? [Open an issue](https://github.com/roomi-fields/notebooklm-mcp-http/issues) or submit a PR!
|
|
531
|
+
|
|
532
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
|
|
533
|
+
|
|
534
|
+
## License
|
|
535
|
+
|
|
536
|
+
MIT — Use freely in your projects.
|
|
537
|
+
|
|
538
|
+
See [LICENSE](./LICENSE) for details.
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
<div align="center">
|
|
543
|
+
|
|
544
|
+
Built with frustration about hallucinated APIs, powered by Google's NotebookLM
|
|
545
|
+
|
|
546
|
+
⭐ [Star on GitHub](https://github.com/roomi-fields/notebooklm-mcp-http) if this saves you debugging time!
|
|
547
|
+
|
|
548
|
+
</div>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Manager for NotebookLM
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* - Interactive login (headful browser for setup)
|
|
6
|
+
* - Auto-login with credentials (email/password from ENV)
|
|
7
|
+
* - Browser state persistence (cookies + localStorage + sessionStorage)
|
|
8
|
+
* - Cookie expiry validation
|
|
9
|
+
* - State expiry checks (24h file age)
|
|
10
|
+
* - Hard reset for clean start
|
|
11
|
+
*
|
|
12
|
+
* Based on the Python implementation from auth.py
|
|
13
|
+
*/
|
|
14
|
+
import type { BrowserContext, Page } from "patchright";
|
|
15
|
+
import type { ProgressCallback } from "../types.js";
|
|
16
|
+
export declare class AuthManager {
|
|
17
|
+
private stateFilePath;
|
|
18
|
+
private sessionFilePath;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Save entire browser state (cookies + localStorage)
|
|
22
|
+
*/
|
|
23
|
+
saveBrowserState(context: BrowserContext, page?: Page): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if saved browser state exists
|
|
26
|
+
*/
|
|
27
|
+
hasSavedState(): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Get path to saved browser state
|
|
30
|
+
*/
|
|
31
|
+
getStatePath(): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Get valid state path (checks expiry)
|
|
34
|
+
*/
|
|
35
|
+
getValidStatePath(): Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Load sessionStorage from file
|
|
38
|
+
*/
|
|
39
|
+
loadSessionStorage(): Promise<Record<string, string> | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Validate if saved state is still valid
|
|
42
|
+
*/
|
|
43
|
+
validateState(context: BrowserContext): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Validate if critical authentication cookies are still valid
|
|
46
|
+
*/
|
|
47
|
+
validateCookiesExpiry(context: BrowserContext): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if the saved state file is too old (>24 hours)
|
|
50
|
+
*/
|
|
51
|
+
isStateExpired(): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Perform interactive login
|
|
54
|
+
* User will see a browser window and login manually
|
|
55
|
+
*
|
|
56
|
+
* SIMPLE & RELIABLE: Just wait for URL to change to notebooklm.google.com
|
|
57
|
+
*/
|
|
58
|
+
performLogin(page: Page, sendProgress?: ProgressCallback): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Attempt to authenticate using configured credentials
|
|
61
|
+
*/
|
|
62
|
+
loginWithCredentials(context: BrowserContext, page: Page, email: string, password: string): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Wait for Google to redirect to NotebookLM after successful login (SIMPLE & RELIABLE)
|
|
65
|
+
*
|
|
66
|
+
* Just checks if URL changes to notebooklm.google.com - no complex UI element searching!
|
|
67
|
+
* Matches the simplified approach used in performLogin().
|
|
68
|
+
*/
|
|
69
|
+
private waitForRedirectAfterLogin;
|
|
70
|
+
/**
|
|
71
|
+
* Wait for NotebookLM to load (SIMPLE & RELIABLE)
|
|
72
|
+
*
|
|
73
|
+
* Just checks if URL starts with notebooklm.google.com - no complex UI element searching!
|
|
74
|
+
* Matches the simplified approach used in performLogin().
|
|
75
|
+
*/
|
|
76
|
+
private waitForNotebook;
|
|
77
|
+
/**
|
|
78
|
+
* Handle possible account chooser
|
|
79
|
+
*/
|
|
80
|
+
private handleAccountChooser;
|
|
81
|
+
/**
|
|
82
|
+
* Fill email identifier field with human-like typing
|
|
83
|
+
*/
|
|
84
|
+
private fillIdentifier;
|
|
85
|
+
/**
|
|
86
|
+
* Fill password field with human-like typing
|
|
87
|
+
*/
|
|
88
|
+
private fillPassword;
|
|
89
|
+
/**
|
|
90
|
+
* Click text element
|
|
91
|
+
*/
|
|
92
|
+
private clickText;
|
|
93
|
+
/**
|
|
94
|
+
* Mask email for logging
|
|
95
|
+
*/
|
|
96
|
+
private maskEmail;
|
|
97
|
+
/**
|
|
98
|
+
* Load authentication state from a specific file path
|
|
99
|
+
*/
|
|
100
|
+
loadAuthState(context: BrowserContext, statePath: string): Promise<boolean>;
|
|
101
|
+
/**
|
|
102
|
+
* Perform interactive setup (for setup_auth tool)
|
|
103
|
+
* Opens a PERSISTENT browser for manual login
|
|
104
|
+
*
|
|
105
|
+
* CRITICAL: Uses the SAME persistent context as runtime!
|
|
106
|
+
* This ensures cookies are automatically saved to the Chrome profile.
|
|
107
|
+
*
|
|
108
|
+
* Benefits over temporary browser:
|
|
109
|
+
* - Session cookies persist correctly (Playwright bug workaround)
|
|
110
|
+
* - Same fingerprint as runtime
|
|
111
|
+
* - No need for addCookies() workarounds
|
|
112
|
+
* - Automatic cookie persistence via Chrome profile
|
|
113
|
+
*
|
|
114
|
+
* @param sendProgress Optional progress callback
|
|
115
|
+
* @param overrideHeadless Optional override for headless mode (true = visible, false = headless)
|
|
116
|
+
* If not provided, defaults to true (visible) for setup
|
|
117
|
+
*/
|
|
118
|
+
performSetup(sendProgress?: ProgressCallback, overrideHeadless?: boolean): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Clear ALL authentication data for account switching
|
|
121
|
+
*
|
|
122
|
+
* CRITICAL: This deletes EVERYTHING to ensure only ONE account is active:
|
|
123
|
+
* - All state.json files (cookies, localStorage)
|
|
124
|
+
* - sessionStorage files
|
|
125
|
+
* - Chrome profile directory (browser fingerprint, cache, etc.)
|
|
126
|
+
*
|
|
127
|
+
* Use this BEFORE authenticating a new account!
|
|
128
|
+
*/
|
|
129
|
+
clearAllAuthData(): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Clear all saved authentication state
|
|
132
|
+
*/
|
|
133
|
+
clearState(): Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* HARD RESET: Completely delete ALL authentication state
|
|
136
|
+
*/
|
|
137
|
+
hardResetState(): Promise<boolean>;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=auth-manager.d.ts.map
|