@charlie.act7/gemini-notebook-mcp 2.0.0
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 +21 -0
- package/README.md +435 -0
- package/dist/auth/account-switcher.d.ts +21 -0
- package/dist/auth/account-switcher.d.ts.map +1 -0
- package/dist/auth/account-switcher.js +54 -0
- package/dist/auth/account-switcher.js.map +1 -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 +1006 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/browser/chromium-fallback.d.ts +24 -0
- package/dist/browser/chromium-fallback.d.ts.map +1 -0
- package/dist/browser/chromium-fallback.js +53 -0
- package/dist/browser/chromium-fallback.js.map +1 -0
- package/dist/browser/watchdog.d.ts +35 -0
- package/dist/browser/watchdog.d.ts.map +1 -0
- package/dist/browser/watchdog.js +74 -0
- package/dist/browser/watchdog.js.map +1 -0
- package/dist/config.d.ts +99 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +255 -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/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +558 -0
- package/dist/index.js.map +1 -0
- package/dist/library/metadata.d.ts +14 -0
- package/dist/library/metadata.d.ts.map +1 -0
- package/dist/library/metadata.js +33 -0
- package/dist/library/metadata.js.map +1 -0
- package/dist/library/notebook-library.d.ts +70 -0
- package/dist/library/notebook-library.d.ts.map +1 -0
- package/dist/library/notebook-library.js +311 -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/notebooklm/audio.d.ts +67 -0
- package/dist/notebooklm/audio.d.ts.map +1 -0
- package/dist/notebooklm/audio.js +275 -0
- package/dist/notebooklm/audio.js.map +1 -0
- package/dist/notebooklm/chat.d.ts +79 -0
- package/dist/notebooklm/chat.d.ts.map +1 -0
- package/dist/notebooklm/chat.js +631 -0
- package/dist/notebooklm/chat.js.map +1 -0
- package/dist/notebooklm/citations.d.ts +35 -0
- package/dist/notebooklm/citations.d.ts.map +1 -0
- package/dist/notebooklm/citations.js +173 -0
- package/dist/notebooklm/citations.js.map +1 -0
- package/dist/notebooklm/selectors.d.ts +168 -0
- package/dist/notebooklm/selectors.d.ts.map +1 -0
- package/dist/notebooklm/selectors.js +435 -0
- package/dist/notebooklm/selectors.js.map +1 -0
- package/dist/notebooklm/sources.d.ts +61 -0
- package/dist/notebooklm/sources.d.ts.map +1 -0
- package/dist/notebooklm/sources.js +324 -0
- package/dist/notebooklm/sources.js.map +1 -0
- package/dist/notebooklm/url.d.ts +7 -0
- package/dist/notebooklm/url.d.ts.map +1 -0
- package/dist/notebooklm/url.js +36 -0
- package/dist/notebooklm/url.js.map +1 -0
- package/dist/resources/resource-handlers.d.ts +22 -0
- package/dist/resources/resource-handlers.d.ts.map +1 -0
- package/dist/resources/resource-handlers.js +220 -0
- package/dist/resources/resource-handlers.js.map +1 -0
- package/dist/session/browser-session.d.ts +147 -0
- package/dist/session/browser-session.d.ts.map +1 -0
- package/dist/session/browser-session.js +838 -0
- package/dist/session/browser-session.js.map +1 -0
- package/dist/session/session-manager.d.ts +80 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +294 -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 +465 -0
- package/dist/session/shared-context-manager.js.map +1 -0
- package/dist/tools/definitions/ask-question.d.ts +8 -0
- package/dist/tools/definitions/ask-question.d.ts.map +1 -0
- package/dist/tools/definitions/ask-question.js +244 -0
- package/dist/tools/definitions/ask-question.js.map +1 -0
- package/dist/tools/definitions/notebook-management.d.ts +9 -0
- package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-management.js +263 -0
- package/dist/tools/definitions/notebook-management.js.map +1 -0
- package/dist/tools/definitions/session-management.d.ts +12 -0
- package/dist/tools/definitions/session-management.d.ts.map +1 -0
- package/dist/tools/definitions/session-management.js +82 -0
- package/dist/tools/definitions/session-management.js.map +1 -0
- package/dist/tools/definitions/sources.d.ts +14 -0
- package/dist/tools/definitions/sources.d.ts.map +1 -0
- package/dist/tools/definitions/sources.js +200 -0
- package/dist/tools/definitions/sources.js.map +1 -0
- package/dist/tools/definitions/system.d.ts +9 -0
- package/dist/tools/definitions/system.d.ts.map +1 -0
- package/dist/tools/definitions/system.js +152 -0
- package/dist/tools/definitions/system.js.map +1 -0
- package/dist/tools/definitions.d.ts +12 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +28 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers.d.ts +274 -0
- package/dist/tools/handlers.d.ts.map +1 -0
- package/dist/tools/handlers.js +840 -0
- package/dist/tools/handlers.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/transport/http.d.ts +38 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +231 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/types.d.ts +101 -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 +671 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/cli-handler.d.ts +16 -0
- package/dist/utils/cli-handler.d.ts.map +1 -0
- package/dist/utils/cli-handler.js +105 -0
- package/dist/utils/cli-handler.js.map +1 -0
- package/dist/utils/disclaimer.d.ts +31 -0
- package/dist/utils/disclaimer.d.ts.map +1 -0
- package/dist/utils/disclaimer.js +43 -0
- package/dist/utils/disclaimer.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 +25 -0
- package/dist/utils/page-utils.d.ts.map +1 -0
- package/dist/utils/page-utils.js +51 -0
- package/dist/utils/page-utils.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +37 -0
- package/dist/utils/settings-manager.d.ts.map +1 -0
- package/dist/utils/settings-manager.js +141 -0
- package/dist/utils/settings-manager.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 +399 -0
- package/dist/utils/stealth-utils.js.map +1 -0
- package/docs/configuration.md +181 -0
- package/docs/tools.md +417 -0
- package/docs/troubleshooting.md +171 -0
- package/docs/usage-guide.md +284 -0
- package/package.json +71 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
A symptom → fix matrix for v2.0.0. For the full env-var inventory, see [`configuration.md`](./configuration.md).
|
|
4
|
+
|
|
5
|
+
## Chrome fails to launch (macOS Tahoe / Windows exit 21)
|
|
6
|
+
|
|
7
|
+
Symptom: `Failed to launch chrome`, `chrome exited immediately`, `code 21`, `executable doesn't exist`.
|
|
8
|
+
|
|
9
|
+
Cause: System Chrome on macOS 26 (Tahoe) and certain Windows 11 setups crashes on the persistent profile launch.
|
|
10
|
+
|
|
11
|
+
Fix: Force the bundled Patchright Chromium.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
BROWSER_CHANNEL=chromium npx notebooklm-mcp@latest
|
|
15
|
+
# or
|
|
16
|
+
NOTEBOOKLM_BROWSER_CHANNEL=chromium npx notebooklm-mcp@latest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The fallback is also auto-applied when launch errors match the known patterns, but setting the env var explicitly makes the choice deterministic.
|
|
20
|
+
|
|
21
|
+
## `ask_question` times out
|
|
22
|
+
|
|
23
|
+
Symptom: The tool fails after roughly 10 min with a timeout error.
|
|
24
|
+
|
|
25
|
+
Checks:
|
|
26
|
+
|
|
27
|
+
1. Confirm the answer wait is sufficient — long-form prompts on notebooks with many sources legitimately exceed 2 min.
|
|
28
|
+
```bash
|
|
29
|
+
ANSWER_TIMEOUT_MS=900000 npx notebooklm-mcp@latest # 15 minutes
|
|
30
|
+
```
|
|
31
|
+
Or per-call: `browser_options.timeout_ms`.
|
|
32
|
+
2. Run with a visible browser to see what NotebookLM is doing:
|
|
33
|
+
```json
|
|
34
|
+
{ "name": "ask_question", "arguments": { "question": "...", "show_browser": true } }
|
|
35
|
+
```
|
|
36
|
+
Or start the server with `HEADLESS=false`.
|
|
37
|
+
3. Check `get_health` — if `authenticated=false`, the page is on the login screen, not the notebook.
|
|
38
|
+
|
|
39
|
+
## Session expired / repeated login prompts
|
|
40
|
+
|
|
41
|
+
Symptom: NotebookLM keeps redirecting to the login screen, or `get_health` reports `authenticated=false` after a previously successful login.
|
|
42
|
+
|
|
43
|
+
Workflow:
|
|
44
|
+
|
|
45
|
+
1. Close every Chrome / Chromium instance the user has open. An open Chrome can hold the persistent profile lock.
|
|
46
|
+
2. `re_auth` to wipe stored auth and prompt for a fresh login.
|
|
47
|
+
3. If `re_auth` fails repeatedly, run `cleanup_data` with the library preserved:
|
|
48
|
+
```json
|
|
49
|
+
{ "name": "cleanup_data", "arguments": { "confirm": false, "preserve_library": true } }
|
|
50
|
+
```
|
|
51
|
+
Review the preview, then run again with `confirm: true`. Then `setup_auth`.
|
|
52
|
+
|
|
53
|
+
## WSL1
|
|
54
|
+
|
|
55
|
+
Symptom: Chrome refuses to launch under WSL1.
|
|
56
|
+
|
|
57
|
+
Fix: Upgrade to WSL2.
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
wsl --set-default-version 2
|
|
61
|
+
wsl --set-version <distro> 2
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
WSL2 with WSLg (Windows 11 / Windows 10 22H2+) supports a real Chromium and works out of the box.
|
|
65
|
+
|
|
66
|
+
## Headless Linux server
|
|
67
|
+
|
|
68
|
+
Symptom: `setup_auth` fails on a server with no display because the login window cannot open.
|
|
69
|
+
|
|
70
|
+
Fix: Run the one-time setup under `xvfb-run`. After login the persistent Chrome profile lets every subsequent run go fully headless.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
xvfb-run -a npx notebooklm-mcp@latest
|
|
74
|
+
# call setup_auth from your client, complete login, then exit
|
|
75
|
+
# from then on, run normally:
|
|
76
|
+
npx notebooklm-mcp@latest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## "Unknown resource: mcp://notebooklm"
|
|
80
|
+
|
|
81
|
+
Cause: A client used the wrong URI scheme.
|
|
82
|
+
|
|
83
|
+
Fix: The scheme is `notebooklm://`, not `mcp://`. Supported URIs:
|
|
84
|
+
|
|
85
|
+
- `notebooklm://library`
|
|
86
|
+
- `notebooklm://library/{id}`
|
|
87
|
+
- `notebooklm://metadata` (deprecated)
|
|
88
|
+
|
|
89
|
+
The error message in v2 lists the correct set.
|
|
90
|
+
|
|
91
|
+
## Orphan Chrome processes
|
|
92
|
+
|
|
93
|
+
Symptom: Chrome processes survive after the MCP server exits.
|
|
94
|
+
|
|
95
|
+
v2 ships a 5-second shutdown watchdog and an aggressive teardown path, so this is rare. If it does happen:
|
|
96
|
+
|
|
97
|
+
1. Kill the lingering Chromes manually.
|
|
98
|
+
2. Run `cleanup_data` with `preserve_library: true` to remove stale profile locks.
|
|
99
|
+
3. Restart the server.
|
|
100
|
+
|
|
101
|
+
## Profile lock / `ProcessSingleton` errors
|
|
102
|
+
|
|
103
|
+
Cause: Another Chrome owns the base profile.
|
|
104
|
+
|
|
105
|
+
Fix: The default `NOTEBOOK_PROFILE_STRATEGY=auto` falls back to an isolated per-instance profile. To force isolation always:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
NOTEBOOK_PROFILE_STRATEGY=isolated npx notebooklm-mcp@latest
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Rate limit reached
|
|
112
|
+
|
|
113
|
+
Symptom: `NotebookLM rate limit reached (50 queries/day for free accounts)`.
|
|
114
|
+
|
|
115
|
+
Options:
|
|
116
|
+
|
|
117
|
+
- Use `re_auth` to switch to a different Google account.
|
|
118
|
+
- Use multi-account mode for a clean separation:
|
|
119
|
+
```bash
|
|
120
|
+
NOTEBOOKLM_ACCOUNT=backup npx notebooklm-mcp@latest
|
|
121
|
+
```
|
|
122
|
+
- Wait until the daily quota resets.
|
|
123
|
+
- Upgrade to Google AI Pro/Ultra for higher limits.
|
|
124
|
+
|
|
125
|
+
## Stealth typing too slow
|
|
126
|
+
|
|
127
|
+
The default `160–240 WPM` range is realistic but slow for batch use. Either disable stealth typing or tighten the range:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
STEALTH_HUMAN_TYPING=false npx notebooklm-mcp@latest
|
|
131
|
+
# or
|
|
132
|
+
TYPING_WPM_MIN=400 TYPING_WPM_MAX=600 npx notebooklm-mcp@latest
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Citations are empty for `source_format=footnotes`
|
|
136
|
+
|
|
137
|
+
The DOM citation panel is read after the answer settles. If it is empty:
|
|
138
|
+
|
|
139
|
+
- The notebook may not have grounded sources for that question.
|
|
140
|
+
- The UI may have shifted — check the active selectors in `src/notebooklm/selectors.ts`.
|
|
141
|
+
- Run with `show_browser=true` and inspect the live page after the answer renders.
|
|
142
|
+
|
|
143
|
+
## Follow-up reminder is missing
|
|
144
|
+
|
|
145
|
+
In v2 the follow-up reminder appended to `ask_question` answers is off by default. Re-enable with:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
NOTEBOOKLM_FOLLOW_UP_REMINDER=true npx notebooklm-mcp@latest
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## AI marker breaks downstream parsing
|
|
152
|
+
|
|
153
|
+
The default answer text starts with `[AI-GENERATED via Gemini 2.5 (NotebookLM) — …]`. To return to the unprefixed answer, set:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
NOTEBOOKLM_AI_MARKER=false npx notebooklm-mcp@latest
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Or replace the prefix with your own:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
NOTEBOOKLM_AI_MARKER_PREFIX="[notebooklm]" npx notebooklm-mcp@latest
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The `_provenance` envelope on the result remains regardless.
|
|
166
|
+
|
|
167
|
+
## HTTP transport: `unknown session`
|
|
168
|
+
|
|
169
|
+
Cause: The client made a `GET /mcp` or `POST /mcp` (non-initialize) without echoing the `Mcp-Session-Id` returned by the initial `initialize` response.
|
|
170
|
+
|
|
171
|
+
Fix: Capture the `Mcp-Session-Id` response header from the initialize call and pass it on every subsequent request. The lifecycle is owned by the MCP SDK's `StreamableHTTPServerTransport`.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# Usage Guide
|
|
2
|
+
|
|
3
|
+
Practical end-to-end walkthroughs against v2.0.0. Each section is a self-contained recipe with the exact tool calls / curl commands.
|
|
4
|
+
|
|
5
|
+
- [First-time setup](#first-time-setup)
|
|
6
|
+
- [Multi-turn session pattern](#multi-turn-session-pattern)
|
|
7
|
+
- [Citations workflow](#citations-workflow)
|
|
8
|
+
- [Audio Overview generation + download](#audio-overview-generation--download)
|
|
9
|
+
- [Multi-account switching](#multi-account-switching)
|
|
10
|
+
- [HTTP transport for n8n / Zapier](#http-transport-for-n8n--zapier)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## First-time setup
|
|
15
|
+
|
|
16
|
+
### 1. Install and start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx notebooklm-mcp@latest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Wire it into your MCP client of choice (see the [README](../README.md#connect-to-claude-code)).
|
|
23
|
+
|
|
24
|
+
### 2. Authenticate
|
|
25
|
+
|
|
26
|
+
Call `setup_auth`. A Chrome window opens. Log in to the Google account that owns the NotebookLM notebooks you want to query. Close the browser when done.
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{ "name": "setup_auth", "arguments": {} }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Verify:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{ "name": "get_health", "arguments": {} }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Expect `"authenticated": true`.
|
|
39
|
+
|
|
40
|
+
### 3. Add a notebook to the local library
|
|
41
|
+
|
|
42
|
+
Get a NotebookLM share-URL: open the notebook in `notebook.google.com`, click _Share → Anyone with the link → Copy link_. Legacy `notebooklm.google.com` links are also accepted. Then:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"name": "add_notebook",
|
|
47
|
+
"arguments": {
|
|
48
|
+
"url": "https://notebook.google.com/notebook/abcd-efgh",
|
|
49
|
+
"name": "n8n Documentation",
|
|
50
|
+
"description": "n8n core docs + builtin nodes",
|
|
51
|
+
"topics": ["workflow automation", "n8n", "node configuration"],
|
|
52
|
+
"use_cases": ["building n8n workflows", "debugging n8n executions"],
|
|
53
|
+
"tags": ["docs", "n8n"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Ask the first question
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"name": "ask_question",
|
|
63
|
+
"arguments": {
|
|
64
|
+
"question": "What is the recommended retry pattern for the HTTP Request node?"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Capture `session_id` from the response — you will reuse it for follow-ups.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Multi-turn session pattern
|
|
74
|
+
|
|
75
|
+
Reusing `session_id` keeps NotebookLM's conversational context. The browser session also stays open, so each follow-up is faster.
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
// 1. Open broad — captures session_id
|
|
79
|
+
{ "name": "ask_question", "arguments": {
|
|
80
|
+
"question": "Give me an overview of the n8n error handling architecture."
|
|
81
|
+
}}
|
|
82
|
+
// → response.session_id = "ses_abc123"
|
|
83
|
+
|
|
84
|
+
// 2. Drill in
|
|
85
|
+
{ "name": "ask_question", "arguments": {
|
|
86
|
+
"question": "What's the recommended retry/backoff pattern for HTTP nodes?",
|
|
87
|
+
"session_id": "ses_abc123"
|
|
88
|
+
}}
|
|
89
|
+
|
|
90
|
+
// 3. Edge cases
|
|
91
|
+
{ "name": "ask_question", "arguments": {
|
|
92
|
+
"question": "Common pitfalls when retrying webhook-triggered workflows?",
|
|
93
|
+
"session_id": "ses_abc123"
|
|
94
|
+
}}
|
|
95
|
+
|
|
96
|
+
// 4. Production sample
|
|
97
|
+
{ "name": "ask_question", "arguments": {
|
|
98
|
+
"question": "Show me a production example combining retry + circuit-breaker.",
|
|
99
|
+
"session_id": "ses_abc123"
|
|
100
|
+
}}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
When the task changes, either:
|
|
104
|
+
|
|
105
|
+
- Reset the same session: `{ "name": "reset_session", "arguments": { "session_id": "ses_abc123" } }`
|
|
106
|
+
- Close it: `{ "name": "close_session", "arguments": { "session_id": "ses_abc123" } }` — and start a new one with no `session_id`.
|
|
107
|
+
|
|
108
|
+
Sessions auto-expire after `SESSION_TIMEOUT` seconds of inactivity (default `900` = 15 min).
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Citations workflow
|
|
113
|
+
|
|
114
|
+
Set `source_format` on `ask_question`. Four modes:
|
|
115
|
+
|
|
116
|
+
### `none` (default)
|
|
117
|
+
|
|
118
|
+
Raw answer. No `sources` field.
|
|
119
|
+
|
|
120
|
+
### `inline`
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{ "name": "ask_question", "arguments": {
|
|
124
|
+
"question": "How does refresh-token rotation work?",
|
|
125
|
+
"source_format": "inline"
|
|
126
|
+
}}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`[1]` markers in the answer text get replaced with `(source name — short excerpt)` inline.
|
|
130
|
+
|
|
131
|
+
### `footnotes`
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{ "name": "ask_question", "arguments": {
|
|
135
|
+
"question": "How does refresh-token rotation work?",
|
|
136
|
+
"source_format": "footnotes"
|
|
137
|
+
}}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Response (abridged):
|
|
141
|
+
|
|
142
|
+
```jsonc
|
|
143
|
+
{
|
|
144
|
+
"answer": "[AI-GENERATED ...] Refresh tokens are rotated on every refresh request [1]. The previous token is revoked server-side [2].\n\nSources:\n[1] auth-spec.pdf — \"Refresh tokens MUST be rotated…\"\n[2] auth-spec.pdf — \"On rotation, the previous token MUST be invalidated…\"",
|
|
145
|
+
"sources": [
|
|
146
|
+
{ "index": 1, "title": "auth-spec.pdf", "excerpt": "Refresh tokens MUST be rotated…" },
|
|
147
|
+
{ "index": 2, "title": "auth-spec.pdf", "excerpt": "On rotation, the previous token MUST be invalidated…" }
|
|
148
|
+
],
|
|
149
|
+
"source_format": "footnotes"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### `json`
|
|
154
|
+
|
|
155
|
+
Answer text is left untouched. Citations are returned only as a structured array on `sources`. Use this when you want to render citations yourself.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Audio Overview generation + download
|
|
160
|
+
|
|
161
|
+
Two-step workflow.
|
|
162
|
+
|
|
163
|
+
### 1. Generate
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"name": "generate_audio",
|
|
168
|
+
"arguments": {
|
|
169
|
+
"custom_prompt": "Focus on the migration steps and breaking changes",
|
|
170
|
+
"timeout_ms": 900000
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Generation can take several minutes — keep `timeout_ms` generous. The default is 600 000 ms (10 min).
|
|
176
|
+
|
|
177
|
+
### 2. Download
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"name": "download_audio",
|
|
182
|
+
"arguments": {
|
|
183
|
+
"destination_dir": "/Users/me/Downloads/notebooklm"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Result includes the absolute `file_path` and size in bytes.
|
|
189
|
+
|
|
190
|
+
If you call `download_audio` before any Audio Overview has been generated, the call returns an error pointing at `generate_audio`. Run them in order, in the same notebook.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Multi-account switching
|
|
195
|
+
|
|
196
|
+
Run two parallel installations against different Google accounts:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Terminal A: work account
|
|
200
|
+
npx notebooklm-mcp@latest --account work
|
|
201
|
+
|
|
202
|
+
# Terminal B: personal account
|
|
203
|
+
npx notebooklm-mcp@latest --account personal
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Each account gets its own Chrome profile under `<dataDir>/accounts/<name>/`. The first run for a new account requires its own `setup_auth`. Switching is just a matter of starting the server with a different `--account` flag (or `NOTEBOOKLM_ACCOUNT` env).
|
|
207
|
+
|
|
208
|
+
Use cases:
|
|
209
|
+
|
|
210
|
+
- Working notebooks on a corporate Google account, side-projects on a personal one.
|
|
211
|
+
- Rotating between two free-tier accounts to extend the daily quota.
|
|
212
|
+
|
|
213
|
+
There is no shared library between accounts — each account has its own `library.json`. If you want the same library across accounts, copy `library.json` between the two `accounts/<name>/` directories manually.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## HTTP transport for n8n / Zapier
|
|
218
|
+
|
|
219
|
+
Start the server in HTTP mode:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
npx notebooklm-mcp@latest --transport http --port 3000 --host 0.0.0.0
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The two operations:
|
|
226
|
+
|
|
227
|
+
| Method | Path |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `POST` | `/mcp` |
|
|
230
|
+
| `GET` | `/healthz` |
|
|
231
|
+
|
|
232
|
+
### 1. Initialize a session
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
curl -i -X POST http://localhost:3000/mcp \
|
|
236
|
+
-H 'Content-Type: application/json' \
|
|
237
|
+
-d '{
|
|
238
|
+
"jsonrpc": "2.0",
|
|
239
|
+
"id": 1,
|
|
240
|
+
"method": "initialize",
|
|
241
|
+
"params": {
|
|
242
|
+
"protocolVersion": "2025-03-26",
|
|
243
|
+
"capabilities": {},
|
|
244
|
+
"clientInfo": { "name": "curl", "version": "0.0.1" }
|
|
245
|
+
}
|
|
246
|
+
}'
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Capture the `Mcp-Session-Id` response header. Pass it as a request header on every subsequent call.
|
|
250
|
+
|
|
251
|
+
### 2. Ask a question
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
curl -X POST http://localhost:3000/mcp \
|
|
255
|
+
-H 'Content-Type: application/json' \
|
|
256
|
+
-H 'Mcp-Session-Id: <session-id-from-step-1>' \
|
|
257
|
+
-d '{
|
|
258
|
+
"jsonrpc": "2.0",
|
|
259
|
+
"id": 2,
|
|
260
|
+
"method": "tools/call",
|
|
261
|
+
"params": {
|
|
262
|
+
"name": "ask_question",
|
|
263
|
+
"arguments": {
|
|
264
|
+
"question": "What is the n8n Code node best for?",
|
|
265
|
+
"source_format": "footnotes"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}'
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The response is the standard MCP `tools/call` envelope. The actual tool output lives under `result.content[0].text` as a JSON string.
|
|
272
|
+
|
|
273
|
+
### Liveness probe
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
curl http://localhost:3000/healthz
|
|
277
|
+
# {"status":"ok","protocol":"mcp-streamable-http"}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Notes
|
|
281
|
+
|
|
282
|
+
- The default bind address is `127.0.0.1`. Bind to `0.0.0.0` only on a trusted network.
|
|
283
|
+
- Sessions are kept in process memory; restarting the server invalidates all sessions.
|
|
284
|
+
- For n8n, Zapier, and similar HTTP-only callers, an "HTTP Request" node configured with a per-execution session-id store is enough — initialize once at workflow start, reuse the session for the rest of the run, and let the `DELETE /mcp` route close it cleanly at the end.
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@charlie.act7/gemini-notebook-mcp",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "2.0.0",
|
|
7
|
+
"description": "MCP server for Google Gemini Notebook (formerly NotebookLM) — chat, source ingestion, audio overviews, citations, stdio + Streamable-HTTP transports.",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"bin": {
|
|
10
|
+
"gemini-notebook-mcp": "dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"watch": "tsc --watch",
|
|
15
|
+
"dev": "tsx watch src/index.ts",
|
|
16
|
+
"prepare": "npm run build",
|
|
17
|
+
"test": "tsx --test tests/**/*.test.ts",
|
|
18
|
+
"lint": "eslint src",
|
|
19
|
+
"lint:fix": "eslint src --fix",
|
|
20
|
+
"format": "prettier --write src tests scripts",
|
|
21
|
+
"format:check": "prettier --check src tests scripts",
|
|
22
|
+
"mcp:smoke": "node scripts/mcp-client.mjs health",
|
|
23
|
+
"mcp:auth": "node scripts/mcp-client.mjs auth",
|
|
24
|
+
"mcp:ask": "node scripts/mcp-client.mjs ask",
|
|
25
|
+
"mcp:inspect": "node scripts/inspect-live-chat.mjs",
|
|
26
|
+
"mcp:test-live": "node scripts/test-live-chat.mjs",
|
|
27
|
+
"check": "npm run format:check && npm run lint && npm run build && npm test"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"mcp",
|
|
31
|
+
"notebooklm",
|
|
32
|
+
"gemini",
|
|
33
|
+
"gemini-notebook",
|
|
34
|
+
"ai",
|
|
35
|
+
"claude"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/CharlieCardenasToledo/gemini-notebook-mcp.git"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/CharlieCardenasToledo/gemini-notebook-mcp#readme",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/CharlieCardenasToledo/gemini-notebook-mcp/issues"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"docs"
|
|
51
|
+
],
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
54
|
+
"env-paths": "^3.0.0",
|
|
55
|
+
"globby": "^14.1.0",
|
|
56
|
+
"patchright": "^1.48.2",
|
|
57
|
+
"zod": "^3.22.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@eslint/js": "^10.0.1",
|
|
61
|
+
"@types/node": "^22.13.0",
|
|
62
|
+
"eslint": "^10.2.1",
|
|
63
|
+
"prettier": "^3.8.3",
|
|
64
|
+
"tsx": "^4.7.0",
|
|
65
|
+
"typescript": "^5.3.3",
|
|
66
|
+
"typescript-eslint": "^8.59.1"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22.13.0"
|
|
70
|
+
}
|
|
71
|
+
}
|