Skip to main content
Glama
Notebook Assistant

Notebook Assistant

by joutvhu
README.md
# Notebook Assistant

**Notebook Assistant** lets you use **Google Gemini Notebook (NotebookLM)** directly from your terminal or inside your favorite AI assistant (via MCP), without needing to keep a browser window open.

Organize notebooks, upload documents and links, ask citation-backed questions grounded in your sources, run Fast or Deep Research, and generate or download Studio outputs such as Audio Overviews, Videos, Slide Decks, Reports, Quizzes, Flashcards, Infographics, Data Tables, and Mind Maps.

## Highlights

- **No Browser Needed Day-to-Day**: Sign in once with Chrome or Edge (or import existing cookies) and run commands directly from the terminal.
- **Works in Terminal & AI Apps**: Use the `notebook-assistant` CLI yourself, or connect the built-in MCP server (`notebook-assistant mcp`) to Kiro, Claude Desktop, Cursor, or VS Code.
- **Short Notebook Aliases**: Assign memorable names like `arch` or `notes` to your notebooks instead of typing long notebook IDs.
- **Multi-Format Sources**: Add web pages, YouTube videos, pasted text, Google Drive files, PDFs, Office documents, images, audio, video, Markdown, and text/code files.
- **Multiple Google Accounts**: Easily switch between Google accounts using `--account` or `NOTEBOOK_ACCOUNT_INDEX`.

## What You Can Do

| Feature Area | Capabilities |
|---|---|
| **Notebooks** | List, search, create, duplicate, rename, inspect, delete, generate AI summaries, and get suggested prompts or report ideas. |
| **Sources** | Add web URLs, YouTube links, plain text/Markdown, Google Drive files (`doc`, `slides`, `sheets`, `pdf`), and local files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.epub`, `.rtf`, `.odt`, `.csv`, images, audio, video, `.md`, `.txt`, and code files). View AI source guides, read extracted text, and sync Drive sources. |
| **Grounded Q&A & Chat** | Ask questions grounded in your notebook sources with citations, target specific sources or notes, continue conversations, customize chat persona and answer length, view/clear history, and save answers as notes. |
| **Research** | Run Web or Google Drive research in `fast` or `deep` mode and import discovered sources (plus Deep Research summaries) into your notebook. |
| **Studio & Downloads** | Create `audio`, `video`, `report`, `flashcards`, `quiz`, `infographic`, `slide_deck`, `data_table`, and `mind_map` artifacts; customize formats; export to Google Docs/Sheets; or download files to your computer. |
| **Notes & Sharing** | Create, view, edit, and delete notes or mind maps; check sharing settings; enable/disable public link access; and invite or remove collaborators. |

---

## Requirements & Installation

### Requirements

- **Node.js 22 or newer**
- **Google Chrome** or **Microsoft Edge** (only needed for interactive `auth login`; optional if you import cookies manually)

### Install

```bash
npm install -g notebook-assistant
```

To update or uninstall later:

```bash
npm install -g notebook-assistant@latest
npm uninstall -g notebook-assistant
```

> **Windows tip:** If an IDE or AI client is currently running `notebook-assistant mcp`, close it before updating with `npm install -g notebook-assistant`.

---

## Quick Start

```bash
# 1. Sign in once using Chrome or Edge
notebook-assistant auth login

# 2. Verify your connection and account quota
notebook-assistant status --rotate --quota

# 3. Create a notebook with an alias, add a file, and ask a question
notebook-assistant notebooks create "Architecture Notes" --alias arch
notebook-assistant sources add-file arch ./spec.pdf
notebook-assistant ask arch "Summarize the key constraints and risks."
```

---

## Signing In & Managing Accounts

### 1. Browser Sign-In (Recommended)

Opens Chrome or Edge so you can sign in to Google NotebookLM, then saves your session encrypted on your machine:

```bash
notebook-assistant auth login
notebook-assistant auth login --browser edge
notebook-assistant auth login --browser chrome --timeout 300000
```

### 2. Import Existing Cookies

If you prefer not to open a browser login window, you can import exported cookies from a JSON file, Netscape `cookies.txt`, or a `Cookie` header string:

```bash
notebook-assistant auth import --file cookies.json
notebook-assistant auth import --file cookies.txt
notebook-assistant auth import --cookie "SID=...; __Secure-1PSID=...; SAPISID=..."
```

Or pipe from standard input:

```bash
cat cookies.txt | notebook-assistant auth import
```

### 3. Check Status, Refresh Session & Sign Out

```bash
# Check sign-in status and account quota
notebook-assistant status --rotate --quota

# Manually refresh session cookies
notebook-assistant auth rotate

