@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
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { dirname, join, resolve } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const repoRoot = resolve(__dirname, '..');
|
|
9
|
+
|
|
10
|
+
function parseArgs(argv) {
|
|
11
|
+
const args = {
|
|
12
|
+
mode: 'basic',
|
|
13
|
+
baseUrl: process.env.NOTEBOOKLM_MCP_BASE_URL || 'http://127.0.0.1:3000',
|
|
14
|
+
notebookUrl: process.env.NOTEBOOK_URL || '',
|
|
15
|
+
timeoutMs: 15000,
|
|
16
|
+
question:
|
|
17
|
+
'What is the main topic covered by this notebook? Answer in one sentence.',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const arg = argv[i];
|
|
22
|
+
switch (arg) {
|
|
23
|
+
case '--basic':
|
|
24
|
+
args.mode = 'basic';
|
|
25
|
+
break;
|
|
26
|
+
case '--http':
|
|
27
|
+
args.mode = 'http';
|
|
28
|
+
break;
|
|
29
|
+
case '--base-url':
|
|
30
|
+
args.baseUrl = argv[++i] || args.baseUrl;
|
|
31
|
+
break;
|
|
32
|
+
case '--notebook-url':
|
|
33
|
+
args.notebookUrl = argv[++i] || '';
|
|
34
|
+
break;
|
|
35
|
+
case '--timeout-ms':
|
|
36
|
+
args.timeoutMs = Number(argv[++i] || args.timeoutMs);
|
|
37
|
+
break;
|
|
38
|
+
case '--question':
|
|
39
|
+
args.question = argv[++i] || args.question;
|
|
40
|
+
break;
|
|
41
|
+
case '--help':
|
|
42
|
+
case '-h':
|
|
43
|
+
printHelp();
|
|
44
|
+
process.exit(0);
|
|
45
|
+
default:
|
|
46
|
+
if (arg.startsWith('--base-url=')) {
|
|
47
|
+
args.baseUrl = arg.split('=', 2)[1];
|
|
48
|
+
} else if (arg.startsWith('--notebook-url=')) {
|
|
49
|
+
args.notebookUrl = arg.split('=', 2)[1];
|
|
50
|
+
} else if (arg.startsWith('--timeout-ms=')) {
|
|
51
|
+
args.timeoutMs = Number(arg.split('=', 2)[1]);
|
|
52
|
+
} else if (arg.startsWith('--question=')) {
|
|
53
|
+
args.question = arg.split('=', 2)[1];
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return args;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function printHelp() {
|
|
64
|
+
console.log(`NotebookLM MCP doctor
|
|
65
|
+
|
|
66
|
+
Usage:
|
|
67
|
+
node scripts/doctor.mjs --basic
|
|
68
|
+
node scripts/doctor.mjs --http
|
|
69
|
+
node scripts/doctor.mjs --http --notebook-url "https://notebooklm.google.com/notebook/<your-notebook-id>"
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
--basic Run repo and build checks only.
|
|
73
|
+
--http Also verify the local HTTP server.
|
|
74
|
+
--base-url <url> Override HTTP base URL (default: http://127.0.0.1:3000).
|
|
75
|
+
--notebook-url <url> Optional NotebookLM URL for /content and /ask checks.
|
|
76
|
+
--timeout-ms <ms> Per-request timeout in milliseconds.
|
|
77
|
+
--question <text> Custom ask prompt for the /ask verification step.
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function pass(message) {
|
|
82
|
+
console.log(`[PASS] ${message}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function warn(message) {
|
|
86
|
+
console.log(`[WARN] ${message}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function fail(message) {
|
|
90
|
+
console.error(`[FAIL] ${message}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function loadPackageJson() {
|
|
94
|
+
const packagePath = join(repoRoot, 'package.json');
|
|
95
|
+
if (!existsSync(packagePath)) {
|
|
96
|
+
throw new Error(`package.json not found at ${packagePath}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getMinNodeMajor(range) {
|
|
103
|
+
const match = String(range || '').match(/(\d+)/);
|
|
104
|
+
return match ? Number(match[1]) : 18;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function fetchJson(url, options = {}, timeoutMs = 15000) {
|
|
108
|
+
const controller = new AbortController();
|
|
109
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
const response = await fetch(url, {
|
|
113
|
+
...options,
|
|
114
|
+
signal: controller.signal,
|
|
115
|
+
headers: {
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
...(options.headers || {}),
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const text = await response.text();
|
|
122
|
+
let data;
|
|
123
|
+
try {
|
|
124
|
+
data = text ? JSON.parse(text) : {};
|
|
125
|
+
} catch {
|
|
126
|
+
data = { raw: text };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return { ok: response.ok, status: response.status, data };
|
|
130
|
+
} finally {
|
|
131
|
+
clearTimeout(timeout);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function main() {
|
|
136
|
+
const args = parseArgs(process.argv.slice(2));
|
|
137
|
+
let hasFailure = false;
|
|
138
|
+
|
|
139
|
+
const packageJson = loadPackageJson();
|
|
140
|
+
const requiredNode = getMinNodeMajor(packageJson.engines?.node);
|
|
141
|
+
const currentNode = Number(process.versions.node.split('.')[0]);
|
|
142
|
+
|
|
143
|
+
if (currentNode < requiredNode) {
|
|
144
|
+
fail(`Node.js ${process.versions.node} is too old. Required: >=${requiredNode}`);
|
|
145
|
+
hasFailure = true;
|
|
146
|
+
} else {
|
|
147
|
+
pass(`Node.js ${process.versions.node} satisfies engines.node (${packageJson.engines?.node})`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const requiredPaths = [
|
|
151
|
+
['package.json', join(repoRoot, 'package.json')],
|
|
152
|
+
['README.md', join(repoRoot, 'README.md')],
|
|
153
|
+
['dist/index.js', join(repoRoot, 'dist', 'index.js')],
|
|
154
|
+
['dist/http-wrapper.js', join(repoRoot, 'dist', 'http-wrapper.js')],
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
for (const [label, filePath] of requiredPaths) {
|
|
158
|
+
if (existsSync(filePath)) {
|
|
159
|
+
pass(`Found ${label}`);
|
|
160
|
+
} else {
|
|
161
|
+
fail(`Missing ${label} at ${filePath}`);
|
|
162
|
+
hasFailure = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (args.mode !== 'http') {
|
|
167
|
+
if (hasFailure) {
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
pass('Basic verification completed.');
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const health = await fetchJson(`${args.baseUrl}/health`, {}, args.timeoutMs).catch((error) => {
|
|
175
|
+
fail(`Could not reach ${args.baseUrl}/health: ${error.message}`);
|
|
176
|
+
hasFailure = true;
|
|
177
|
+
return null;
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
if (!health) {
|
|
181
|
+
process.exit(1);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!health.ok || !health.data?.success) {
|
|
185
|
+
fail(`/health failed with status ${health.status}`);
|
|
186
|
+
hasFailure = true;
|
|
187
|
+
} else {
|
|
188
|
+
pass(`/health succeeded (authenticated=${health.data?.data?.authenticated === true})`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!args.notebookUrl) {
|
|
192
|
+
warn('No notebook URL provided. Skipping /content and /ask checks.');
|
|
193
|
+
process.exit(hasFailure ? 1 : 0);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const encodedNotebookUrl = encodeURIComponent(args.notebookUrl);
|
|
197
|
+
const content = await fetchJson(
|
|
198
|
+
`${args.baseUrl}/content?notebook_url=${encodedNotebookUrl}`,
|
|
199
|
+
{},
|
|
200
|
+
Math.max(args.timeoutMs, 30000)
|
|
201
|
+
).catch((error) => {
|
|
202
|
+
fail(`/content request failed: ${error.message}`);
|
|
203
|
+
hasFailure = true;
|
|
204
|
+
return null;
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (content) {
|
|
208
|
+
if (!content.ok || !content.data?.success) {
|
|
209
|
+
fail(`/content failed with status ${content.status}`);
|
|
210
|
+
hasFailure = true;
|
|
211
|
+
} else {
|
|
212
|
+
const sourceCount = content.data?.data?.sourceCount;
|
|
213
|
+
pass(`/content succeeded${typeof sourceCount === 'number' ? ` (sourceCount=${sourceCount})` : ''}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const askPayload = {
|
|
218
|
+
question: args.question,
|
|
219
|
+
notebook_url: args.notebookUrl,
|
|
220
|
+
session_id: `doctor-${Date.now()}`,
|
|
221
|
+
source_format: 'none',
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const ask = await fetchJson(
|
|
225
|
+
`${args.baseUrl}/ask`,
|
|
226
|
+
{
|
|
227
|
+
method: 'POST',
|
|
228
|
+
body: JSON.stringify(askPayload),
|
|
229
|
+
},
|
|
230
|
+
Math.max(args.timeoutMs, 120000)
|
|
231
|
+
).catch((error) => {
|
|
232
|
+
fail(`/ask request failed: ${error.message}`);
|
|
233
|
+
hasFailure = true;
|
|
234
|
+
return null;
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
if (ask) {
|
|
238
|
+
if (!ask.ok || !ask.data?.success) {
|
|
239
|
+
fail(`/ask failed with status ${ask.status}`);
|
|
240
|
+
hasFailure = true;
|
|
241
|
+
} else {
|
|
242
|
+
const answer = ask.data?.data?.answer || '';
|
|
243
|
+
pass(`/ask succeeded (${answer.length} chars returned)`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (hasFailure) {
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
pass('HTTP verification completed.');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
main().catch((error) => {
|
|
255
|
+
fail(error.message);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# MCP Proxy Launcher - Hidden Window
|
|
2
|
+
# Lance le stdio-http-proxy sans fenêtre visible
|
|
3
|
+
|
|
4
|
+
$scriptPath = Split-Path -Parent $PSScriptRoot
|
|
5
|
+
$proxyPath = Join-Path $scriptPath "dist\stdio-http-proxy.js"
|
|
6
|
+
|
|
7
|
+
$env:NBLM_HOST = "localhost"
|
|
8
|
+
$env:NBLM_PORT = "3000"
|
|
9
|
+
|
|
10
|
+
# Lance node avec la fenêtre cachée
|
|
11
|
+
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
|
12
|
+
$psi.FileName = "node"
|
|
13
|
+
$psi.Arguments = $proxyPath
|
|
14
|
+
$psi.WorkingDirectory = $scriptPath
|
|
15
|
+
$psi.UseShellExecute = $false
|
|
16
|
+
$psi.RedirectStandardInput = $true
|
|
17
|
+
$psi.RedirectStandardOutput = $true
|
|
18
|
+
$psi.RedirectStandardError = $true
|
|
19
|
+
$psi.CreateNoWindow = $true
|
|
20
|
+
|
|
21
|
+
$process = [System.Diagnostics.Process]::Start($psi)
|
|
22
|
+
|
|
23
|
+
# Relay stdin/stdout pour le protocole MCP
|
|
24
|
+
$inputTask = [System.Threading.Tasks.Task]::Run({
|
|
25
|
+
param($proc)
|
|
26
|
+
try {
|
|
27
|
+
[Console]::OpenStandardInput().CopyTo($proc.StandardInput.BaseStream)
|
|
28
|
+
} catch {}
|
|
29
|
+
}, $process)
|
|
30
|
+
|
|
31
|
+
$process.StandardOutput.BaseStream.CopyTo([Console]::OpenStandardOutput())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
' NotebookLM MCP Server - hidden startup helper
|
|
2
|
+
' Starts the HTTP server without opening a visible console window.
|
|
3
|
+
|
|
4
|
+
Dim fso
|
|
5
|
+
Dim shell
|
|
6
|
+
Dim scriptDir
|
|
7
|
+
Dim projectDir
|
|
8
|
+
|
|
9
|
+
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
10
|
+
Set shell = CreateObject("WScript.Shell")
|
|
11
|
+
|
|
12
|
+
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
|
13
|
+
projectDir = fso.GetParentFolderName(scriptDir)
|
|
14
|
+
|
|
15
|
+
shell.CurrentDirectory = projectDir
|
|
16
|
+
shell.Run "node dist/http-wrapper.js", 0, False
|
package/scripts/start-server.ps1
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
.EXAMPLE
|
|
13
13
|
# Run in background (hidden window)
|
|
14
|
-
Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -File D:\
|
|
14
|
+
Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -File D:\path\to\notebooklm-mcp\scripts\start-server.ps1" -WindowStyle Hidden
|
|
15
15
|
#>
|
|
16
16
|
|
|
17
17
|
param(
|
|
@@ -1,191 +1,150 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Switch Account Language Script
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
# PREREQUISITE: You must first change the language in Google Account settings:
|
|
9
|
-
# https://myaccount.google.com/language
|
|
10
|
-
#
|
|
11
|
-
# Usage:
|
|
12
|
-
# ./switch-account-language.sh --account=rom1pey --lang=en
|
|
13
|
-
# ./switch-account-language.sh --account=mathieu --lang=fr
|
|
14
|
-
# ./switch-account-language.sh --account=rpmonster --lang=en --show
|
|
4
|
+
# Refreshes one account profile after the user changes the Google Account
|
|
5
|
+
# language. This script is intentionally generic: you provide the account ID,
|
|
6
|
+
# repo root, and optionally the NotebookLM data directory.
|
|
15
7
|
|
|
16
|
-
set -
|
|
8
|
+
set -euo pipefail
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
ACCOUNT=""
|
|
10
|
+
ACCOUNT_ID=""
|
|
20
11
|
LANG=""
|
|
21
12
|
SHOW_BROWSER=""
|
|
13
|
+
REPO_ROOT=""
|
|
14
|
+
DATA_PATH="${NOTEBOOKLM_DATA_PATH:-}"
|
|
15
|
+
|
|
16
|
+
usage() {
|
|
17
|
+
echo "Switch Account Language Script"
|
|
18
|
+
echo ""
|
|
19
|
+
echo "Prerequisite:"
|
|
20
|
+
echo " Change the Google Account language first:"
|
|
21
|
+
echo " https://myaccount.google.com/language"
|
|
22
|
+
echo ""
|
|
23
|
+
echo "Usage:"
|
|
24
|
+
echo " ./scripts/switch-account-language.sh --account-id=account-0000000000001 --lang=en --repo-root=/absolute/path/to/notebooklm-mcp"
|
|
25
|
+
echo ""
|
|
26
|
+
echo "Options:"
|
|
27
|
+
echo " --account-id=ID Account directory ID under Data/accounts/ (required)"
|
|
28
|
+
echo " --lang=LANG Target UI locale: en|fr (required)"
|
|
29
|
+
echo " --repo-root=PATH Repo root containing package.json (required unless run there)"
|
|
30
|
+
echo " --data-path=PATH NotebookLM data directory override"
|
|
31
|
+
echo " --show Show browser during re-authentication"
|
|
32
|
+
echo " --help Show this help"
|
|
33
|
+
}
|
|
22
34
|
|
|
23
|
-
# Account configurations
|
|
24
|
-
declare -A ACCOUNT_IDS=(
|
|
25
|
-
["mathieu"]="account-1766565732376"
|
|
26
|
-
["rpmonster"]="account-1767078713573"
|
|
27
|
-
["rom1pey"]="account-1767079146601"
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
declare -A ACCOUNT_EMAILS=(
|
|
31
|
-
["mathieu"]="mathieudumont31@gmail.com"
|
|
32
|
-
["rpmonster"]="rpmonster@gmail.com"
|
|
33
|
-
["rom1pey"]="rom1pey@gmail.com"
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
# Data path
|
|
37
|
-
DATA_PATH="/mnt/c/Users/romai/AppData/Local/notebooklm-mcp/Data"
|
|
38
|
-
|
|
39
|
-
# Parse arguments
|
|
40
35
|
for arg in "$@"; do
|
|
41
36
|
case $arg in
|
|
42
|
-
--account=*)
|
|
43
|
-
|
|
37
|
+
--account-id=*)
|
|
38
|
+
ACCOUNT_ID="${arg#*=}"
|
|
44
39
|
;;
|
|
45
40
|
--lang=*)
|
|
46
41
|
LANG="${arg#*=}"
|
|
47
42
|
;;
|
|
43
|
+
--repo-root=*)
|
|
44
|
+
REPO_ROOT="${arg#*=}"
|
|
45
|
+
;;
|
|
46
|
+
--data-path=*)
|
|
47
|
+
DATA_PATH="${arg#*=}"
|
|
48
|
+
;;
|
|
48
49
|
--show)
|
|
49
50
|
SHOW_BROWSER="--show"
|
|
50
51
|
;;
|
|
51
52
|
--help)
|
|
52
|
-
|
|
53
|
-
echo ""
|
|
54
|
-
echo "PREREQUISITE: Change language in Google Account first:"
|
|
55
|
-
echo " https://myaccount.google.com/language"
|
|
56
|
-
echo ""
|
|
57
|
-
echo "Usage: ./switch-account-language.sh [options]"
|
|
58
|
-
echo ""
|
|
59
|
-
echo "Options:"
|
|
60
|
-
echo " --account=NAME Account: mathieu|rpmonster|rom1pey (required)"
|
|
61
|
-
echo " --lang=LANG Target language: en|fr (required)"
|
|
62
|
-
echo " --show Show browser during re-authentication"
|
|
63
|
-
echo " --help Show this help"
|
|
64
|
-
echo ""
|
|
65
|
-
echo "Examples:"
|
|
66
|
-
echo " ./switch-account-language.sh --account=rom1pey --lang=en"
|
|
67
|
-
echo " ./switch-account-language.sh --account=mathieu --lang=fr --show"
|
|
53
|
+
usage
|
|
68
54
|
exit 0
|
|
69
55
|
;;
|
|
56
|
+
*)
|
|
57
|
+
echo "ERROR: Unknown argument: $arg"
|
|
58
|
+
usage
|
|
59
|
+
exit 1
|
|
60
|
+
;;
|
|
70
61
|
esac
|
|
71
62
|
done
|
|
72
63
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
echo "Use --help for usage information"
|
|
64
|
+
if [ -z "$ACCOUNT_ID" ]; then
|
|
65
|
+
echo "ERROR: --account-id is required"
|
|
66
|
+
usage
|
|
77
67
|
exit 1
|
|
78
68
|
fi
|
|
79
69
|
|
|
80
70
|
if [ -z "$LANG" ]; then
|
|
81
71
|
echo "ERROR: --lang is required"
|
|
82
|
-
|
|
72
|
+
usage
|
|
83
73
|
exit 1
|
|
84
74
|
fi
|
|
85
75
|
|
|
86
|
-
if [
|
|
87
|
-
echo "ERROR:
|
|
88
|
-
echo "Valid accounts: mathieu, rpmonster, rom1pey"
|
|
76
|
+
if [ "$LANG" != "en" ] && [ "$LANG" != "fr" ]; then
|
|
77
|
+
echo "ERROR: --lang must be en or fr"
|
|
89
78
|
exit 1
|
|
90
79
|
fi
|
|
91
80
|
|
|
92
|
-
if [
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
if [ -z "$REPO_ROOT" ]; then
|
|
82
|
+
if [ -f "./package.json" ]; then
|
|
83
|
+
REPO_ROOT="$(pwd)"
|
|
84
|
+
else
|
|
85
|
+
echo "ERROR: --repo-root is required unless you run the script from the repo root"
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
if [ ! -f "$REPO_ROOT/package.json" ]; then
|
|
91
|
+
echo "ERROR: package.json not found in repo root: $REPO_ROOT"
|
|
95
92
|
exit 1
|
|
96
93
|
fi
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
if [ -z "$DATA_PATH" ]; then
|
|
96
|
+
if [ -n "${LOCALAPPDATA:-}" ]; then
|
|
97
|
+
DATA_PATH="${LOCALAPPDATA}/notebooklm-mcp/Data"
|
|
98
|
+
else
|
|
99
|
+
echo "ERROR: data path not set. Use --data-path or NOTEBOOKLM_DATA_PATH."
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
fi
|
|
100
103
|
|
|
101
|
-
echo "
|
|
102
|
-
echo "
|
|
103
|
-
echo "
|
|
104
|
-
echo "
|
|
105
|
-
echo "
|
|
106
|
-
echo "╚════════════════════════════════════════════════════════════╝"
|
|
104
|
+
echo "Switching account language"
|
|
105
|
+
echo " account-id: $ACCOUNT_ID"
|
|
106
|
+
echo " locale: $LANG"
|
|
107
|
+
echo " repo-root: $REPO_ROOT"
|
|
108
|
+
echo " data-path: $DATA_PATH"
|
|
107
109
|
echo ""
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
echo "Step 1/5: Stopping server and Chrome..."
|
|
111
|
+
echo "Step 1/5: Stopping repo-related Node processes..."
|
|
111
112
|
cmd.exe /c "taskkill /F /IM node.exe" 2>/dev/null || true
|
|
112
113
|
sleep 1
|
|
113
|
-
# Only kill Chrome if profile is locked (don't kill user's personal browser)
|
|
114
|
-
if [ -f "$DATA_PATH/chrome_profile/lockfile" ] 2>/dev/null; then
|
|
115
|
-
echo " Chrome profile locked, killing Chrome..."
|
|
116
|
-
cmd.exe /c "taskkill /F /IM chrome.exe" 2>/dev/null || true
|
|
117
|
-
sleep 2
|
|
118
|
-
fi
|
|
119
|
-
echo " Done."
|
|
120
114
|
|
|
121
|
-
|
|
122
|
-
echo ""
|
|
123
|
-
echo "Step 2/5: Deleting Chrome profile cache for $ACCOUNT..."
|
|
115
|
+
echo "Step 2/5: Removing cached profile for the selected account..."
|
|
124
116
|
ACCOUNT_PROFILE="$DATA_PATH/accounts/$ACCOUNT_ID/profile"
|
|
125
117
|
if [ -d "$ACCOUNT_PROFILE" ]; then
|
|
126
118
|
rm -rf "$ACCOUNT_PROFILE"
|
|
127
|
-
echo "
|
|
119
|
+
echo " Removed $ACCOUNT_PROFILE"
|
|
128
120
|
else
|
|
129
|
-
echo "
|
|
121
|
+
echo " No account profile found to remove"
|
|
130
122
|
fi
|
|
131
|
-
echo " Done."
|
|
132
|
-
|
|
133
|
-
# Step 3: Re-authenticate to create fresh profile
|
|
134
|
-
echo ""
|
|
135
|
-
echo "Step 3/5: Re-authenticating $ACCOUNT..."
|
|
136
|
-
echo " This will open a browser to log in with the new language settings."
|
|
137
|
-
echo ""
|
|
138
123
|
|
|
139
|
-
|
|
140
|
-
cmd.exe /c "cd /d
|
|
141
|
-
|
|
142
|
-
echo " Done."
|
|
143
|
-
|
|
144
|
-
# Step 4: Sync new profile to main
|
|
145
|
-
echo ""
|
|
146
|
-
echo "Step 4/5: Syncing new profile to main..."
|
|
124
|
+
echo "Step 3/5: Re-authenticating the selected account..."
|
|
125
|
+
cmd.exe /c "cd /d $REPO_ROOT && npm run accounts test $ACCOUNT_ID -- $SHOW_BROWSER"
|
|
147
126
|
|
|
148
|
-
|
|
127
|
+
echo "Step 4/5: Syncing the refreshed profile into the active data path..."
|
|
149
128
|
if [ -f "$DATA_PATH/accounts/$ACCOUNT_ID/browser_state/state.json" ]; then
|
|
150
|
-
|
|
151
|
-
|
|
129
|
+
mkdir -p "$DATA_PATH/browser_state"
|
|
130
|
+
cp "$DATA_PATH/accounts/$ACCOUNT_ID/browser_state/state.json" "$DATA_PATH/browser_state/state.json"
|
|
131
|
+
echo " Synced browser_state/state.json"
|
|
152
132
|
else
|
|
153
|
-
echo " WARNING: state.json not found"
|
|
133
|
+
echo " WARNING: browser_state/state.json not found for $ACCOUNT_ID"
|
|
154
134
|
fi
|
|
155
135
|
|
|
156
|
-
# Sync Chrome profile
|
|
157
136
|
rm -rf "$DATA_PATH/chrome_profile" 2>/dev/null || true
|
|
158
137
|
if [ -d "$DATA_PATH/accounts/$ACCOUNT_ID/profile" ]; then
|
|
159
138
|
cp -r "$DATA_PATH/accounts/$ACCOUNT_ID/profile" "$DATA_PATH/chrome_profile"
|
|
160
|
-
echo " Synced
|
|
139
|
+
echo " Synced chrome_profile/"
|
|
161
140
|
else
|
|
162
|
-
echo " WARNING:
|
|
141
|
+
echo " WARNING: refreshed profile not found for $ACCOUNT_ID"
|
|
163
142
|
fi
|
|
164
|
-
echo " Done."
|
|
165
143
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
echo "Step 5/5: Starting server with UI locale '$LANG'..."
|
|
169
|
-
|
|
170
|
-
# Convert lang to uppercase for display
|
|
171
|
-
LANG_UPPER=$(echo "$LANG" | tr '[:lower:]' '[:upper:]')
|
|
172
|
-
|
|
173
|
-
cmd.exe /c "cd /d D:\\Claude\\notebooklm-mcp-http && set NOTEBOOKLM_UI_LOCALE=$LANG&& start /B node dist/http-wrapper.js" &
|
|
144
|
+
echo "Step 5/5: Restarting the HTTP server with the requested locale..."
|
|
145
|
+
cmd.exe /c "cd /d $REPO_ROOT && set NOTEBOOKLM_UI_LOCALE=$LANG&& start /B node dist/http-wrapper.js" >/dev/null
|
|
174
146
|
sleep 4
|
|
175
147
|
|
|
176
|
-
# Verify
|
|
177
|
-
echo ""
|
|
178
|
-
echo "Verifying server..."
|
|
179
|
-
HEALTH=$(cmd.exe /c "curl -s http://localhost:3000/health" 2>/dev/null || echo '{"error":"failed"}')
|
|
180
|
-
echo "$HEALTH" | head -c 200
|
|
181
|
-
|
|
182
|
-
echo ""
|
|
183
148
|
echo ""
|
|
184
|
-
echo "
|
|
185
|
-
|
|
186
|
-
echo "╠════════════════════════════════════════════════════════════╣"
|
|
187
|
-
echo "║ Account '$ACCOUNT' is now configured for '$LANG_UPPER'."
|
|
188
|
-
echo "║ ║"
|
|
189
|
-
echo "║ IMPORTANT: Verify visually that NotebookLM UI is in $LANG_UPPER ║"
|
|
190
|
-
echo "║ by running a test with show_browser:true ║"
|
|
191
|
-
echo "╚════════════════════════════════════════════════════════════╝"
|
|
149
|
+
echo "Health check:"
|
|
150
|
+
cmd.exe /c "curl -s http://127.0.0.1:3000/health" || true
|