A Python client, Typer CLI, MCP Server, and Gemini Extension for interacting with the NotebookLM Enterprise API via Google Cloud Discovery Engine REST endpoints.
This SDK doubles as a native Gemini CLI extension. The extension will automatically configure the required environment variables.
-
Install the Extension via Git:
gemini extension install https://github.com/dandye/notebooklm_sdk.git
-
Configuration Prompts: During the installation, the Gemini CLI wizard will automatically prompt you to fill in the following configuration variables required by the extension:
NOTEBOOKLM_PROJECT_NUMBER: Your Google Cloud Project Number where NotebookLM is hosted.NOTEBOOKLM_LOCATION: The target region (defaults toglobal).
Once installed, you can use commands natively via the CLI using slash shortcuts (e.g., /notebooklm:create "My Notebook").
You can install this SDK manually or via pip:
pip install -e .This SDK relies on Google Cloud Application Default Credentials. Before running, ensure your credentials and projects are set up:
gcloud auth application-default login
gcloud config set project [YOUR_PROJECT_ID]from notebooklm_sdk import NotebookLMClient
PROJECT_NUMBER = "1234567890" # Replace with your GCP project number
LOCATION = "global"
client = NotebookLMClient(project_number=PROJECT_NUMBER, location=LOCATION)
# 1. Create a Notebook
notebook = client.create_notebook(title="My Research SDK Notebook")
notebook_id = notebook.get("notebookId")
print(f"Created notebook with ID: {notebook_id}")
# 2. Upload a File
source = client.upload_document(
notebook_id=notebook_id,
file_path="research_paper.pdf",
display_name="math_research_v1.pdf"
)
source_id = source["sourceId"]["id"]
print(f"Uploaded document with Source ID: {source_id}")
# 3. Check Status
status = client.get_document_status(notebook_id=notebook_id, source_id=source_id)
print(f"Document parsing status: {status['settings']['status']}")There is also a standard Typer CLI command for human operation. To use it, simply run:
notebooklm --helpYou can pass authentication details via a .env file containing:
NOTEBOOKLM_PROJECT_NUMBER=your_project_number
NOTEBOOKLM_LOCATION=your_location
This SDK also includes an integrated Model Context Protocol (MCP) server, which allows AI agents and clients (like Claude Desktop) to natively call NotebookLM methods as tools.
Once the package is installed, you can start the MCP server via stdio:
notebooklm-mcpAdd the following to your claude_desktop_config.json:
{
"mcpServers": {
"notebooklm": {
"command": "notebooklm-mcp",
"env": {
"NOTEBOOKLM_PROJECT_NUMBER": "YOUR_PROJECT_NUMBER",
"NOTEBOOKLM_LOCATION": "global"
}
}
}
}Ensure that the notebooklm-mcp executable is available in your PATH, or provide the absolute path to your virtual environment's binary (e.g., /path/to/.venv/bin/notebooklm-mcp). You will also need active application default credentials.