Skip to main content
Glama
notebooklm-py-diet-mcp

notebooklm-py-diet-mcp

notebooklm-py-diet-mcp

The Context Bridge -- Connecting AI coding agents to Google NotebookLM

Connect your AI agent to Google NotebookLM. Query your notebooks, add sources, generate reports, podcasts, slide decks, and more -- directly from Cursor, Claude Code, or any MCP-compatible client.

Workflow-orientated MCP toolset for IDE level interaction with NotebookLM. Designed as a smart and lightweight MCP server to enable AI code assist-native multi-step workflows (research, generate artifacts, download and convert). Packaged as single tool calls so the agent gets more done with less messing around and without losing capability.

Built on notebooklm-py by Teng Lin.

Unofficial -- Uses undocumented Google APIs via notebooklm-py. Not affiliated with Google. APIs may change without notice.

CI Python 3.10+ Licence: MIT

Need granular control over every SDK method? See the full-fat notebooklm-py-MCP (72 individual tools exposed - designed primarily for testing).

Beyond the SDK

This server is not just a thin wrapper. It adds capabilities that the underlying API does not provide:

  • Templated slide generation -- Three bundled design templates (Corporate, Educational, Creative) in templates/slide_styles.md. Pass any template as the instructions parameter to generate_and_download and NotebookLM will follow the specified tone, colour palette, typography, and layout rules. Create your own templates using the same structure.

  • PDF / PNG round-trip editing -- pdf_to_png splits a downloaded slide deck (or any PDF) into individual page images that an LLM can review, critique, or annotate. png_to_pdf reassembles edited pages back into a single document. This enables a generate-review-refine loop that is not possible through the NotebookLM interface alone.

  • Inline persona control -- ask_question accepts optional persona and response_length parameters, configuring the chat persona in the same call rather than requiring a separate configuration step.

Related MCP server: notebooklm-mcp-server

AI Workflow Tools (14)

Tool

Description

list_notebooks_tool

List all notebooks with IDs and titles

create_notebook

Create a new notebook

list_sources

List all sources in a notebook

add_sources

Add multiple sources (URL, text, file) in a single call

ask_question

Query a notebook with optional persona, source filtering, and threading

generate_and_download

Generate and download an artifact in one step (report, audio, slide deck, quiz, infographic)

list_artifacts

List artifacts in a notebook

export_artifact

Export an artifact to a file

research_and_import

Research a topic and import results as sources automatically

get_account_info

Show the active account and available profiles

switch_account

Switch to a different Google account profile

create_profile

Create a new account profile and launch browser sign-in

pdf_to_png

Convert a PDF to individual PNG images (one per page)

png_to_pdf

Combine PNG images into a single PDF document

MCP Resources

URI

Description

notebooklm://notebooks

List all notebooks (read-only)

notebooklm://notebook/{id}

Notebook details including sources

MCP Prompts

Prompt

Description

analyze_notebook_sources

Template for analysing notebook sources by theme

research_topic_workflow

Guided research workflow using NotebookLM tools

generate_styled_slides

Generate a slide deck using a bundled design template (corporate, educational, creative)

Prerequisites

  • Python 3.10 or later

  • A Google account with access to NotebookLM

  • Cursor or another MCP-compatible client

Installation

1. Clone the repository

git clone https://github.com/earlyprototype/notebooklm-py-diet-mcp.git
cd notebooklm-py-diet-mcp

2. Create a virtual environment and install dependencies

python -m venv venv

# Windows (PowerShell)
.\venv\Scripts\Activate.ps1

# macOS / Linux
source venv/bin/activate

pip install -e ".[dev]"

Alternatively, install from requirements.txt:

pip install -r requirements.txt

3. Install Playwright (required for first-time login and auto-reauthentication)

playwright install chromium

4. Authenticate with Google NotebookLM

# Set the account profile directory
# Windows (PowerShell)
$env:NOTEBOOKLM_HOME = "$HOME\.notebooklm-work"

