41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
|
|
#!/usr/bin/env node
|
||
|
|
/**
|
||
|
|
* 补丁: 向 settings.json 添加 notebooklm MCP 服务器配置
|
||
|
|
* 用法: node patch-add-notebooklm-mcp.js
|
||
|
|
*/
|
||
|
|
const fs = require('fs');
|
||
|
|
const path = require('path');
|
||
|
|
|
||
|
|
const SETTINGS_PATH = path.join(__dirname, '..', 'settings.json');
|
||
|
|
|
||
|
|
try {
|
||
|
|
const settings = JSON.parse(fs.readFileSync(SETTINGS_PATH, 'utf8'));
|
||
|
|
|
||
|
|
if (settings.mcpServers && settings.mcpServers.notebooklm) {
|
||
|
|
console.log('[SKIP] notebooklm MCP 已存在于 settings.json');
|
||
|
|
process.exit(0);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!settings.mcpServers) {
|
||
|
|
settings.mcpServers = {};
|
||
|
|
}
|
||
|
|
|
||
|
|
settings.mcpServers.notebooklm = {
|
||
|
|
command: 'C:\\Python314\\python.exe',
|
||
|
|
args: ['-m', 'notebooklm_tools.mcp.server'],
|
||
|
|
type: 'stdio',
|
||
|
|
env: {
|
||
|
|
NOTEBOOKLM_COOKIES: '${NOTEBOOKLM_COOKIES}'
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
fs.writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
||
|
|
console.log('[OK] notebooklm MCP 已添加到 settings.json');
|
||
|
|
console.log(' command: C:\\Python314\\python.exe -m notebooklm_tools.mcp.server');
|
||
|
|
console.log(' transport: stdio');
|
||
|
|
console.log(' 注意: 需要设置环境变量 NOTEBOOKLM_COOKIES (从 Chrome DevTools 获取)');
|
||
|
|
} catch (e) {
|
||
|
|
console.error(`[ERROR] ${e.message}`);
|
||
|
|
process.exit(1);
|
||
|
|
}
|