Spaces:
Sleeping
Sleeping
File size: 10,307 Bytes
0292484 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | # CLI Guide
Complete command reference for the `nlm` command-line interface.
## Installation
```bash
# Using uv (recommended)
uv tool install notebooklm-mcp-cli
# Using pip
pip install notebooklm-mcp-cli
```
## Authentication
```bash
nlm login # Opens Chrome, extracts cookies automatically
nlm login --profile work # Named profile for multiple accounts
nlm login --check # Check if authenticated
nlm login switch <profile> # Switch default profile
nlm login profile list # List all profiles with email addresses
nlm login profile delete <name> # Delete a profile
nlm login profile rename <old> <new> # Rename a profile
# External CDP provider (e.g., OpenClaw-managed browser)
nlm login --provider openclaw --cdp-url http://127.0.0.1:18800
```
Each profile gets its own isolated Chrome session, so you can stay logged into multiple Google accounts simultaneously.
## Command Structure
The CLI supports **two styles** - use whichever feels natural:
```bash
# Noun-first (resource-oriented)
nlm notebook create "Title"
nlm source add <notebook> --url <url>
# Verb-first (action-oriented)
nlm create notebook "Title"
nlm add url <notebook> <url>
```
---
## Command Reference
### Notebooks
```bash
nlm notebook list # List all notebooks
nlm notebook list --json # JSON output
nlm notebook create "Title" # Create notebook
nlm notebook get <id> # Get details
nlm notebook describe <id> # AI summary
nlm notebook rename <id> "New Title" # Rename
nlm notebook delete <id> --confirm # Delete (IRREVERSIBLE)
nlm notebook query <id> "question" # Chat with sources
```
### Sources
```bash
nlm source list <notebook> # List sources
nlm source add <notebook> --url "https://..." # Add URL
nlm source add <notebook> --url "https://..." --wait # Add and wait until ready
nlm source add <notebook> --text "content" --title "Notes" # Add text
nlm source add <notebook> --file document.pdf --wait # Upload file
nlm source add <notebook> --youtube "https://..." # Add YouTube
nlm source add <notebook> --drive <doc-id> # Add Drive doc
nlm source get <source-id> # Get content
nlm source describe <source-id> # AI summary
nlm source stale <notebook> # Check stale Drive sources
nlm source sync <notebook> --confirm # Sync stale sources
nlm source delete <source-id> --confirm # Delete (IRREVERSIBLE)
```
### Studio Content Creation
```bash
# Audio (podcasts)
nlm audio create <notebook> --confirm
nlm audio create <notebook> --format deep_dive --length long --confirm
# Formats: deep_dive, brief, critique, debate
# Lengths: short, default, long
# Video
nlm video create <notebook> --confirm
nlm video create <notebook> --format explainer --style classic --confirm
# Formats: explainer, brief
# Styles: auto_select, classic, whiteboard, kawaii, anime, watercolor, retro_print, heritage, paper_craft
# Reports
nlm report create <notebook> --format "Briefing Doc" --confirm
# Formats: "Briefing Doc", "Study Guide", "Blog Post", "Create Your Own"
# Quiz & Flashcards
nlm quiz create <notebook> --count 10 --difficulty medium --focus "Focus on key concepts" --confirm
nlm flashcards create <notebook> --difficulty hard --focus "Focus on definitions" --confirm
# Other
nlm mindmap create <notebook> --confirm
nlm slides create <notebook> --confirm
nlm infographic create <notebook> --orientation landscape --confirm
nlm data-table create <notebook> --description "Sales by region" --confirm
```
### Downloads
```bash
nlm download audio <notebook> <artifact-id> --output podcast.mp3
nlm download video <notebook> <artifact-id> --output video.mp4
nlm download report <notebook> <artifact-id> --output report.md
nlm download mind-map <notebook> <artifact-id> --output mindmap.json
nlm download slide-deck <notebook> <artifact-id> --output slides.pdf
nlm download infographic <notebook> <artifact-id> --output infographic.png
nlm download data-table <notebook> <artifact-id> --output data.csv
# Interactive formats (quiz/flashcards)
nlm download quiz <notebook> <artifact-id> --format html --output quiz.html
nlm download flashcards <notebook> <artifact-id> --format markdown --output cards.md
```
### Research
```bash
nlm research start "query" --notebook-id <id> --mode fast # Quick search
nlm research start "query" --notebook-id <id> --mode deep # Extended research
nlm research start "query" --notebook-id <id> --source drive # Search Drive
nlm research status <notebook> --max-wait 300 # Poll until done
nlm research import <notebook> <task-id> # Import sources
```
### Studio Status
```bash
nlm studio status <notebook> # Check artifact generation status
nlm studio delete <notebook> <artifact-id> --confirm # Delete artifact
```
### Sharing
```bash
nlm share status <notebook> # View sharing settings
nlm share public <notebook> # Enable public link
nlm share private <notebook> # Disable public link
nlm share invite <notebook> email@example.com # Invite viewer
nlm share invite <notebook> email --role editor # Invite editor
```
### Chat Configuration
```bash
nlm chat configure <notebook> --goal default --length default
nlm chat configure <notebook> --goal learning_guide --length longer
nlm chat configure <notebook> --goal custom --prompt "You are an expert..."
```
### Configuration
```bash
nlm config show # Show all settings
nlm config get auth.default_profile # Get a specific value
nlm config set auth.default_profile work # Set default profile
nlm config set output.format json # Change default output format
```
**Available Settings:**
| Key | Default | Description |
|-----|---------|-------------|
| `output.format` | `table` | Default output format (table, json) |
| `output.color` | `true` | Enable colored output |
| `output.short_ids` | `true` | Show shortened IDs |
| `auth.browser` | `auto` | Browser for login (auto, chrome, chromium) |
| `auth.default_profile` | `default` | Profile to use when `--profile` not specified |
### Aliases (Shortcuts)
```bash
nlm alias set myproject <notebook-id> # Create alias
nlm alias list # List all aliases
nlm alias get myproject # Resolve to UUID
nlm alias delete myproject # Remove alias
# Use aliases anywhere
nlm notebook get myproject
nlm source list myproject
```
### Skills (AI Assistant Integration)
```bash
nlm skill list # Show installation status
nlm skill install claude-code # Install for Claude Code
nlm skill install cursor # Install for Cursor AI
nlm skill install gemini-cli # Install for Gemini CLI
nlm skill install <tool> --level project # Install at project level
nlm skill uninstall <tool> # Remove skill
nlm skill show # View skill content
# Verb-first alternatives
nlm install skill claude-code
nlm list skills
```
**Supported Tools:** `claude-code`, `cursor`, `codex`, `opencode`, `gemini-cli`, `antigravity`, `other`
### Setup (MCP Server Configuration)
Configure the NotebookLM MCP server for AI tools in one command:
```bash
nlm setup add claude-code # Configure via `claude mcp add`
nlm setup add claude-desktop # Write claude_desktop_config.json
nlm setup add gemini # Write ~/.gemini/settings.json
nlm setup add cursor # Write ~/.cursor/mcp.json
nlm setup add windsurf # Write mcp_config.json
nlm setup remove claude-desktop # Remove MCP configuration
nlm setup remove gemini # Remove from Gemini CLI
nlm setup list # Show all clients and config status
```
**Supported Clients:** `claude-code`, `claude-desktop`, `gemini`, `cursor`, `windsurf`
> **Note:** `nlm setup` configures the MCP server transport. Use `nlm skill install` to install skill/reference docs for AI tools that don't use MCP.
### Doctor (Diagnostics)
Run diagnostics to troubleshoot installation, authentication, and configuration issues:
```bash
nlm doctor # Run all checks
nlm doctor --verbose # Include additional details (Python version, paths, etc.)
```
**Checks performed:**
| Category | What it checks |
|----------|---------------|
| Installation | Package version, `nlm` and `notebooklm-mcp` binary paths |
| Authentication | Profile status, cookies present, CSRF token, account email |
| Chrome | Browser installed, saved Chrome profiles for headless auth |
| AI Tools | MCP configuration status for each supported client |
Each issue includes a suggested fix (e.g., "Run `nlm login` to authenticate").
---
## Output Formats
| Flag | Description |
|------|-------------|
| (none) | Rich table format |
| `--json` | JSON output |
| `--quiet` | IDs only |
| `--title` | "ID: Title" format |
| `--full` | All columns |
---
## Complete Workflow Example
```bash
# 1. Authenticate and configure
nlm login
nlm setup add claude-code # One-time MCP setup
# 2. Create notebook and set alias
nlm notebook create "AI Research"
nlm alias set ai <notebook-id>
# 3. Add sources (with --wait to ensure ready)
nlm source add ai --url "https://example.com/article" --wait
nlm source add ai --file research.pdf --wait
# 4. Generate podcast
nlm audio create ai --format deep_dive --confirm
# 5. Wait for generation
nlm studio status ai
# 6. Download when ready
nlm download audio ai <artifact-id> --output podcast.mp3
```
---
## Tips
- Session lasts ~20 minutes; run `nlm login` if operations fail
- Use `--confirm` for all create/delete commands in scripts
- Use `--wait` when adding sources to ensure they're ready before querying
- Use aliases for frequently-used notebooks
- Audio/video takes 1-5 minutes; poll with `nlm studio status`
- Use `nlm login switch <name>` to change the default profile
- Run `nlm login profile list` to see all profiles with their associated email addresses
- Run `nlm doctor` to diagnose installation, auth, or config issues
- Use `nlm setup add <client>` to quickly configure MCP for your AI tool |