# macOS / Linux
export NOTEBOOKLM_HOME=~/.notebooklm-work

# Login (opens a browser window -- select your Google account)
notebooklm login

# Verify
notebooklm list

Configuration

Cursor

Add the following to your .cursor/mcp.json file:

{
  "mcpServers": {
    "notebooklm": {
      "command": "<path-to-venv>/python",
      "args": [
        "<path-to-repo>/notebooklm_mcp_server.py"
      ]
    }
  }
}

Replace the placeholder paths with your actual paths. The server manages account profiles internally -- no NOTEBOOKLM_HOME environment variable is needed. Use switch_account and get_account_info to manage profiles at runtime.

Restart Cursor after saving the configuration.

Claude Code

The repository ships a project-scoped .mcp.json, so opening this folder in Claude Code is enough -- it will prompt you to approve the notebooklm server on first launch. It defaults to the venv/ created in step 2; on Windows, or if your interpreter lives elsewhere, point NOTEBOOKLM_MCP_PYTHON at it:

# Windows (PowerShell)
$env:NOTEBOOKLM_MCP_PYTHON = "venv\Scripts\python.exe"

To register the server globally instead (available in every project), pass the absolute path to the virtual environment's interpreter -- not a bare python, which will not have the dependencies installed:

claude mcp add notebooklm -- /path/to/repo/venv/bin/python /path/to/repo/notebooklm_mcp_server.py

Verify with claude mcp list.

HTTP Transport (for MCP Inspector or remote access)

python notebooklm_mcp_server.py --http

Then connect your client to http://localhost:8000/mcp.

Multiple Google Accounts

Each Google account is stored in a separate directory. Set NOTEBOOKLM_HOME to switch between them:

# Authenticate different accounts
NOTEBOOKLM_HOME=~/.notebooklm-work notebooklm login      # Work account
NOTEBOOKLM_HOME=~/.notebooklm notebooklm login            # Personal account
NOTEBOOKLM_HOME=~/.notebooklm-design notebooklm login     # Another account

The get_account_info tool shows the currently active profile and available alternatives. Use switch_account to change at runtime without restarting.

Usage Examples

Once configured, you can interact with NotebookLM directly from your AI agent:

List notebooks:

"List my NotebookLM notebooks"

Query a knowledge base:

"Ask the Strategy notebook: what are our key objectives for 2026?"

Set a persona and ask:

"As a strategy analyst, summarise the key risks in my Research notebook"

Add multiple sources at once:

"Add these URLs to my Research notebook: https://example.com/article1, https://example.com/article2"

Generate and download content:

"Generate a podcast overview for the Project notebook and save it" "Generate a report from the Strategy notebook and download it as PDF" "Create an infographic from the Training notebook"

Research and import:

"Research 'digital fabrication trends' and import the top results into my Research notebook"

Generate a styled slide deck:

"Generate a slide deck for the Strategy notebook using the Corporate template"

Slide Template Demos

The three bundled templates produce distinctly different output from the same workflow. Each example below was generated from a subsection of an innovation literacy training programme.

Corporate

Strategy consulting style -- serif headings, blue accent, data-dense layouts with charts, tables, and evidence callouts.

Educational

Workshop and training style -- warm cream background, teal/amber accents, illustrated concepts, generous whitespace.

Creative

Pitch deck style -- dark backgrounds, lime accent, bold typography, minimal text, visually striking layouts.

See templates/slide_styles.md for the full template definitions or create your own following the same structure.

Project Structure