# Sign out (removes saved cookies and login browser profile)
notebook-assistant auth logout
notebook-assistant auth logout --keep-profile
notebook-assistant auth logout --all   # also clears saved notebook aliases
```

### 4. Using Multiple Google Accounts

Use `-a, --account <index>` on any command (default is `0`) to manage multiple Google accounts:

```bash
notebook-assistant -a 1 auth login
notebook-assistant -a 1 notebooks list
```

---

## CLI Usage Guide

> Tip: Add `--json` to any command if you want machine-readable JSON output.

### Notebooks

```bash
# List all notebooks (shows aliases and source counts)
notebook-assistant notebooks list

# Search notebooks by title, alias, or content
notebook-assistant notebooks search "kubernetes"

# Create or copy a notebook with a local alias
notebook-assistant notebooks create "Project Research" --alias proj
notebook-assistant notebooks copy proj "Project Research v2" --alias proj-v2

# View notebook details and sources
notebook-assistant notebooks get proj

# Rename a notebook
notebook-assistant notebooks rename proj "Project Research (Final)"

# Get an AI summary, suggested questions, or tailored report ideas
notebook-assistant notebooks summarize proj
notebook-assistant notebooks prompts proj --surface chat --query "security"
notebook-assistant notebooks report-suggestions proj

# Permanently delete a notebook (--confirm is required)
notebook-assistant notebooks delete proj-v2 --confirm
```

### Sources

```bash
# Add one or more web pages or YouTube links
notebook-assistant sources add-url proj "https://modelcontextprotocol.io/docs"
notebook-assistant sources add-url proj "https://youtu.be/..." "https://example.com/spec"

# Add pasted text or Markdown as a source
notebook-assistant sources add-text proj "Meeting Notes" "Key decisions from Friday sync..."

# Upload local files (PDF, Office docs, images, audio, video, Markdown, text, code)
notebook-assistant sources add-file proj ./architecture.pdf
notebook-assistant sources add-file proj ./notes.md ./diagram.png ./recording.mp3

# Add a Google Drive file (doc | slides | sheets | pdf)
notebook-assistant sources add-drive proj <documentId> --title "Design Doc" --type doc

# View an AI summary guide or read the text of a source
notebook-assistant sources guide <sourceId>
notebook-assistant sources read <sourceId> --notebook proj

# Rename a source, check for updates, or sync a Google Drive source
notebook-assistant sources rename <sourceId> "Updated Spec"
notebook-assistant sources freshness <sourceId>
notebook-assistant sources sync <sourceId>

# Permanently delete a source
notebook-assistant sources delete <sourceId> --confirm
```

### Grounded Q&A & Chat

```bash
# Ask a question grounded in all sources of a notebook (`query` also works)
notebook-assistant ask proj "What are the main integration bottlenecks?"

# Limit the answer to specific sources or include specific notes
notebook-assistant ask proj "Compare these two specs" -s <sourceId1> <sourceId2>
notebook-assistant ask proj "Summarize alongside my notes" -n <noteId1>

# Continue your latest conversation or resume a specific conversation
notebook-assistant ask proj "Elaborate on the second point" --continue
notebook-assistant ask proj "Give concrete examples" -c <conversationId>

# Include reasoning trace (when available) or save the answer directly as a note
notebook-assistant ask proj "List migration risks" --thinking --save-note "Migration Risks"

# Customize chat style (default | learning_guide | custom) and answer length (default | longer | shorter)
notebook-assistant chat configure proj --goal learning_guide --length longer
notebook-assistant chat configure proj --goal custom --prompt "Answer concisely with bullet points."

# View or clear chat history, or cancel an active response
notebook-assistant chat history proj --limit 20
notebook-assistant chat cancel <generationId> --notebook proj
notebook-assistant chat clear proj --confirm
```

### Web & Drive Research

```bash
# Run Fast Research, wait for completion, and import discovered sources automatically
notebook-assistant research start proj "OpenTelemetry Node.js best practices" \
  --source web --mode fast --wait --auto-import

# Run Deep Research, check progress, and import results (including the summary)
notebook-assistant research start proj "Enterprise MCP security patterns" --mode deep --json
notebook-assistant research poll proj --json > research-result.json
notebook-assistant research import proj <taskId> --file research-result.json --include-summary

# Cancel an active research task
notebook-assistant research cancel proj
```

### Studio Outputs & Downloads

Available Studio types: `audio`, `video`, `report`, `flashcards`, `quiz`, `infographic`, `slide_deck`, `data_table`, `mind_map`.

```bash
# See available customization options for a Studio type
notebook-assistant studio choices audio
notebook-assistant studio choices slide_deck

# Generate an Audio Overview, wait for it to finish, and save it to your Downloads folder
notebook-assistant studio create proj audio \
  --audio-format deep_dive \
  --audio-length default \
  --lang en \
  --focus "Focus on security trade-offs" \
  --wait --save

