>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Python

How to Connect Claude and Cursor with Google NotebookLM Directly from the Terminal

Gemini Notebook MCP Header

The Google NotebookLM service (recently renamed to Gemini Notebook) handles massive amounts of documentation, long PDFs, and YouTube videos with ease. It generates coherent responses with citations to sources and can create fun audio podcasts with two virtual hosts.

One frustrating detail about the service is that it still lacks an official public API.

If you want to upload a batch of links to a notebook from the terminal, export generated materials, or have your AI agent in Cursor search through your personal knowledge base, you're stuck clicking through the browser. Developer jacob-bd solved this problem and released gemini-notebook-mcp-cli. It provides a command-line interface nlm and spins up a local MCP server for connecting to code editors.

What the utility can do

The repository combines two tools: a classic CLI for bash scripts and an MCP (Model Context Protocol) server.

Through a terminal command nlm, you can manage notebooks without opening a browser tab. Available operations include creating notes, uploading sources, querying the database, and exporting artifacts:

# Создаем блокнот под ресерч
nlm notebook create "Архитектура проекта"

# Добавляем ссылки и документы
nlm source add <notebook-id> --url "https://habr.com/..."

# Запускаем генерацию аудиообзора
nlm audio create <notebook-id> --confirm

# Скачиваем все созданные материалы в папку
nlm download all <notebook-id> -d ./exports

The most interesting part begins when setting up MCP. The package can automatically register itself in the configuration files of popular tools: Claude Code, Claude Desktop, Cursor, Gemini CLI, Windsurf, and Cline.

Quick setup command:

nlm setup add cursor
nlm setup add claude-code

After that, you can write in plain text in the assistant chat: "Create a notebook about distributed transactions, add this pull request there, and generate a brief summary." The assistant will call the necessary functions behind the scenes.

Hidden studio features

Beyond regular text responses, the tool unlocks access to Gemini Notebook's content generators. Through CLI and MCP, you can run:

  1. Podcast creation (in-depth discussion of a topic by two speakers).
  2. Video overview generation in various lengths and visual styles.
  3. Flashcard and learning guide assembly.
  4. Infographics and mind maps based on uploaded sources.
  5. Creating and editing presentation slides.

A nice bonus: all requests sent through the console or code editor are saved in the Google web interface history. You can start querying in the terminal and continue reading the responses in the evening from your phone via browser.

How authorization works under the hood

Since there's no official API, the project works through Google's internal endpoints. You'll need valid cookies from an authenticated session.

The project developers automated this process. You run the command:

nlm login

The utility opens a separate browser profile (Chrome, Brave, Arc, Edge, Chromium, and Firefox are supported), you log into your Google account, and the script intercepts the necessary tokens and saves them locally.

The tool supports working with multiple profiles via the --profile work or --profile personal flag. CSRF tokens are automatically refreshed when requests fail, and the cookies themselves last from two to four weeks.

An honest creation story and community support

The project author openly admits in the README that they wrote the first version without deep experience in Python, actively using AI assistance.

The code solved an immediate need but was far from ideal. The author didn't shy away from it and directly asked the community for help with refactoring and code review.

Open source worked as intended. Dozens of developers joined the project. They added connection pooling, proper error handling, WSL2 support, Google Drive synchronization, batch operations, and a security audit that prevents credentials from leaking into logs. The result is a reliable tool with nearly 6000 stars on GitHub.

Caveats

Before integrating the utility into your pipelines, keep in mind several limitations.

First, using an undocumented API carries the risk of breakage. Google can change the request format or response structure at any moment, and the scripts will stop working until a patch is released.

Second, free accounts have a limit of about 50 requests per day. If you want to run a hundred documents through a batch script at once, you'll hit that ceiling.

Third, the server exposes 43 separate MCP tools. This number of functions noticeably fills up the context window in Claude Code or Cursor. If you're not working with notebooks right now, it's better to temporarily disable the server in settings or configure selective exports of only the methods you need.

Installation

The easiest way to install the utility is through the uv package manager:

uv tool install notebooklm-mcp-cli

If you're using standard Python, pipx or regular pip will work:

pipx install notebooklm-mcp-cli

Running without permanent installation via uvx is also available:

uvx --from notebooklm-mcp-cli nlm --help

Who will find this useful

The project will appeal to those who already actively use Gemini Notebook for analyzing large volumes of text, technical documentation, or lectures, but are tired of the browser routine. The utility is great for automating material collection, creating summary export scripts, and integrating context from Google Drive directly into your working chat with an AI assistant.

Related projects