notebooklm-py-diet-mcp/
  notebooklm_mcp_server.py   # MCP server (14 tools, resources, prompts)
  .mcp.json                   # Project-scoped MCP registration for Claude Code
  pyproject.toml              # Python packaging and tool configuration
  requirements.txt            # Convenience dependency file
  INSTRUCTIONS.md             # Context injected into the LLM when loaded
  LICENSE                     # MIT licence
  README.md                   # This file
  tests/
    conftest.py               # Shared test fixtures and mocks
    test_helpers.py            # Unit tests for helper functions
    test_tools.py              # Mock-based tool tests
    test_lifespan.py           # Server startup scenario tests
  templates/
    slide_styles.md           # Bundled slide design templates
  docs/
    setup.md                  # Detailed setup guide
    demos/selected/           # Curated slide demo images (README gallery)
      demos/corporate/          # Full corporate template example set
      demos/educational/        # Full educational template example set
      demos/creative/           # Full creative template example set

Development

Running tests

pip install -e ".[dev]"
pytest

Linting

ruff check .
ruff format .

INSTRUCTIONS.md

The INSTRUCTIONS.md file is loaded by MCP clients alongside the server and provides the LLM with usage context -- workflow patterns, error handling guidance, and tool conventions. Place it next to notebooklm_mcp_server.py or in the MCP server metadata directory used by your client.

Acknowledgements

This project would not exist without notebooklm-py by Teng Lin and contributors. It provides the complete Python API for Google NotebookLM that this MCP server wraps.

The MCP server is built using the Model Context Protocol Python SDK by Anthropic.

Licence

MIT -- see LICENSE for details.

Disclaimer

This is an unofficial project. It is not affiliated with, endorsed by, or supported by Google. It relies on undocumented APIs that may change at any time. Use at your own risk. See the notebooklm-py security policy for credential handling guidance.

Available Tools

14 tools
add_sourcesA

Add multiple sources to a notebook in a single call.

Each source is a dictionary with a "type" and "value" field. Supported types: "url", "text", "file". Text sources also require a "title" field.

Args: notebook_id: ID of the notebook sources: JSON array of sources, e.g. [{"type": "url", "value": "https://example.com"}, {"type": "text", "value": "Content here", "title": "My Notes"}, {"type": "file", "value": "/path/to/document.pdf"}] wait: Whether to wait for processing to complete

Returns: Dictionary with results for each source

Inputs: sources (required), notebook_id (required), wait.

ask_questionA

Ask a question to a NotebookLM notebook and get an AI-generated answer.

Args: notebook_id: ID of the notebook to query question: The question to ask source_ids: Comma-separated source IDs to restrict the query (optional) conversation_id: Continue an existing conversation thread (optional) persona: Set chat persona before asking (optional). Use a descriptive role like "tutor", "analyst", "concise summariser". Cleared if empty. response_length: Set response length before asking (optional). One of: short, medium, long. Cleared if empty.

Returns: Dictionary with the answer and citation information

Inputs: question (required), notebook_id (required), persona, source_ids, +2 more.

create_notebookA

Create a new NotebookLM notebook.

Args: title: Title for the new notebook

Returns: Dictionary with notebook ID and title

Inputs: title (required).

create_profileA

Create a new NotebookLM account profile and launch the Google login.

This opens a browser window for the user to sign into their Google account. Once authentication is complete, the profile is ready to use via switch_account.

Args: profile: Name for the new profile (e.g. 'work', 'design', 'testing'). Will be stored at ~/.notebooklm-.

Returns: Dictionary with the profile status and next steps.

Inputs: profile (required).

export_artifactA

Export an artifact to a file in the requested format.

Uses the appropriate export method based on the artifact type.

Args: notebook_id: ID of the notebook artifact_id: ID of the artifact to export output_path: Path where to save the exported file export_format: Desired format (pdf, csv, json, etc.). Leave empty for default.

Returns: Dictionary with export status

Inputs: artifact_id (required), notebook_id (required), output_path (required), export_format.

generate_and_downloadA

Generate an artifact and download it in a single call.

Supports: report, audio, slide_deck, quiz, infographic.

