notebooklm-mcp-server 1.1.2 → 1.1.4
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/dist/client.js +9 -3
- package/dist/index.js +8 -2
- package/dist/server.js +7 -3
- package/dist/update.d.ts +1 -0
- package/dist/update.js +34 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -53,7 +53,12 @@ export class NotebookLMClient {
|
|
|
53
53
|
if (typeof response.data === 'string' && response.data.includes('session expired')) {
|
|
54
54
|
throw new AuthenticationError('Session expired in response body');
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
const rpcResult = this.parseBatchResponse(response.data, rpcId);
|
|
57
|
+
if (rpcResult === null && typeof response.data === 'string' && response.data.length > 0 && !response.data.includes(rpcId)) {
|
|
58
|
+
// Response received but doesn't contain the expected RPC data - likely an auth/session issue
|
|
59
|
+
throw new AuthenticationError('Invalid session or session expired (RPC data not found)');
|
|
60
|
+
}
|
|
61
|
+
return rpcResult;
|
|
57
62
|
}
|
|
58
63
|
catch (error) {
|
|
59
64
|
const isAuthError = error instanceof AuthenticationError ||
|
|
@@ -75,9 +80,10 @@ export class NotebookLMClient {
|
|
|
75
80
|
*/
|
|
76
81
|
parseBatchResponse(data, rpcId) {
|
|
77
82
|
// Google's format is basically a set of chunked JSON arrays
|
|
78
|
-
// We need to extract the
|
|
83
|
+
// We need to extract the payload for the given rpcId
|
|
79
84
|
try {
|
|
80
|
-
const
|
|
85
|
+
const dataStr = typeof data === 'string' ? data : JSON.stringify(data);
|
|
86
|
+
const lines = dataStr.split('\n');
|
|
81
87
|
for (const line of lines) {
|
|
82
88
|
if (line.includes(rpcId)) {
|
|
83
89
|
const match = line.match(/\["wobti",\s*"(.*?)",\s*"(.*?)"\]/);
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { checkForUpdates } from './update.js';
|
|
3
4
|
const program = new Command();
|
|
4
5
|
program
|
|
5
6
|
.name('notebooklm-mcp-server')
|
|
6
7
|
.description('NotebookLM MCP Server (Node.js)')
|
|
7
|
-
.version('1.1.
|
|
8
|
+
.version('1.1.4');
|
|
8
9
|
program
|
|
9
10
|
.command('server')
|
|
10
11
|
.description('Start the MCP server (default)')
|
|
11
12
|
.action(async () => {
|
|
13
|
+
await checkForUpdates();
|
|
12
14
|
await import('./server.js');
|
|
13
15
|
});
|
|
14
16
|
program
|
|
15
17
|
.command('auth')
|
|
16
18
|
.description('Run interactive authentication')
|
|
17
19
|
.action(async () => {
|
|
20
|
+
await checkForUpdates();
|
|
18
21
|
const { runAuthCli } = await import('./auth-cli.js');
|
|
19
22
|
await runAuthCli();
|
|
20
23
|
});
|
|
@@ -22,7 +25,10 @@ program
|
|
|
22
25
|
const args = process.argv.slice(2);
|
|
23
26
|
if (!args.length || !['auth', 'server', '--version', '-h', '--help'].includes(args[0])) {
|
|
24
27
|
// If no args or unknown command, start server
|
|
25
|
-
|
|
28
|
+
(async () => {
|
|
29
|
+
await checkForUpdates();
|
|
30
|
+
import('./server.js');
|
|
31
|
+
})();
|
|
26
32
|
}
|
|
27
33
|
else {
|
|
28
34
|
program.parse();
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,7 @@ import { AuthManager } from "./auth.js";
|
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
const server = new Server({
|
|
8
8
|
name: "notebooklm-mcp-server",
|
|
9
|
-
version: "1.1.
|
|
9
|
+
version: "1.1.4",
|
|
10
10
|
}, {
|
|
11
11
|
capabilities: {
|
|
12
12
|
tools: {},
|
|
@@ -276,7 +276,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
276
276
|
switch (name) {
|
|
277
277
|
case "notebook_list":
|
|
278
278
|
const notebooks = await client.listNotebooks();
|
|
279
|
-
|
|
279
|
+
if (!notebooks || notebooks.length === 0) {
|
|
280
|
+
return { content: [{ type: "text", text: JSON.stringify({ status: "success", notebooks: [], message: "No notebooks found or session expired. Use refresh_auth if needed." }) }] };
|
|
281
|
+
}
|
|
282
|
+
return { content: [{ type: "text", text: JSON.stringify({ status: "success", notebooks }, null, 2) }] };
|
|
280
283
|
case "notebook_create":
|
|
281
284
|
const newId = await client.createNotebook(args?.title);
|
|
282
285
|
return { content: [{ type: "text", text: JSON.stringify({ status: "success", notebook_id: newId }) }] };
|
|
@@ -350,8 +353,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
catch (error) {
|
|
356
|
+
console.error(chalk.red(`Tool execution error [${name}]:`), error);
|
|
353
357
|
return {
|
|
354
|
-
content: [{ type: "text", text: JSON.stringify({ status: "error", error: error.message }) }],
|
|
358
|
+
content: [{ type: "text", text: JSON.stringify({ status: "error", error: error.message || String(error) }) }],
|
|
355
359
|
isError: true,
|
|
356
360
|
};
|
|
357
361
|
}
|
package/dist/update.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkForUpdates(): Promise<void>;
|
package/dist/update.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
export async function checkForUpdates() {
|
|
9
|
+
try {
|
|
10
|
+
// Get current version from package.json
|
|
11
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
12
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
13
|
+
const currentVersion = pkg.version;
|
|
14
|
+
// Get latest version from npm
|
|
15
|
+
const { data } = await axios.get('https://registry.npmjs.org/notebooklm-mcp-server/latest', { timeout: 3000 });
|
|
16
|
+
const latestVersion = data.version;
|
|
17
|
+
if (latestVersion !== currentVersion) {
|
|
18
|
+
// Solo informar si hay una actualización
|
|
19
|
+
console.error(chalk.yellow(`\n[Update] Nueva versión disponible: ${latestVersion} (Actual: ${currentVersion})`));
|
|
20
|
+
console.error(chalk.yellow(`[Update] Actualizando automáticamente...\n`));
|
|
21
|
+
try {
|
|
22
|
+
execSync('npm install -g notebooklm-mcp-server@latest', { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
23
|
+
console.error(chalk.green('[Update] ¡Actualización exitosa! Reinicia para aplicar los cambios.\n'));
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
catch (updateError) {
|
|
27
|
+
console.error(chalk.red('[Update] Error al actualizar. Hazlo manual: npm install -g notebooklm-mcp-server\n'));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// Fail silently if no internet or registry down
|
|
33
|
+
}
|
|
34
|
+
}
|