Skip to main content
Glama
knowingdoing

notebooklm-codex

by knowingdoing
README.md
# NotebookLM for Codex

Use Google NotebookLM from Codex through a local MCP connector.

This repo wraps the unofficial `notebooklm-py` command-line tool as an MCP server, so Codex can list notebooks, switch notebooks, inspect sources, ask questions, and add sources without relying on ad hoc shell commands.

## What This Enables

- List your NotebookLM notebooks from Codex
- Switch the active NotebookLM notebook
- Check NotebookLM authentication
- List notebook sources and generated artifacts
- Ask a notebook questions
- Add URLs, YouTube links, PDFs, docs, and other files as sources
- Trigger audio overview generation
- Install a Codex skill that teaches Codex when and how to use NotebookLM

## Use Cases

- Ask Codex to query a research notebook before answering a strategy question
- Build a project research notebook from URLs, PDFs, or YouTube videos
- Turn a NotebookLM notebook into an audio overview
- Inspect whether shared notebooks are accessible
- Use NotebookLM as a second brain for business, research, content, or sales strategy
- Give Codex repeatable access to NotebookLM without pasting Google cookies into prompts

## Architecture

```text
Codex
  -> MCP stdio connector
  -> local Python server in this repo
  -> notebooklm-py CLI
  -> Google NotebookLM
```

Your Google credentials stay on your Mac in the `notebooklm-py` local auth profile. The MCP server calls the local CLI; it does not store Google cookies or tokens in this repo.

## Requirements

- macOS or Linux
- Python 3.10+
- Codex with custom MCP server support
- A Google account with NotebookLM access
- `notebooklm-py` installed and authenticated locally

## Step 1: Install And Authenticate NotebookLM CLI

Install `notebooklm-py` in a virtual environment:

```bash
python3 -m venv ~/.notebooklm-venv
source ~/.notebooklm-venv/bin/activate
pip install "notebooklm-py[browser]"
playwright install chromium
mkdir -p ~/bin
ln -sf ~/.notebooklm-venv/bin/notebooklm ~/bin/notebooklm
export PATH="$HOME/bin:$PATH"
notebooklm --help
```

Authenticate:

```bash
notebooklm login
notebooklm auth check
notebooklm list
```

If `notebooklm login` does not work in your terminal environment, use the browser-auth flow documented in the bundled Codex skill reference:

```text
codex-skill/notebooklm/references/notebooklm-cli-and-mcp.md
```

## Step 2: Install This MCP Connector

Clone this repo:

```bash
git clone https://github.com/knowingdoing/notebooklm-codex.git
cd notebooklm-codex
```

Create the connector environment:

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

Smoke test:

```bash
NOTEBOOKLM_BIN="$(command -v notebooklm)" \
  .venv/bin/python -c "from notebooklm_mcp.server import run_cli; print(run_cli('auth', 'check'))"
```

You should see `Authentication is valid.`

## Step 3: Add The MCP Server To Codex

Open your Codex config:

```bash
open ~/.codex/config.toml
```

Add this block, replacing `/absolute/path/to/notebooklm-codex` with the actual cloned repo path:

```toml
[mcp_servers.notebooklm]
command = "/absolute/path/to/notebooklm-codex/.venv/bin/python"
args = ["/absolute/path/to/notebooklm-codex/notebooklm_mcp/server.py"]
startup_timeout_sec = 30

[mcp_servers.notebooklm.env]
NOTEBOOKLM_BIN = "/Users/YOUR_USER/bin/notebooklm"
```

Restart Codex after editing the config.

## Step 4: Test In Codex

In a new Codex thread, ask:

```text
Use $notebooklm to list my NotebookLM notebooks.
```

Or:

```text
List my NotebookLM notebooks and open the one called Client Retention.
```

## Available MCP Tools

| Tool | Purpose |
|---|---|
| `notebooklm_auth_check` | Check local NotebookLM authentication |
| `notebooklm_list` | List notebooks |
| `notebooklm_status` | Show the active notebook |
| `notebooklm_use` | Set the active notebook |
| `notebooklm_source_list` | List sources in the active notebook |
| `notebooklm_source_add` | Add a URL, YouTube URL, or local file source |
| `notebooklm_ask` | Ask the active notebook a question |
| `notebooklm_artifact_list` | List generated artifacts |
| `notebooklm_generate_audio` | Generate an audio overview |

## Example Prompts

```text
Use $notebooklm to list my notebooks.
```

```text
Use $notebooklm to open my Client Retention notebook and list its sources.
```

```text
Use $notebooklm to ask my Eric Siu Single Brain notebook: what are the major themes?
```

```text
Use $notebooklm to create a NotebookLM notebook for this research and add these URLs as sources.
```

```text
Use $notebooklm to generate an audio overview from the active notebook.
```

## Optional: Install The Codex Skill

This repo includes a Codex skill at:

```text
codex-skill/notebooklm
```

Install it into your Codex skills folder:

```bash
cp -R codex-skill/notebooklm ~/.codex/skills/notebooklm
```

Restart Codex after installing the skill.

The skill helps Codex recognize NotebookLM-related requests and choose the right workflow.

## Notes And Limits

- This uses the unofficial `notebooklm-py` package.
- Google can change NotebookLM behavior without notice.
- Generation actions can take minutes and may hit Google rate limits.
- This connector runs locally. Your Mac must be online and authenticated.
- Do not commit Google cookies, browser profiles, or local auth files.

## Security

Credentials are handled by `notebooklm-py` on your machine. This repo does not require storing NotebookLM cookies, Google tokens, or account credentials in source control.

For shared machines, review your local NotebookLM auth profile before exposing the connector to other tools.