notebooklm-mcp-rpc

notebooklm-mcp-rpc

A pure-TypeScript MCP server for Google NotebookLM using the batchexecute RPC protocol. Enables management of notebooks, sources, chat, and artifact generation with no Python dependencies.

Category
访问服务器

README

notebooklm-mcp-rpc

A pure-TypeScript Model Context Protocol server for Google NotebookLM. Speaks Google's undocumented batchexecute RPC protocol directly — no Python runtime, no notebooklm CLI, no shelling out. Deploys cleanly to Vercel Node functions.

Companion / sibling project to notebooklm-mcp, which wraps the notebooklm-py CLI as a subprocess. Pick this one if you want zero Python dependencies and seamless serverless deployment.

What's in the box

  • Native RPC client — encoder/decoder for the batchexecute wire format ported faithfully from notebooklm-py's _core.py and rpc/.
  • Native chat client — POSTs to the streaming GenerateFreeFormStreamed endpoint and parses the chunked response.
  • 51 MCP tools spanning notebooks, sources, chat, artifacts (all 9 generation types + downloads), notes, research, sharing, and language settings.
  • Auth refresh — concurrent-safe re-scrape of SNlM0e / FdrFJe on 401/403.
  • Stdio + Streamable-HTTP transports. Vercel adapter included.
  • Strict TypeScript: exactOptionalPropertyTypes, noUncheckedIndexedAccess, verbatimModuleSyntax, full Zod input validation.

Quick start

npm install
npm run build

# Provide auth (one of the three options below) — see "Authentication".
export NOTEBOOKLM_STORAGE_PATH=/Users/me/.notebooklm/storage_state.json

# Run the server (stdio, default).
node dist/index.js

Hooking up Claude Desktop / Cursor / Windsurf

{
  "mcpServers": {
    "notebooklm": {
      "command": "node",
      "args": ["/absolute/path/to/notebooklm-mcp-rpc/dist/index.js"],
      "env": {
        "NOTEBOOKLM_STORAGE_PATH": "/Users/me/.notebooklm/storage_state.json"
      }
    }
  }
}

Remote / HTTP

MCP_TRANSPORT=http PORT=3000 node dist/index.js
# POST JSON-RPC to http://localhost:3000/mcp
# GET http://localhost:3000/healthz for a liveness check

Vercel

Push to Vercel — vercel.json and api/mcp.ts are already wired:

vercel deploy
# Endpoint: https://<your-project>.vercel.app/mcp

Set NOTEBOOKLM_AUTH_JSON (the inline contents of storage_state.json) as a project env var. The Vercel Node runtime supports everything we need; no custom container.

Authentication

You need a valid Google session. The simplest path is to bootstrap it once with the Python notebooklm CLI, then point this server at the resulting file:

pip install "notebooklm-py[browser]"
playwright install chromium
notebooklm login        # writes ~/.notebooklm/storage_state.json

Now choose one of:

Variable Use when
NOTEBOOKLM_STORAGE_PATH Local dev. Path to storage_state.json.
NOTEBOOKLM_AUTH_JSON Serverless / CI. Inline JSON contents of the same file.
NOTEBOOKLM_COOKIES + NOTEBOOKLM_CSRF_TOKEN + NOTEBOOKLM_SESSION_ID You already have tokens from another pipeline.

Cookies do expire. When they do, auth_status will return an isError: true result with reason: "auth" and a reminder to re-run the login step.

Tool catalog (51)

Group Tools
Auth / status auth_status
Notebooks notebook_list, notebook_create, notebook_rename, notebook_delete, notebook_raw
Sources source_list, source_add_url, source_add_text, source_delete, source_rename, source_refresh, source_fulltext, source_guide, source_wait
Chat chat_ask, chat_history, chat_last_conversation_id, chat_configure
Artifacts artifact_list, artifact_get, artifact_delete, artifact_rename, artifact_wait
Generation generate_audio, generate_video, generate_cinematic_video, generate_report, generate_quiz, generate_flashcards, generate_infographic, generate_slide_deck, generate_data_table, generate_mind_map, revise_slide
Downloads download_artifact (one tool, dispatches by artifact type — writes to outputPath or returns inline base64/text)
Notes note_list, note_create, note_update, note_delete
Research research_start, research_poll, research_wait, research_import_all
Sharing share_status, share_set_public, share_set_view_level, share_add_user, share_remove_user
Language language_get, language_set

Architecture

src/
├── auth.ts              # storage_state → cookies → CSRF + session-id
├── rpc/
│   ├── types.ts         # method IDs + enum codes (source of truth)
│   ├── encoder.ts       # encode_rpc_request, build_request_body
│   ├── decoder.ts       # strip_anti_xssi, parse_chunked_response, extract_rpc_result
│   └── client.ts        # RpcClient — fetch + auth refresh + chat streaming
├── api/
│   ├── _helpers.ts      # asString / getPath / sourceIdsTriple etc.
│   ├── notebooks.ts     # list/create/rename/delete/raw
│   ├── sources.ts       # add_url/add_text/list/delete/rename/wait/fulltext/guide
│   ├── chat.ts          # ask (streaming), history, configure
│   ├── artifacts.ts     # list/wait + 11 generation paths + download URL extraction
│   ├── notes.ts         # CRUD over GET_NOTES_AND_MIND_MAPS
│   ├── research.ts      # start/poll/import/wait
│   ├── sharing.ts       # public link, view level, per-user
│   ├── settings.ts      # language get/set
│   └── client.ts        # NotebookLMClient — namespaced facade
├── tools/               # MCP tool registrations (one file per domain)
├── transport/{stdio,http}.ts
├── server.ts            # createServer, registerAllTools
├── config.ts            # env-driven config (zod-validated)
├── errors.ts            # AuthError, RateLimitError, ProtocolError, …
├── logger.ts            # stderr-only structured logger
└── index.ts             # bin entry
api/mcp.ts               # Vercel function adapter

Limitations (v0.1)

  • No file uploads. Adding PDFs / audio / images via the resumable upload protocol is not implemented yet — use source_add_url (web URLs and YouTube) or source_add_text. File support tracked under _core.py's o4cbdc method.
  • Sharing payload parsing is shallow — share_status returns the raw RPC payload alongside best-effort fields. Public-link toggle and per-user invite/remove all work end-to-end.
  • Slide deck downloads require EXPORT_ARTIFACT (handled automatically by download_artifact); other artifact types extract URLs from the artifact_list response.

Why two MCPs?

notebooklm-mcp notebooklm-mcp-rpc
Python runtime needed Yes (CLI subprocess) No
Vercel-deployable Only with custom container Plain Node function
Tracks upstream protocol fixes Automatic Manual (rare; method IDs change a few times a year)
Setup steps install Python + CLI + login login once, then JS-only

This project (-rpc) is the right pick when you want an autonomous, single-runtime deploy.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选