Skip to main content
Glama
NotebookLM MCP
by cosrv
README.md
# notebooklm-mcp

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![MCP](https://img.shields.io/badge/MCP-stdio-green.svg)](https://modelcontextprotocol.io)

> Model Context Protocol (MCP) server that exposes [Google NotebookLM](https://notebooklm.google.com) inside Claude Desktop via the unofficial [`notebooklm-py`](https://github.com/teng-lin/notebooklm-py) library.

Create notebooks, add sources, chat with your research, and generate audio/video/quiz/report artifacts — all from a Claude Desktop conversation.

## ⚠️ Important

This project relies on **undocumented Google RPC APIs** via `notebooklm-py`. It is intended for **personal, private use only**:

- Not production-ready
- Not affiliated with or endorsed by Google
- APIs may break without notice
- Use a dedicated Google account
- Rate limits apply to heavy operations (audio, video, quiz, etc.)

## Features

- **10 MCP tools** wrapping the full NotebookLM workflow
- **Fire-and-poll pattern** for long-running artifact generation (audio/video take 10-45 min)
- **German tool output** (Claude-friendly Hinweise & Fehlermeldungen)
- **Graceful auth handling** with clear re-login instructions
- **Single-file server** — no package, no build system, just `python server.py`
- **stdio transport** — designed for local Claude Desktop

## Available Tools

| Tool | Type | Description |
|------|------|-------------|
| `nlm_list_notebooks` | read | List all notebooks with ID, title, source count |
| `nlm_create_notebook` | write | Create a new notebook |
| `nlm_add_url` | write | Add a web or YouTube URL as a source |
| `nlm_add_file` | write | Upload a local file (PDF/TXT/MD/DOCX) as a source |
| `nlm_list_sources` | read | List sources of a notebook with status |
| `nlm_ask` | read | Ask a RAG question (returns answer + citations) |
| `nlm_generate` | write | Start artifact generation (fire) → returns task_id |
| `nlm_get_status` | read | Poll generation status |
| `nlm_download` | write | Download a finished artifact |
| `nlm_research` | write | Start a web research session (fast/deep) |

## Supported Artifact Types

| Type | Default | Format Overrides |
|------|---------|------------------|
| `audio` | MP3 | — |
| `video` | MP4 | — |
| `quiz` | JSON | `markdown`, `html` |
| `flashcards` | JSON | `markdown`, `html` |
| `slide-deck` | PDF | `pptx` |
| `infographic` | PNG | — |
| `mind-map` | JSON | — (synchronous) |
| `data-table` | CSV | — |
| `report` | Markdown | — |

## Quick Start

### Prerequisites

- Python ≥ 3.10 (3.13 recommended)
- [Claude Desktop](https://claude.ai/download)
- Google account with NotebookLM access

### 1. Clone

```bash
git clone https://github.com/cosrv/notebooklm-mcp.git
cd notebooklm-mcp
```

### 2. Install dependencies

```bash
pip install "mcp[cli]>=1.0.0" "notebooklm-py>=0.3.0" "pydantic>=2.0.0" "httpx>=0.25.0"
```

### 3. Authenticate with NotebookLM (one time)

`notebooklm-py` ships with a CLI that handles Google login via Playwright:

```bash
playwright install chromium
notebooklm login
```

A browser opens. Sign in with your Google account, close the browser — done. Cookies are stored in `~/.notebooklm/storage_state.json`.

Verify:
```bash
notebooklm list
```

### 4. Configure Claude Desktop

Open `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows) and add:

```json
{
  "mcpServers": {
    "notebooklm": {
      "command": "python3",
      "args": ["/ABSOLUTE/PATH/TO/notebooklm-mcp/server.py"]
    }
  }
}
```

Replace the absolute path with your clone location. See [`claude_desktop_config.example.json`](claude_desktop_config.example.json) for a full example.

> **Important:** `python3` must be the same interpreter you installed `notebooklm-py` into. If you have multiple Python versions, use the absolute interpreter path, e.g. `/Library/Frameworks/Python.framework/Versions/3.13/bin/python3` on macOS.

### 5. Restart Claude Desktop

**Quit Claude Desktop completely** (Cmd+Q on macOS) and reopen it. The `nlm_*` tools will appear.

### 6. Try it

Ask Claude:

> *"List my NotebookLM notebooks."*
>
> *"Create a notebook called 'Research' and add https://example.com as a source."*
>
> *"Generate an audio overview of the notebook and download it when ready."*

## Fire-and-Poll Pattern

Artifact generation runs asynchronously on Google's infrastructure (audio: 10-20 min, video: 15-45 min). The server uses a **fire-and-poll** pattern so Claude doesn't block:

1. `nlm_generate` → returns a `task_id` immediately
2. `nlm_get_status` → poll every 30-60 seconds
3. Once `status: completed` → `nlm_download`

**Exception:** `mind-map` is synchronous — call `nlm_download` directly after `nlm_generate`.

## Downloads

All downloads land in `~/notebooklm-downloads/`. The folder is created automatically on first launch.

## Authentication Lifecycle

NotebookLM cookies expire every few weeks. When they do, every tool returns a clear message:

```
❌ NotebookLM-Authentifizierung abgelaufen oder nicht vorhanden.

So behebst du das:
1. Terminal öffnen
2. `notebooklm login` ausführen (öffnet Browser)
3. Mit deinem Google-Account anmelden
4. Browser schließen — fertig.

Danach Claude Desktop neu starten.
```

Re-run `notebooklm login` and restart Claude Desktop.

## File Structure

```
notebooklm-mcp/
├── server.py              # FastMCP lifespan + 10 tools + entry point
├── models.py              # Pydantic input models + enums
├── helpers.py              # Constants, auth helpers, download mapping
├── pyproject.toml          # Dependencies (no build system)
├── claude_desktop_config.example.json
├── README.md
├── CONTRIBUTING.md
├── SECURITY.md
├── CHANGELOG.md
└── LICENSE                 # Apache 2.0
```

Design principle: **every file stays under 600 lines**. The server is intentionally a single-file module with two small helpers, no package indirection.

## Troubleshooting

### Tools don't show up in Claude Desktop

- Verify JSON config is valid: `python3 -c "import json; json.load(open('<path>'))"`
- Check Claude Desktop logs: `~/Library/Logs/Claude/mcp*.log`
- Ensure the absolute path to `server.py` is correct
- **Fully quit and restart** Claude Desktop — not just close the window

### `ModuleNotFoundError: notebooklm`

The Python interpreter Claude Desktop uses doesn't have `notebooklm-py` installed. Use an absolute path in `command` pointing to the interpreter that has the packages.

### `AuthError` or `storage_state.json not found`

Run `notebooklm login` in the same Python environment you're using for the server.

### Rate limits

Audio, video, quiz, flashcards, slide-deck, and infographic generation can fail under Google's rate limits. This is an API limitation, not a bug. Wait 5-10 minutes and retry, or fall back to the NotebookLM web UI.

**Reliable operations:** notebooks, sources, chat, mind-map, report, data-table.

## Design Decisions

See [`CHANGELOG.md`](CHANGELOG.md) for the full list. Highlights:

- **Fire-and-poll** over blocking waits (generation can take 45 min)
- **Separate `add_url` / `add_file` tools** — no heuristic dispatch
- **Single-file server** — no package, no build system
- **Module split at 600 LOC** — server.py, models.py, helpers.py
- **Specific exception handling** — `AuthError`, `FileNotFoundError`, `ValueError` — no keyword matching

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). PRs welcome, but note this is a hobby project — response times may vary.

## Security

See [SECURITY.md](SECURITY.md). Do **not** open public issues for security concerns.

## License

[Apache 2.0](LICENSE) © 2026 cosrv and contributors

## Acknowledgements

- [`notebooklm-py`](https://github.com/teng-lin/notebooklm-py) by [@teng-lin](https://github.com/teng-lin) — the actual RPC client
- [`mcp`](https://github.com/modelcontextprotocol/python-sdk) — the Python MCP SDK and FastMCP framework
- [Anthropic](https://www.anthropic.com) — for Claude Desktop and the Model Context Protocol