🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More β†’
Socket
Book a DemoSign in
Socket

opencode-plugin-notebooklm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-plugin-notebooklm

OpenCode plugin for NotebookLM - access Google NotebookLM from your AI coding assistant

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

OpenCode Plugin: NotebookLM

npm version License: MIT

Access Google NotebookLM from OpenCode AI coding assistant.

Features

  • 8 tools with context inference
  • Auto-auth via CDP - Chrome auto-launches when needed
  • Notebook state persistence (auto-select active notebook)
  • Multi-turn conversations
  • Create & manage notebooks
  • Add sources (URLs, text, Google Drive)
  • Query AI about your sources
  • Generate audio, reports, flashcards, infographics
  • Deep research with web search

Installation

Option 1: npm package

bun add opencode-plugin-notebooklm

Add to opencode.json:

{
  "plugins": ["opencode-plugin-notebooklm"]
}

Option 2: Local plugin

Copy to .opencode/plugins/notebooklm/:

cp -r opencode-plugin-notebooklm .opencode/plugins/notebooklm

Authentication

Plugin auto-launches Chrome when auth is needed:

  • Chrome opens with NotebookLM
  • Login to your Google account
  • Plugin extracts cookies automatically
  • Done! Chrome can be closed after login

First time setup: Just use any NotebookLM tool - Chrome will open automatically.

Manual (Fallback)

If auto-auth fails, save cookies manually:

save_auth_tokens({ cookies: "your-cookie-header-from-devtools" })

To get cookies:

  • Open https://notebooklm.google.com in Chrome
  • Open DevTools (F12) > Network tab
  • Refresh page, click any request
  • Copy the Cookie header value from Request Headers

Auth Recovery Flow

When auth expires, plugin attempts 4-layer recovery:

Auth Error β†’ Refresh CSRF β†’ Reload Disk β†’ CDP Auto-refresh β†’ Manual Auth
  • Refresh CSRF - Re-extract tokens from page
  • Reload Disk - Load cached tokens from ~/.notebooklm-mcp/auth.json
  • CDP Auto-refresh - Launch Chrome, extract fresh cookies
  • Manual Auth - Prompt for save_auth_tokens (last resort)

Tools Reference

Notebook Management (4 tools)

ToolDescription
notebook_listList all notebooks
notebook_createCreate a new notebook
notebook_getGet notebook details + AI summary
notebook_queryAsk AI about sources (multi-turn)

Source Management (1 tool)

ToolDescription
source_addAdd sources to notebook

source_add parameters:

  • urls - URL(s) separated by space/newline
  • drive_id - Google Drive document ID
  • text - Plain text content
  • title - Title (required for text)
  • notebook_id - Target notebook

Research & Studio (2 tools)

ToolDescription
research_startStart web research (fast/deep mode)
studio_createGenerate content (audio/report/flashcards/etc)

Auth (1 tool)

ToolDescription
save_auth_tokensSave cookies from browser (fallback)

Skills

Optional workflow guides available in skills/:

SkillDescription
nlm-indexIndex docs/repos to NotebookLM

Use with: skill({ name: 'nlm-index' })

Smart Features

Context Inference

Notebook ID is auto-inferred when:

  • Only one notebook exists (auto-selected)
  • A notebook was recently accessed (session state)
# No need to specify notebook_id if context is set
notebook_query({ query: "What are the main topics?" })

Adding Sources

# Add URL(s)
source_add({ urls: "https://example.com/article" })
source_add({ urls: "https://example1.com https://example2.com" })

# Add Google Drive document
source_add({ drive_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs" })

# Add text content (title required)
source_add({ text: "Some text...", title: "My Notes" })

Multi-turn Conversations

# First query
notebook_query({ query: "What is React?" })

# Follow-up (uses same conversation)
notebook_query({ query: "How about hooks?", conversation_id: "..." })

Studio Content Types

studio_create supports:

  • audio - Audio overview/deep dive
  • report - Briefing document
  • flashcards - Study flashcards
  • infographic - Visual infographic
  • slide_deck - Presentation slides
  • data_table - Structured data table

Usage Examples

Create notebook and add sources

> Create a notebook about React hooks
> Add the React docs: https://react.dev/reference/react/hooks

Query your sources

> Ask: "What are the best practices for useEffect cleanup?"

Generate content

> Generate an audio overview of my notebook
> Create flashcards for React hooks

Research

> Research "React Server Components best practices"

Development

# Install dependencies
bun install

# Build
bun run build

# Type check
bun run typecheck

# Test
bun test

Architecture

src/
β”œβ”€β”€ index.ts              # 8 tools + hooks
β”œβ”€β”€ errors.ts             # AppError with structured errors
β”œβ”€β”€ config.ts             # Configuration
β”œβ”€β”€ types.ts              # TypeScript types
β”œβ”€β”€ auth/
β”‚   β”œβ”€β”€ manager.ts        # AuthManager singleton (in-memory cache, recovery)
β”‚   β”œβ”€β”€ cdp-provider.ts   # Chrome DevTools Protocol auth (auto-launch)
β”‚   β”œβ”€β”€ cdp-resolver.ts   # Browser detection (Chrome, Edge, Brave)
β”‚   └── cdp-browsers.ts   # Browser registry per OS
β”œβ”€β”€ hooks/
β”‚   └── index.ts          # OpenCode hooks (session events)
β”œβ”€β”€ state/
β”‚   β”œβ”€β”€ session.ts        # Session state (active notebook, conversation)
β”‚   └── cache.ts          # TTL cache with auto-sweep
└── client/
    β”œβ”€β”€ index.ts          # NotebookLMClient (singleton with refresh mutex)
    β”œβ”€β”€ transport.ts      # RPC transport with 4-layer recovery
    β”œβ”€β”€ codec.ts          # Request/response encoding
    β”œβ”€β”€ encoding.ts       # Data encoding utilities
    β”œβ”€β”€ recovery.ts       # Error recovery strategies
    β”œβ”€β”€ conversations.ts  # Conversation persistence
    └── services/
        β”œβ”€β”€ notebook.ts   # Notebook CRUD operations
        β”œβ”€β”€ source.ts     # Source management
        β”œβ”€β”€ query.ts      # AI query operations
        β”œβ”€β”€ research.ts   # Web research
        └── studio.ts     # Content generation

Key Design Patterns

  • Singleton client with refresh mutex (prevents auth stampede)
  • 4-layer auth recovery: CSRF refresh β†’ disk reload β†’ CDP auto-launch β†’ manual
  • Bun native APIs: Bun.spawn, Bun.sleep for performance
  • Service layer per domain (notebook, source, query, research, studio)
  • Transport layer with retry/backoff and auth refresh
  • State management: Session (in-memory) + Cache (TTL-based)
  • Proactive auth: Token expiry check before requests

Requirements

  • Bun 1.0+
  • Google Chrome (for CDP auto-auth)
  • macOS / Linux / Windows

License

MIT

Credits

Based on notebooklm-mcp by jacob-bd.

Keywords

opencode

FAQs

Package last updated on 23 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts