使用说明
笔记本mcp
用于Google NotebookLM的安全MCP(模型上下文协议)服务器。使AI助手能够与NotebookLM笔记本进行交互——管理笔记本、查询源、创建音频/视频/报告、运行研究等。
第2版 使用直接的HTTP API调用(运行时没有浏览器自动化),使其比v1快得多,同时保持所有的安全强化。
安全
| 现有MCP中的问题 | 我们的解决方案 |
|---|---|
| 明文cookie存储 | AES-256-GCM加密,密钥在macOS钥匙链中 |
| 没有文件权限 | 0o700 dirs, 0o600 文件,读取时验证 |
--no-sandbox Chrome |
沙盒已启用; --no-sandbox 在阻止列表中 |
| 远程调试端口已暴露 | --remote-debugging-port 在阻止列表中 |
| 存储的谷歌密码 | 仅手动登录-无凭据存储 |
| 无URL验证 | 所有URL均已验证 notebooklm.google.com |
| 通过DOM进行提示注入 | 响应清理程序删除零宽度字符,标记注入模式 |
| 存储的所有Cookie | 仅限 .google.com + notebooklm.google.com 坚持 |
exec() 对于shell命令 |
execFile() 防止外壳注射 |
工具(35)
身份验证(3)
| 工具 | 说明 |
|---|---|
setup_auth |
交互式登录(头戴式浏览器,一次性设置) |
check_auth |
验证身份验证状态 |
clear_auth |
清除所有存储的身份验证数据 |
笔记本管理(7)
| 工具 | 说明 |
|---|---|
notebook_list |
列出您帐户中的所有笔记本 |
notebook_create |
创建新笔记本 |
notebook_get |
获取笔记本详细信息,包括来源 |
notebook_describe |
获取人工智能生成的摘要和建议主题 |
notebook_rename |
重命名笔记本 |
notebook_delete |
删除笔记本(需要confirm=true) |
chat_configure |
配置AI聊天设置(目标、响应长度、自定义提示) |
资源管理(8)
| 工具 | 说明 |
|---|---|
source_add_url |
添加URL或YouTube链接作为源 |
source_add_text |
添加文本内容作为源 |
source_add_drive |
添加Google Drive文档作为源 |
source_describe |
获取AI生成的源代码摘要 |
source_get_content |
获取源的原始文本内容 |
source_list_drive |
列出具有同步状态的驱动器源 |
source_sync_drive |
将驱动器源同步到最新版本 |
source_delete |
删除源(需要confirm=true) |
人工智能查询(1)
| 工具 | 说明 |
|---|---|
notebook_query |
询问有关笔记本来源的问题(支持后续跟进) |
研究(3)
| 工具 | 说明 |
|---|---|
research_start |
开始网络研究(快速或深度模式) |
research_status |
检查研究任务进度 |
research_import |
将研究成果作为笔记本来源导入 |
工作室内容(10)
| 工具 | 说明 |
|---|---|
audio_create |
生成音频播客(格式、长度、语言、焦点) |
video_create |
生成视频概述(视觉风格、语言、焦点) |
report_create |
生成报告(简报文件、学习指南、常见问题解答、时间表、博客) |
flashcards_create |
生成抽认卡(难度) |
quiz_create |
生成测验(问题数、难度) |
infographic_create |
生成信息图(方向、细节级别) |
slide_deck_create |
生成幻灯片(格式、长度) |
data_table_create |
生成数据表 |
studio_status |
检查任何工作室工件的生成状态 |
studio_delete |
删除工作室工件(需要confirm=true) |
思维导图(3)
| 工具 | 说明 |
|---|---|
mind_map_create |
从源生成思维导图(同步,立即返回) |
mind_map_list |
在笔记本中列出所有思维导图 |
mind_map_delete |
删除思维导图(需要confirm=true) |
需求
- Node.js 18+
- macOS(使用Keychain进行密钥存储)
- 具有NotebookLM访问权限的Google帐户
安装
git clone https://github.com/ers123/notebooklm-mcp.git
cd notebooklm-mcp
npm install
npm run build
npx patchright install chromium # needed for one-time setup_auth only
配置
克劳德代码
增添 ~/.claude/mcp_config.json:
{
"mcpServers": {
"notebooklm": {
"command": "node",
"args": ["/path/to/notebooklm-mcp/dist/index.js"]
}
}
}
克劳德桌面版
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"notebooklm": {
"command": "node",
"args": ["/path/to/notebooklm-mcp/dist/index.js"]
}
}
}
任何MCP客户端(stdio)
node /path/to/notebooklm-mcp/dist/index.js
用法
首次设置
- 将MCP服务器连接到您的AI助手
- 跑
setup_auth--浏览器窗口打开 - 手动登录您的Google帐户
- 成功登录后浏览器自动关闭
- Cookie已加密并安全存储
- 所有后续API调用都直接使用HTTP(不需要浏览器)
示例工作流
# List your notebooks
Use notebook_list
# Create a notebook and add sources
Use notebook_create with title "AI Research"
Use source_add_url with notebookId "..." and url "https://example.com/paper.pdf"
Use source_add_text with notebookId "..." and title "Notes" and content "..."
# Query your notebook
Use notebook_query with notebookId "..." and question "What are the key findings?"
Use notebook_query with notebookId "..." and question "Tell me more" and followUp true
# Generate content
Use audio_create with notebookId "..." and format "conversation" and length "medium"
Use report_create with notebookId "..." and reportFormat "briefing_doc"
Use studio_status with notebookId "..." and artifactId "..." to check progress
# Run web research
Use research_start with notebookId "..." and query "latest AI developments" and mode "deep"
Use research_status with notebookId "..." and taskId "..." to check progress
Use research_import with notebookId "..." and taskId "..." to add results as source
建筑
src/
├── index.ts # Entry point + stdio transport
├── server.ts # 35 MCP tools registered
├── config.ts # Constants, API endpoints, timeouts
├── types.ts # Shared interfaces
├── errors.ts # Error class hierarchy
├── api/ # HTTP API layer (v2 core)
│ ├── rpc-client.ts # batchexecute RPC client
│ ├── query-client.ts # Streaming query client
│ ├── response-parser.ts # Anti-XSSI removal + chunk parsing
│ └── constants.ts # RPC IDs + code mappings
├── security/ # Keychain, AES-256-GCM, file perms, URL validation, sanitizer
├── auth/ # Manual login flow, encrypted cookie store
├── browser/ # Patchright launcher (setup_auth only)
└── tools/ # 35 MCP tool handlers
├── notebook/ # list, create, get, describe, rename, delete, chat-configure
├── source/ # add-url, add-text, add-drive, describe, get-content, list-drive, sync-drive, delete
├── query/ # notebook-query (AI Q&A with follow-ups)
├── research/ # start, status, import
├── studio/ # audio, video, report, flashcards, quiz, infographic, slide-deck, data-table, mind-map, status, delete
└── auth-tools/ # setup, check, clear auth
发展
npm run dev # Run with tsx (hot reload)
npm run build # Compile TypeScript
npm test # Run unit tests
npm run test:watch # Run tests in watch mode
依赖项
只有2个运行时依赖关系:
@modelcontextprotocol/sdk--MCP服务器框架zod--输入验证
可选:
patchright--浏览器自动化(仅需要setup_auth)
没有本机模块。内置Node.js加密 crypto.钥匙扣通过 child_process.execFile.
致谢
NotebookLM内部API结构(RPC ID、参数格式、响应模式)由社区反向引擎工作提供信息,包括 王锡正/小册子mcp。所有实现代码均为原始代码。
许可证
麻省理工学院