# Generate a Slide Deck and save all slide images to a folder
notebook-assistant studio create proj slide_deck \
  --orientation landscape \
  --dir ./exports \
  --all-images

# Generate a Report, Quiz, or Mind Map
notebook-assistant studio create proj report \
  --report-type "Briefing Doc" \
  --report-description "Executive summary with action items" \
  --wait --save -o ./briefing.md

notebook-assistant studio create proj quiz --quantity standard --difficulty medium --wait
notebook-assistant studio create proj mind_map --title "System Map" --save

# Check progress, inspect content, download an existing output, rename, or export to Docs/Sheets
notebook-assistant studio status proj
notebook-assistant studio get proj <artifactId>
notebook-assistant studio download proj <artifactId> --dir ./downloads
notebook-assistant studio rename proj <artifactId> "Final Audio Briefing"
notebook-assistant studio export proj <artifactId> --format docs --title "Architecture Report"
notebook-assistant studio delete proj <artifactId> --confirm
```

By default, downloaded files are saved under `~/Downloads/notebook-assistant` unless you pass `-o, --output`, `--dir`, or set `NOTEBOOK_DOWNLOADS_DIR`.

### Notes, Mind Maps & Sharing

```bash
# List saved notes or mind maps
notebook-assistant notes list proj
notebook-assistant notes list proj --mind-maps

# Create, update, or delete a note
notebook-assistant notes create proj "Review Notes" "Key takeaways..."
notebook-assistant notes update proj <noteId> "Updated takeaways..." --title "Review Notes v2"
notebook-assistant notes delete proj <noteId> --confirm

# Check sharing settings, toggle public link access, or manage collaborators
notebook-assistant share status proj
notebook-assistant share public proj public
notebook-assistant share public proj private
notebook-assistant share user proj teammate@example.com editor --message "Added you to the research notebook"
notebook-assistant share user proj teammate@example.com remove
```

---

## Using with AI Assistants (MCP Server)

You can connect Notebook Assistant to any MCP-compatible AI client (such as Kiro, Claude Desktop, Cursor, or VS Code) so your AI assistant can search, read, query, and generate content from your notebooks.

### MCP Configuration

Add this entry to your client's MCP settings file:

```json
{
  "mcpServers": {
    "notebook-assistant": {
      "command": "notebook-assistant",
      "args": ["mcp"]
    }
  }
}
```

To use a secondary Google account in MCP mode, pass `["mcp", "-a", "1"]` in `args` or set `NOTEBOOK_ACCOUNT_INDEX` in `env`.

### Available MCP Tools

| Tool | Purpose |
|---|---|
| `notebook_status` | Check sign-in status, session health, and account quota. |
| `notebook_list` | List or search notebooks, inspect notebook details/notes/mind maps/studio/history/sharing, or read source guides and contents. |
| `notebook_manage` | Create, rename, or copy notebooks; set aliases; configure chat style; manage notes; and update sharing settings. |
| `notebook_sources` | Add web URLs, YouTube links, text, local files, or Google Drive docs; rename or sync sources. |
| `notebook_query` | Ask citation-backed questions grounded in notebook sources, with follow-up conversation support. |
| `notebook_research` | Start, monitor, cancel, or import Web and Google Drive research tasks. |
| `notebook_studio` | Generate, monitor, inspect, download, rename, or export Studio outputs (Audio, Video, Slides, Reports, Mind Maps, etc.). |
| `notebook_delete` | Permanently delete a notebook, source, note, mind map, Studio artifact, or chat history (requires confirmation). |

---

## Environment Variables

| Variable | Default | Description |
|---|---|---|
| `NOTEBOOK_ASSISTANT_HOME` | `%LOCALAPPDATA%\notebook-assistant` (Windows) / `~/.local/share/notebook-assistant` (macOS/Linux) | Folder where encrypted session cookies and local notebook aliases are stored. |
| `NOTEBOOK_ACCOUNT_INDEX` | `0` | Default Google account index (`-a, --account` overrides this). |
| `NOTEBOOK_DOWNLOADS_DIR` | `~/Downloads/notebook-assistant` | Default folder for downloaded Studio outputs. |
| `NOTEBOOK_NO_BROWSER_REFRESH` | unset | Set to `1` to disable automatic background browser cookie refresh when a session expires. |

---

## Troubleshooting

- **Session expired or authentication errors**: Run `notebook-assistant status --rotate`. If that does not restore access, sign in again with `notebook-assistant auth login` (or `auth import`).
- **Commands stop working after a NotebookLM web update**: Run `notebook-assistant sync-schema` once to refresh settings from `notebook.google.com`.
- **Update fails on Windows with a file-lock error**: Close any IDE or AI app using `notebook-assistant mcp`, then re-run `npm install -g notebook-assistant`.