@roomi-fields/notebooklm-mcp 1.5.4 → 1.5.8
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/README.md +2 -2
- package/deployment/docs/01-INSTALL.md +21 -1
- package/deployment/docs/03-API.md +16 -10
- package/deployment/docs/05-TROUBLESHOOTING.md +19 -1
- package/deployment/docs/06-NOTEBOOK-LIBRARY.md +9 -9
- package/deployment/docs/07-AUTO-DISCOVERY.md +6 -15
- package/deployment/docs/08-WSL-USAGE.md +7 -7
- package/deployment/docs/09-MULTI-INTERFACE.md +6 -6
- package/deployment/docs/11-MULTI-ACCOUNT.md +1 -1
- package/dist/accounts/account-manager.d.ts +15 -0
- package/dist/accounts/account-manager.d.ts.map +1 -1
- package/dist/accounts/account-manager.js +104 -0
- package/dist/accounts/account-manager.js.map +1 -1
- package/dist/accounts/auto-login-manager.d.ts.map +1 -1
- package/dist/accounts/auto-login-manager.js +29 -25
- package/dist/accounts/auto-login-manager.js.map +1 -1
- package/dist/auth/auth-manager.d.ts +1 -1
- package/dist/auth/auth-manager.d.ts.map +1 -1
- package/dist/auth/auth-manager.js +14 -9
- package/dist/auth/auth-manager.js.map +1 -1
- package/dist/cli/help.js +5 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/setup-auth.js +18 -10
- package/dist/cli/setup-auth.js.map +1 -1
- package/dist/content/content-manager.d.ts +8 -0
- package/dist/content/content-manager.d.ts.map +1 -1
- package/dist/content/content-manager.js +411 -67
- package/dist/content/content-manager.js.map +1 -1
- package/dist/http-wrapper.d.ts.map +1 -1
- package/dist/http-wrapper.js +148 -3
- package/dist/http-wrapper.js.map +1 -1
- package/dist/session/browser-session.d.ts +12 -0
- package/dist/session/browser-session.d.ts.map +1 -1
- package/dist/session/browser-session.js +313 -65
- package/dist/session/browser-session.js.map +1 -1
- package/dist/session/shared-context-manager.d.ts.map +1 -1
- package/dist/session/shared-context-manager.js +22 -2
- package/dist/session/shared-context-manager.js.map +1 -1
- package/dist/startup/startup-manager.d.ts +8 -0
- package/dist/startup/startup-manager.d.ts.map +1 -1
- package/dist/startup/startup-manager.js +176 -28
- package/dist/startup/startup-manager.js.map +1 -1
- package/dist/stdio-http-proxy.js +91 -16
- package/dist/stdio-http-proxy.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +52 -32
- package/dist/tools/index.js.map +1 -1
- package/dist/utils/citation-extractor.d.ts +6 -7
- package/dist/utils/citation-extractor.d.ts.map +1 -1
- package/dist/utils/citation-extractor.js +138 -329
- package/dist/utils/citation-extractor.js.map +1 -1
- package/dist/utils/page-utils.d.ts +5 -0
- package/dist/utils/page-utils.d.ts.map +1 -1
- package/dist/utils/page-utils.js +73 -16
- package/dist/utils/page-utils.js.map +1 -1
- package/package.json +6 -2
- package/scripts/archive/add-and-activate-notebook.ps1 +4 -4
- package/scripts/archive/add-new-notebook.ps1 +4 -4
- package/scripts/archive/add-rom1pey.ps1 +2 -2
- package/scripts/archive/add-rpmonster.ps1 +2 -2
- package/scripts/archive/add-source-debug.ps1 +1 -1
- package/scripts/archive/add-source-e2e.ps1 +1 -1
- package/scripts/archive/add-source-visible.ps1 +1 -1
- package/scripts/archive/add-test-notebook.ps1 +1 -1
- package/scripts/archive/add-test-source.ps1 +1 -1
- package/scripts/archive/capture-screen.ps1 +1 -1
- package/scripts/archive/change-language.mjs +4 -3
- package/scripts/archive/change-language.ts +5 -3
- package/scripts/archive/create-notebook.ps1 +2 -2
- package/scripts/archive/create-rom1pey-notebook.ps1 +2 -2
- package/scripts/archive/create-rom1pey.ps1 +2 -2
- package/scripts/archive/debug-add-text-source.ps1 +4 -4
- package/scripts/archive/debug-selectors.ps1 +1 -1
- package/scripts/archive/discover-home.ps1 +2 -2
- package/scripts/archive/navigate-home-visible.ps1 +1 -1
- package/scripts/archive/navigate-home.ps1 +1 -1
- package/scripts/archive/run-e2e-english.ps1 +3 -3
- package/scripts/archive/run-e2e-rom1pey-v2.ps1 +4 -4
- package/scripts/archive/run-e2e-rom1pey.ps1 +4 -4
- package/scripts/archive/setup-english-test.ps1 +6 -6
- package/scripts/archive/setup-test-notebook.ps1 +1 -1
- package/scripts/archive/simple-add-source.ps1 +1 -1
- package/scripts/archive/t10.ps1 +1 -1
- package/scripts/archive/t20.ps1 +1 -1
- package/scripts/archive/t30.ps1 +1 -1
- package/scripts/archive/t31.ps1 +1 -1
- package/scripts/archive/t32.ps1 +1 -1
- package/scripts/archive/t53.ps1 +1 -1
- package/scripts/archive/test-access.ps1 +1 -1
- package/scripts/archive/test-add-delete-source.ps1 +4 -4
- package/scripts/archive/test-add-source-visible.ps1 +1 -1
- package/scripts/archive/test-add-source.ps1 +1 -1
- package/scripts/archive/test-add-text-debug.ps1 +2 -2
- package/scripts/archive/test-ask-headed.ps1 +1 -1
- package/scripts/archive/test-delete-source.ps1 +4 -4
- package/scripts/archive/test-e2e-notebook.ps1 +2 -2
- package/scripts/archive/test-english-notebook.ps1 +4 -4
- package/scripts/archive/test-english.ps1 +1 -1
- package/scripts/archive/test-full-custom-instructions.ps1 +1 -1
- package/scripts/archive/test-full-infographic.ps1 +1 -1
- package/scripts/archive/test-full-language.ps1 +1 -1
- package/scripts/archive/test-full-presentation.ps1 +1 -1
- package/scripts/archive/test-full-report.ps1 +1 -1
- package/scripts/archive/test-full-source-selection.ps1 +1 -1
- package/scripts/archive/test-full-video-brief.ps1 +1 -1
- package/scripts/archive/test-full-video-explainer.ps1 +1 -1
- package/scripts/archive/test-full-video-styles.ps1 +1 -1
- package/scripts/archive/test-headed-ask.ps1 +1 -1
- package/scripts/archive/test-headed-now.ps1 +2 -2
- package/scripts/archive/test-headed.ps1 +2 -2
- package/scripts/archive/test-hello.ps1 +1 -1
- package/scripts/archive/test-manual-headed.ps1 +1 -1
- package/scripts/archive/test-mathieu-quota.ps1 +1 -1
- package/scripts/archive/test-personal-notebook.ps1 +1 -1
- package/scripts/archive/test-rate-limit.ps1 +1 -1
- package/scripts/archive/test-real-ask.ps1 +1 -1
- package/scripts/archive/test-real-ask2.ps1 +1 -1
- package/scripts/archive/test-rom1pey.ps1 +1 -1
- package/scripts/archive/test-rotation-complete.ps1 +1 -1
- package/scripts/archive/test-rotation.ps1 +2 -2
- package/scripts/archive/test-show-browser.ps1 +1 -1
- package/scripts/archive/test-update-notebook.ps1 +1 -1
- package/scripts/archive/verify-language-slow.ps1 +1 -1
- package/scripts/archive/verify-language.ps1 +1 -1
- package/scripts/docker-entrypoint.sh +3 -7
- package/scripts/doctor.mjs +257 -0
- package/scripts/mcp-proxy-hidden.ps1 +31 -0
- package/scripts/mcp-wsl-helper.sh +1 -1
- package/scripts/start-server-hidden.vbs +16 -0
- package/scripts/start-server.ps1 +1 -1
- package/scripts/stop-server.bat +5 -0
- package/scripts/switch-account-language.sh +87 -128
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
### Q&A with Citations
|
|
24
24
|
|
|
25
25
|
- **Ask questions** to NotebookLM and get accurate, citation-backed answers
|
|
26
|
-
- **Source citation extraction** with 5 formats: none, inline, footnotes, json, expanded
|
|
27
|
-
- **Session management** for multi-turn conversations
|
|
26
|
+
- **Source citation extraction** with 5 formats: none, inline, footnotes, json, expanded (97% excerpt success rate)
|
|
27
|
+
- **Session management** for multi-turn conversations with auto-reauth on session expiry
|
|
28
28
|
|
|
29
29
|
### Content Generation
|
|
30
30
|
|
|
@@ -380,7 +380,27 @@ If all files are present and not empty, authentication is configured! ✅
|
|
|
380
380
|
|
|
381
381
|
Before starting the server, let's verify that everything is OK:
|
|
382
382
|
|
|
383
|
-
###
|
|
383
|
+
### Doctor Script (recommended)
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
npm run doctor:basic
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Prints a `[PASS]`/`[FAIL]` line for each of: Node engine compatibility,
|
|
390
|
+
`package.json`, `README.md`, `dist/index.js`, `dist/http-wrapper.js`.
|
|
391
|
+
Exits non-zero on any failure. Use this instead of the manual checklist
|
|
392
|
+
below for quick sanity checks before starting the server.
|
|
393
|
+
|
|
394
|
+
Once the server is running (see [Startup](#️-startup) below), also run:
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
npm run doctor:http
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
to verify `/health` reachability. Pass `--notebook-url` to also exercise
|
|
401
|
+
`/content` and `/ask`.
|
|
402
|
+
|
|
403
|
+
### Complete Checklist (manual)
|
|
384
404
|
|
|
385
405
|
```powershell
|
|
386
406
|
# 1. Node.js installed
|
|
@@ -307,7 +307,7 @@ curl http://localhost:3000/notebooks
|
|
|
307
307
|
"id": "parents-numerique",
|
|
308
308
|
"name": "Parents and Digital",
|
|
309
309
|
"description": "Advice for parents in the digital age",
|
|
310
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
310
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
311
311
|
"topics": ["parenting", "digital", "education"],
|
|
312
312
|
"use_cases": [
|
|
313
313
|
"Educational advice in the digital age",
|
|
@@ -342,7 +342,7 @@ Add a new notebook to the library.
|
|
|
342
342
|
curl -X POST http://localhost:3000/notebooks \
|
|
343
343
|
-H "Content-Type: application/json" \
|
|
344
344
|
-d '{
|
|
345
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
345
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
346
346
|
"name": "Parents and Digital",
|
|
347
347
|
"description": "Advice for parents in the digital age",
|
|
348
348
|
"topics": ["parenting", "digital", "education"]
|
|
@@ -371,7 +371,7 @@ curl -X POST http://localhost:3000/notebooks \
|
|
|
371
371
|
"id": "parents-numerique",
|
|
372
372
|
"name": "Parents and Digital",
|
|
373
373
|
"description": "Advice for parents in the digital age",
|
|
374
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
374
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
375
375
|
"topics": ["parenting", "digital", "education"],
|
|
376
376
|
"content_types": ["documentation", "examples"],
|
|
377
377
|
"use_cases": ["Educational advice", "Digital parenting"],
|
|
@@ -392,7 +392,7 @@ curl -X POST http://localhost:3000/notebooks \
|
|
|
392
392
|
```json
|
|
393
393
|
{
|
|
394
394
|
"success": false,
|
|
395
|
-
"error": "A notebook with the name 'Parents and Digital' already exists.\n\nExisting notebook ID: parents-numerique\nURL: https://notebooklm.google.com/notebook/
|
|
395
|
+
"error": "A notebook with the name 'Parents and Digital' already exists.\n\nExisting notebook ID: parents-numerique\nURL: https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101\n\nPlease use a different name, or update the existing notebook instead.\nTo update: PUT /notebooks/parents-numerique with new data\nTo delete: DELETE /notebooks/parents-numerique"
|
|
396
396
|
}
|
|
397
397
|
```
|
|
398
398
|
|
|
@@ -547,7 +547,7 @@ curl http://localhost:3000/notebooks/parents-numerique
|
|
|
547
547
|
"id": "parents-numerique",
|
|
548
548
|
"name": "Parents and Digital",
|
|
549
549
|
"description": "Advice for parents in the digital age",
|
|
550
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
550
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
551
551
|
"topics": ["parenting", "digital", "education"],
|
|
552
552
|
"active": true
|
|
553
553
|
}
|
|
@@ -630,7 +630,7 @@ curl -X PUT http://localhost:3000/notebooks/shakespeare/activate
|
|
|
630
630
|
"id": "shakespeare",
|
|
631
631
|
"name": "Shakespeare",
|
|
632
632
|
"description": "William Shakespeare - Complete Works",
|
|
633
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
633
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000102",
|
|
634
634
|
"topics": ["literature", "theater", "Shakespeare"],
|
|
635
635
|
"active": true,
|
|
636
636
|
"last_used": "2025-11-22T10:30:45.123Z"
|
|
@@ -676,7 +676,7 @@ curl http://localhost:3000/sessions
|
|
|
676
676
|
"data": {
|
|
677
677
|
"sessions": [
|
|
678
678
|
{
|
|
679
|
-
"id": "
|
|
679
|
+
"id": "session-00000001",
|
|
680
680
|
"notebook_url": "https://notebooklm.google.com/notebook/xxx",
|
|
681
681
|
"message_count": 3,
|
|
682
682
|
"age_seconds": 245,
|
|
@@ -1668,9 +1668,9 @@ curl "http://localhost:3000/notebooks/scrape?show_browser=true"
|
|
|
1668
1668
|
"data": {
|
|
1669
1669
|
"notebooks": [
|
|
1670
1670
|
{
|
|
1671
|
-
"id": "
|
|
1671
|
+
"id": "00000000-0000-0000-0000-000000000103",
|
|
1672
1672
|
"name": "Internal Family Systems",
|
|
1673
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
1673
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000103"
|
|
1674
1674
|
}
|
|
1675
1675
|
],
|
|
1676
1676
|
"total": 16,
|
|
@@ -1709,7 +1709,13 @@ curl -X POST http://localhost:3000/notebooks/import-from-scrape \
|
|
|
1709
1709
|
{
|
|
1710
1710
|
"success": true,
|
|
1711
1711
|
"data": {
|
|
1712
|
-
"imported": [
|
|
1712
|
+
"imported": [
|
|
1713
|
+
{
|
|
1714
|
+
"id": "00000000-0000-0000-0000-000000000103",
|
|
1715
|
+
"name": "Internal Family Systems",
|
|
1716
|
+
"status": "imported"
|
|
1717
|
+
}
|
|
1718
|
+
],
|
|
1713
1719
|
"errors": [],
|
|
1714
1720
|
"total_scraped": 16,
|
|
1715
1721
|
"total_imported": 16,
|
|
@@ -6,7 +6,25 @@
|
|
|
6
6
|
|
|
7
7
|
## 🔍 Quick Diagnosis
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Doctor Scripts (fastest path)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Repo + build artifacts + Node version
|
|
13
|
+
npm run doctor:basic
|
|
14
|
+
|
|
15
|
+
# Start the server in another shell, then:
|
|
16
|
+
npm run doctor:http
|
|
17
|
+
|
|
18
|
+
# With a real notebook URL, also exercises /content and /ask:
|
|
19
|
+
npm run doctor:http -- --notebook-url "https://notebooklm.google.com/notebook/<your-notebook-id>"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`doctor:basic` prints `[PASS]` / `[FAIL]` lines for each check and exits
|
|
23
|
+
non-zero if anything is missing. `doctor:http` adds reachability of
|
|
24
|
+
`/health`, `/content`, and `/ask`. Run `node scripts/doctor.mjs --help` for
|
|
25
|
+
all flags (`--base-url`, `--timeout-ms`, `--question`).
|
|
26
|
+
|
|
27
|
+
### Manual Verification Commands
|
|
10
28
|
|
|
11
29
|
```powershell
|
|
12
30
|
# 1. Server active?
|
|
@@ -30,7 +30,7 @@ Location: `%LOCALAPPDATA%\notebooklm-mcp\Data\library.json`
|
|
|
30
30
|
"notebooks": [
|
|
31
31
|
{
|
|
32
32
|
"id": "parents-numerique",
|
|
33
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
33
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
34
34
|
"name": "Parents et Numérique",
|
|
35
35
|
"description": "Conseils pour parents à l'ère du numérique",
|
|
36
36
|
"topics": ["parentalité", "numérique", "éducation"],
|
|
@@ -46,7 +46,7 @@ Location: `%LOCALAPPDATA%\notebooklm-mcp\Data\library.json`
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"id": "shakespeare",
|
|
49
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
49
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000102",
|
|
50
50
|
"name": "Shakespeare",
|
|
51
51
|
"description": "William Shakespeare - L'intégrale des pièces",
|
|
52
52
|
"topics": ["littérature", "théâtre", "Shakespeare"],
|
|
@@ -113,7 +113,7 @@ Expected format: `https://notebooklm.google.com/notebook/[id]`
|
|
|
113
113
|
curl -X POST http://localhost:3000/notebooks \
|
|
114
114
|
-H "Content-Type: application/json" \
|
|
115
115
|
-d '{
|
|
116
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
116
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
117
117
|
"name": "Parents et Numérique",
|
|
118
118
|
"description": "Conseils pour parents à l'ère du numérique",
|
|
119
119
|
"topics": ["parentalité", "numérique", "éducation"]
|
|
@@ -124,7 +124,7 @@ curl -X POST http://localhost:3000/notebooks \
|
|
|
124
124
|
|
|
125
125
|
```powershell
|
|
126
126
|
$body = @{
|
|
127
|
-
url = "https://notebooklm.google.com/notebook/
|
|
127
|
+
url = "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101"
|
|
128
128
|
name = "Parents et Numérique"
|
|
129
129
|
description = "Conseils pour parents à l'ère du numérique"
|
|
130
130
|
topics = @("parentalité", "numérique", "éducation")
|
|
@@ -145,7 +145,7 @@ Repeat the operation for each notebook:
|
|
|
145
145
|
```powershell
|
|
146
146
|
# Shakespeare Notebook
|
|
147
147
|
$body = @{
|
|
148
|
-
url = "https://notebooklm.google.com/notebook/
|
|
148
|
+
url = "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000102"
|
|
149
149
|
name = "Shakespeare"
|
|
150
150
|
description = "William Shakespeare - L'intégrale des pièces"
|
|
151
151
|
topics = @("littérature", "théâtre", "Shakespeare")
|
|
@@ -277,7 +277,7 @@ POST /notebooks {"name": "parents et numérique", ...} # ❌ (case-insensitive)
|
|
|
277
277
|
```json
|
|
278
278
|
{
|
|
279
279
|
"success": false,
|
|
280
|
-
"error": "A notebook with the name 'Parents et Numérique' already exists.\n\nExisting notebook ID: parents-numerique\nURL: https://notebooklm.google.com/notebook/
|
|
280
|
+
"error": "A notebook with the name 'Parents et Numérique' already exists.\n\nExisting notebook ID: parents-numerique\nURL: https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101\n\nPlease use a different name, or update the existing notebook instead.\nTo update: PUT /notebooks/parents-numerique with new data\nTo delete: DELETE /notebooks/parents-numerique"
|
|
281
281
|
}
|
|
282
282
|
```
|
|
283
283
|
|
|
@@ -365,7 +365,7 @@ Returns all metadata:
|
|
|
365
365
|
"data": {
|
|
366
366
|
"notebook": {
|
|
367
367
|
"id": "parents-numerique",
|
|
368
|
-
"url": "https://notebooklm.google.com/notebook/
|
|
368
|
+
"url": "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101",
|
|
369
369
|
"name": "Parents et Numérique",
|
|
370
370
|
"description": "Conseils pour parents à l'ère du numérique",
|
|
371
371
|
"topics": ["parentalité", "numérique", "éducation"],
|
|
@@ -613,13 +613,13 @@ $baseUrl = "http://localhost:3000"
|
|
|
613
613
|
# List of notebooks to add
|
|
614
614
|
$notebooks = @(
|
|
615
615
|
@{
|
|
616
|
-
url = "https://notebooklm.google.com/notebook/
|
|
616
|
+
url = "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000101"
|
|
617
617
|
name = "Parents et Numérique"
|
|
618
618
|
description = "Conseils pour parents à l'ère du numérique"
|
|
619
619
|
topics = @("parentalité", "numérique", "éducation")
|
|
620
620
|
},
|
|
621
621
|
@{
|
|
622
|
-
url = "https://notebooklm.google.com/notebook/
|
|
622
|
+
url = "https://notebooklm.google.com/notebook/00000000-0000-0000-0000-000000000102"
|
|
623
623
|
name = "Shakespeare"
|
|
624
624
|
description = "William Shakespeare - L'intégrale des pièces"
|
|
625
625
|
topics = @("littérature", "théâtre", "Shakespeare")
|
|
@@ -181,26 +181,17 @@ Analyze your complete content and respond ONLY in JSON format:
|
|
|
181
181
|
|
|
182
182
|
## Testing
|
|
183
183
|
|
|
184
|
-
###
|
|
185
|
-
|
|
186
|
-
The following public notebooks are available for testing auto-discovery:
|
|
184
|
+
### Test With Your Own Notebook
|
|
187
185
|
|
|
188
186
|
```bash
|
|
189
|
-
# Test with
|
|
190
|
-
.\deployment\scripts\test-auto-discovery.ps1 -
|
|
187
|
+
# Test with a specific notebook URL you can access
|
|
188
|
+
.\deployment\scripts\test-auto-discovery.ps1 -NotebookUrl "https://notebooklm.google.com/notebook/<your-notebook-id>"
|
|
191
189
|
|
|
192
|
-
#
|
|
193
|
-
|
|
190
|
+
# Or provide multiple notebook URLs through the environment
|
|
191
|
+
$env:AUTO_DISCOVERY_NOTEBOOKS = "https://notebooklm.google.com/notebook/<id-1>,https://notebooklm.google.com/notebook/<id-2>"
|
|
192
|
+
.\deployment\scripts\test-auto-discovery.ps1 -TestAll
|
|
194
193
|
```
|
|
195
194
|
|
|
196
|
-
**Available public notebooks**:
|
|
197
|
-
|
|
198
|
-
1. `https://notebooklm.google.com/notebook/0d5cd576-2583-4835-8848-a5b7b6a97cea`
|
|
199
|
-
2. `https://notebooklm.google.com/notebook/505ee4b1-ad05-4673-a06b-1ec106c2b940`
|
|
200
|
-
3. `https://notebooklm.google.com/notebook/a09e40ad-d41f-43af-a3ca-5fc82bd459e5`
|
|
201
|
-
4. `https://notebooklm.google.com/notebook/19bde485-a9c1-4809-8884-e872b2b67b44`
|
|
202
|
-
5. `https://notebooklm.google.com/notebook/19fdf6bd-1975-40a3-9801-c554130bc64a`
|
|
203
|
-
|
|
204
195
|
### Expected Results
|
|
205
196
|
|
|
206
197
|
Each auto-discovery test should:
|
|
@@ -37,7 +37,7 @@ Due to browser requirements (Playwright needs Chrome), the HTTP server must run
|
|
|
37
37
|
Open a **Windows terminal** (PowerShell or CMD, not WSL):
|
|
38
38
|
|
|
39
39
|
```powershell
|
|
40
|
-
cd D:\
|
|
40
|
+
cd D:\path\to\notebooklm-mcp
|
|
41
41
|
npm run start:http
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -129,7 +129,7 @@ mcp__notebooklm__ask_question(question="...", notebook_id="my-notebook")
|
|
|
129
129
|
```powershell
|
|
130
130
|
# From Windows (not WSL):
|
|
131
131
|
taskkill /F /IM node.exe
|
|
132
|
-
cd D:\
|
|
132
|
+
cd D:\path\to\notebooklm-mcp
|
|
133
133
|
npm run start:http
|
|
134
134
|
```
|
|
135
135
|
|
|
@@ -165,7 +165,7 @@ Kill all node processes and restart:
|
|
|
165
165
|
|
|
166
166
|
```powershell
|
|
167
167
|
taskkill /F /IM node.exe
|
|
168
|
-
cd D:\
|
|
168
|
+
cd D:\path\to\notebooklm-mcp
|
|
169
169
|
npm run start:http
|
|
170
170
|
```
|
|
171
171
|
|
|
@@ -265,7 +265,7 @@ The project includes PowerShell scripts for managing the server:
|
|
|
265
265
|
### Run in Background (Hidden Window)
|
|
266
266
|
|
|
267
267
|
```powershell
|
|
268
|
-
Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -File D:\
|
|
268
|
+
Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -File D:\path\to\notebooklm-mcp\scripts\start-server.ps1" -WindowStyle Hidden
|
|
269
269
|
```
|
|
270
270
|
|
|
271
271
|
### Windows Task Scheduler (Auto-start on Login)
|
|
@@ -275,7 +275,7 @@ Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -File D:\Claude\
|
|
|
275
275
|
3. Trigger: "When I log on"
|
|
276
276
|
4. Action: Start a program
|
|
277
277
|
- Program: `powershell.exe`
|
|
278
|
-
- Arguments: `-ExecutionPolicy Bypass -WindowStyle Hidden -File "D:\
|
|
278
|
+
- Arguments: `-ExecutionPolicy Bypass -WindowStyle Hidden -File "D:\path\to\notebooklm-mcp\scripts\start-server.ps1"`
|
|
279
279
|
5. Check "Open Properties dialog" and set "Run whether user is logged on or not"
|
|
280
280
|
|
|
281
281
|
## Authentication Procedure (TOTP/2FA)
|
|
@@ -292,7 +292,7 @@ taskkill /F /IM node.exe
|
|
|
292
292
|
### Step 2: Run accounts test with visible browser
|
|
293
293
|
|
|
294
294
|
```powershell
|
|
295
|
-
cd D:\
|
|
295
|
+
cd D:\path\to\notebooklm-mcp
|
|
296
296
|
npm run accounts test account-XXXXXXXXXXXXX -- --show
|
|
297
297
|
```
|
|
298
298
|
|
|
@@ -321,7 +321,7 @@ cp /mnt/c/Users/USERNAME/AppData/Local/notebooklm-mcp/Data/accounts/account-*/br
|
|
|
321
321
|
### Step 4: Start HTTP server
|
|
322
322
|
|
|
323
323
|
```powershell
|
|
324
|
-
cd D:\
|
|
324
|
+
cd D:\path\to\notebooklm-mcp
|
|
325
325
|
npm run start:http
|
|
326
326
|
```
|
|
327
327
|
|
|
@@ -47,7 +47,7 @@ The **Stdio-HTTP Proxy** enables Claude Desktop to communicate with the HTTP ser
|
|
|
47
47
|
**From PowerShell (recommended):**
|
|
48
48
|
|
|
49
49
|
```powershell
|
|
50
|
-
cd D:\
|
|
50
|
+
cd D:\path\to\notebooklm-mcp
|
|
51
51
|
|
|
52
52
|
# Build if needed
|
|
53
53
|
npm run build
|
|
@@ -63,7 +63,7 @@ Start-Process -NoNewWindow node -ArgumentList "dist/http-wrapper.js"
|
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
# Helper script handles everything correctly
|
|
66
|
-
HELPER=/mnt/d/
|
|
66
|
+
HELPER=/mnt/d/path/to/notebooklm-mcp/scripts/mcp-wsl-helper.sh
|
|
67
67
|
|
|
68
68
|
$HELPER start # Start server (Windows process)
|
|
69
69
|
$HELPER health # Check health
|
|
@@ -76,7 +76,7 @@ $HELPER stop # Stop server
|
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
78
|
# This launches node.exe on Windows, NOT node in WSL
|
|
79
|
-
powershell.exe -Command "Start-Process -NoNewWindow -FilePath 'node' -ArgumentList 'D:/
|
|
79
|
+
powershell.exe -Command "Start-Process -NoNewWindow -FilePath 'node' -ArgumentList 'D:/path/to/notebooklm-mcp/dist/http-wrapper.js' -WorkingDirectory 'D:/path/to/notebooklm-mcp'"
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
### Step 2: Configure Claude Desktop
|
|
@@ -92,7 +92,7 @@ Edit your Claude Desktop config file:
|
|
|
92
92
|
"mcpServers": {
|
|
93
93
|
"notebooklm": {
|
|
94
94
|
"command": "node",
|
|
95
|
-
"args": ["D:/
|
|
95
|
+
"args": ["D:/path/to/notebooklm-mcp/dist/stdio-http-proxy.js"],
|
|
96
96
|
"env": {
|
|
97
97
|
"MCP_HTTP_URL": "http://localhost:3000"
|
|
98
98
|
}
|
|
@@ -231,7 +231,7 @@ The HTTP server MUST run as a Windows process to access Chrome. Fix:
|
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
233
|
# Use the helper script (recommended)
|
|
234
|
-
HELPER=/mnt/d/
|
|
234
|
+
HELPER=/mnt/d/path/to/notebooklm-mcp/scripts/mcp-wsl-helper.sh
|
|
235
235
|
|
|
236
236
|
# 1. Stop any running server
|
|
237
237
|
$HELPER stop
|
|
@@ -250,7 +250,7 @@ $HELPER health
|
|
|
250
250
|
pkill -f http-wrapper
|
|
251
251
|
|
|
252
252
|
# 2. Start as Windows process
|
|
253
|
-
powershell.exe -Command "Start-Process -NoNewWindow -FilePath 'node' -ArgumentList 'D:/
|
|
253
|
+
powershell.exe -Command "Start-Process -NoNewWindow -FilePath 'node' -ArgumentList 'D:/path/to/notebooklm-mcp/dist/http-wrapper.js' -WorkingDirectory 'D:/path/to/notebooklm-mcp'"
|
|
254
254
|
|
|
255
255
|
# 3. Verify (via PowerShell, not curl from WSL)
|
|
256
256
|
powershell.exe -Command "Invoke-RestMethod -Uri 'http://localhost:3000/health'"
|
|
@@ -259,7 +259,7 @@ Each account may have a different Google Account language setting. The server us
|
|
|
259
259
|
Use the provided script to switch an account's language:
|
|
260
260
|
|
|
261
261
|
```bash
|
|
262
|
-
./scripts/switch-account-language.sh --account=
|
|
262
|
+
./scripts/switch-account-language.sh --account=account-b --lang=fr --show
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
**What it does:**
|
|
@@ -155,6 +155,21 @@ export declare class AccountManager {
|
|
|
155
155
|
* Check if any accounts are configured
|
|
156
156
|
*/
|
|
157
157
|
hasAccounts(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Sync an account's Chrome profile and state to the main (shared) profile.
|
|
160
|
+
* This ensures the browser uses the same cookies/profile as the authenticated account.
|
|
161
|
+
*
|
|
162
|
+
* Copies:
|
|
163
|
+
* - account/<id>/browser_state/state.json → browser_state/state.json
|
|
164
|
+
* - account/<id>/profile/ → chrome_profile/
|
|
165
|
+
*/
|
|
166
|
+
syncProfileToMain(accountId: string): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Sync main profile TO account (reverse direction).
|
|
169
|
+
* Used after performSetup saves fresh auth to the global paths.
|
|
170
|
+
* Copies main state.json → account state.json, main chrome_profile → account profile.
|
|
171
|
+
*/
|
|
172
|
+
syncMainToAccount(accountId: string): Promise<boolean>;
|
|
158
173
|
}
|
|
159
174
|
/**
|
|
160
175
|
* Get or create the account manager instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/accounts/account-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,KAAK,EACV,OAAO,EAKP,aAAa,EACb,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAIpB,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,aAAa,CAAa;;IAWlC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBjC;;OAEG;YACW,iBAAiB;IAW/B;;OAEG;YACW,UAAU;IAwBxB;;OAEG;YACW,UAAU;IAMxB;;OAEG;YACW,YAAY;IAgB1B;;OAEG;YACW,WAAW;IAuDzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAClD,OAAO,CAAC,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IAc1D;;OAEG;IACG,mBAAmB,CACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GACvC,OAAO,CAAC,IAAI,CAAC;IAchB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAW7C;;OAEG;YACW,kBAAkB;IAgEhC;;OAEG;IACH,mBAAmB,IAAI,gBAAgB;IAIvC;;OAEG;IACG,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;OAOG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmD5D;;;;OAIG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA8C7D;AAKD;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAMjE"}
|
|
@@ -598,6 +598,110 @@ export class AccountManager {
|
|
|
598
598
|
hasAccounts() {
|
|
599
599
|
return this.accounts.size > 0;
|
|
600
600
|
}
|
|
601
|
+
/**
|
|
602
|
+
* Sync an account's Chrome profile and state to the main (shared) profile.
|
|
603
|
+
* This ensures the browser uses the same cookies/profile as the authenticated account.
|
|
604
|
+
*
|
|
605
|
+
* Copies:
|
|
606
|
+
* - account/<id>/browser_state/state.json → browser_state/state.json
|
|
607
|
+
* - account/<id>/profile/ → chrome_profile/
|
|
608
|
+
*/
|
|
609
|
+
async syncProfileToMain(accountId) {
|
|
610
|
+
const account = this.accounts.get(accountId);
|
|
611
|
+
if (!account) {
|
|
612
|
+
log.warning(`syncProfileToMain: account ${accountId} not found`);
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
const mainStateFile = path.join(CONFIG.dataDir, 'browser_state', 'state.json');
|
|
616
|
+
const mainProfileDir = path.join(CONFIG.dataDir, 'chrome_profile');
|
|
617
|
+
const accountStateFile = account.stateFilePath;
|
|
618
|
+
const accountProfileDir = account.profileDir;
|
|
619
|
+
log.info(` 📋 Syncing account profile to main profile...`);
|
|
620
|
+
// Ensure main browser_state directory exists
|
|
621
|
+
const mainStateDir = path.dirname(mainStateFile);
|
|
622
|
+
if (!existsSync(mainStateDir)) {
|
|
623
|
+
await fs.mkdir(mainStateDir, { recursive: true });
|
|
624
|
+
}
|
|
625
|
+
// Sync state.json
|
|
626
|
+
if (existsSync(accountStateFile)) {
|
|
627
|
+
try {
|
|
628
|
+
await fs.copyFile(accountStateFile, mainStateFile);
|
|
629
|
+
log.success(` ✅ State synced: ${accountStateFile} → ${mainStateFile}`);
|
|
630
|
+
}
|
|
631
|
+
catch (e) {
|
|
632
|
+
log.warning(` ⚠️ Could not sync state: ${e}`);
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
log.warning(` ⚠️ Account state file not found: ${accountStateFile}`);
|
|
638
|
+
return false;
|
|
639
|
+
}
|
|
640
|
+
// Sync Chrome profile (delete old, copy new)
|
|
641
|
+
if (existsSync(accountProfileDir)) {
|
|
642
|
+
try {
|
|
643
|
+
await fs.rm(mainProfileDir, { recursive: true, force: true });
|
|
644
|
+
await fs.cp(accountProfileDir, mainProfileDir, { recursive: true });
|
|
645
|
+
log.success(` ✅ Chrome profile synced: ${accountProfileDir} → ${mainProfileDir}`);
|
|
646
|
+
}
|
|
647
|
+
catch (e) {
|
|
648
|
+
log.warning(` ⚠️ Could not sync Chrome profile: ${e}`);
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
log.dim(` ℹ️ No account profile directory to sync: ${accountProfileDir}`);
|
|
654
|
+
}
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Sync main profile TO account (reverse direction).
|
|
659
|
+
* Used after performSetup saves fresh auth to the global paths.
|
|
660
|
+
* Copies main state.json → account state.json, main chrome_profile → account profile.
|
|
661
|
+
*/
|
|
662
|
+
async syncMainToAccount(accountId) {
|
|
663
|
+
const account = this.accounts.get(accountId);
|
|
664
|
+
if (!account) {
|
|
665
|
+
log.warning(`syncMainToAccount: account ${accountId} not found`);
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
const mainStateFile = path.join(CONFIG.dataDir, 'browser_state', 'state.json');
|
|
669
|
+
const mainProfileDir = path.join(CONFIG.dataDir, 'chrome_profile');
|
|
670
|
+
const accountStateFile = account.stateFilePath;
|
|
671
|
+
const accountProfileDir = account.profileDir;
|
|
672
|
+
log.info(` 📋 Syncing main profile to account...`);
|
|
673
|
+
// Sync state.json: main → account
|
|
674
|
+
if (existsSync(mainStateFile)) {
|
|
675
|
+
try {
|
|
676
|
+
const accountStateDir = path.dirname(accountStateFile);
|
|
677
|
+
if (!existsSync(accountStateDir)) {
|
|
678
|
+
await fs.mkdir(accountStateDir, { recursive: true });
|
|
679
|
+
}
|
|
680
|
+
await fs.copyFile(mainStateFile, accountStateFile);
|
|
681
|
+
log.success(` ✅ State synced: ${mainStateFile} → ${accountStateFile}`);
|
|
682
|
+
}
|
|
683
|
+
catch (e) {
|
|
684
|
+
log.warning(` ⚠️ Could not sync state to account: ${e}`);
|
|
685
|
+
return false;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
// Sync Chrome profile: main → account
|
|
689
|
+
if (existsSync(mainProfileDir)) {
|
|
690
|
+
try {
|
|
691
|
+
if (!existsSync(path.dirname(accountProfileDir))) {
|
|
692
|
+
await fs.mkdir(path.dirname(accountProfileDir), { recursive: true });
|
|
693
|
+
}
|
|
694
|
+
await fs.rm(accountProfileDir, { recursive: true, force: true });
|
|
695
|
+
await fs.cp(mainProfileDir, accountProfileDir, { recursive: true });
|
|
696
|
+
log.success(` ✅ Chrome profile synced: ${mainProfileDir} → ${accountProfileDir}`);
|
|
697
|
+
}
|
|
698
|
+
catch (e) {
|
|
699
|
+
log.warning(` ⚠️ Could not sync Chrome profile to account: ${e}`);
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
601
705
|
}
|
|
602
706
|
// Singleton instance
|
|
603
707
|
let accountManagerInstance = null;
|