Args: notebook_id: ID of the notebook artifact_type: One of: report, audio, slide_deck, quiz, infographic output_path: Path where to save the downloaded file. Use the correct extension: .pdf (report, slide_deck, infographic), .wav (audio), .json/.md/.html (quiz, based on quiz_output_format) instructions: Custom instructions for generation (optional). For slide decks, pass a design template here to control visual style. audio_format: Audio format: deep-dive, brief, critique, debate audio_length: Audio length: short, medium, long quiz_quantity: Quiz quantity: few, standard, more quiz_difficulty: Quiz difficulty: easy, medium, hard quiz_output_format: Quiz download format: json, markdown, html

Returns: Dictionary with generation and download status

Inputs: notebook_id (required), output_path (required), artifact_type (required), audio_format, +5 more.

get_account_infoA

Show the current NotebookLM account and available profiles.

Returns: Dictionary with current account, config path, available profiles, and instructions for switching or adding accounts.

Inputs: no named parameters.

list_artifactsA

List artifacts in a notebook, optionally filtered by type.

Args: notebook_id: ID of the notebook artifact_type: Filter by type (audio, video, report, quiz, flashcards, slide_deck, infographic, data_table, mind_map). Leave empty for all types.

Returns: Dictionary with the list of artifacts

Inputs: notebook_id (required), artifact_type.

list_notebooks_toolA

List all NotebookLM notebooks.

Returns a dictionary with notebook titles and IDs.

Inputs: no named parameters.

list_sourcesB

List all sources in a notebook.

Args: notebook_id: ID of the notebook

Returns: Dictionary with source count and source details

Inputs: notebook_id (required).

pdf_to_pngA

Convert a PDF file to individual PNG images (one per page).

Useful for making slide deck pages visible to LLMs for review or editing.

Args: pdf_path: Path to the source PDF file output_directory: Directory to write PNGs into. Defaults to a folder beside the PDF named _pages/ dpi: Render resolution (default 200 -- good balance of quality and size)

Returns: Dictionary with output directory, list of page image paths, and page count

Inputs: pdf_path (required), dpi, output_directory.

png_to_pdfA

Combine PNG images into a single PDF document.

Provide either a list of image paths or a directory containing PNGs. When using a directory, images are sorted alphabetically (the naming convention from pdf_to_png -- page_001.png, page_002.png, etc. -- preserves correct order automatically).

Args: image_paths: Comma-separated image file paths, or a JSON array of paths image_directory: Directory of PNG files to combine (alternative to image_paths) output_path: Path for the output PDF. Defaults to /combined.pdf

Returns: Dictionary with the output PDF path and page count

Inputs: image_paths, output_path, image_directory.

research_and_importB

Research a topic and import the results as notebook sources in a single call.

Starts a research task, polls until completion, and automatically imports the top results.

Args: notebook_id: ID of the notebook query: Research query source: Where to search: "web" or "drive" max_results: Maximum number of results to import

Returns: Dictionary with research results and import status

Inputs: query (required), notebook_id (required), source, max_results.

switch_accountA

Switch the active NotebookLM account to a different Google profile.

The change takes effect immediately and is persisted across server restarts. Use get_account_info to see available profiles.

Args: profile: Profile name to switch to (e.g. 'work', 'personal', 'design', or any custom name matching ~/.notebooklm-)

Returns: Dictionary confirming the switch with the new profile details.

Inputs: profile (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 14 tools

    Disambiguation4/5

    Tools generally have distinct purposes, but generate_and_download and export_artifact both deal with artifacts, and list_sources vs list_artifacts could be confused. Most tools are clearly separated.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern, but there are inconsistencies like 'list_notebooks_tool' with a '_tool' suffix, 'research_and_import' uses 'and', and 'pdf_to_png' lacks a verb. Overall patterns are mixed.

    Tool Count5/5

    14 tools is well-scoped for a NotebookLM server, covering notebook management, sources, Q&A, artifacts, accounts, and PDF utilities. No obvious bloat or deficiency.

    Completeness4/5

    Core workflows (create/list notebooks, add sources, ask questions, generate/export artifacts, account management) are covered. Minor gaps like missing delete/update operations do not significantly hinder typical use.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers