Skip to main content

FastMCP v2 server for NotebookLM automation with modern async support

Project description

๐Ÿš€ NotebookLM MCP

Professional MCP server for Google NotebookLM automation โ€ข Available on PyPI โ€ข Production Ready

PyPI Python 3.10+ FastMCP v2 UV License: MIT Tests codecov

โœจ Key Features

  • ๐Ÿ”ฅ FastMCP v2: Modern decorator-based MCP framework
  • โšก UV Python Manager: Lightning-fast dependency management
  • ๐Ÿš€ Multiple Transports: STDIO, HTTP, SSE support
  • ๐ŸŽฏ Type Safety: Full Pydantic validation
  • ๐Ÿ”’ Persistent Auth: Automatic Google session management
  • ๐Ÿ“Š Rich CLI: Beautiful terminal interface with Taskfile automation
  • ๐Ÿณ Production Ready: Docker support with monitoring

๐Ÿƒโ€โ™‚๏ธ Quick Start

๐ŸŽฏ For End Users (Recommended)

# Install UV (modern Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install NotebookLM MCP from PyPI
uv add notebooklm-mcp

# Initialize with your NotebookLM URL
uv run notebooklm-mcp init https://notebooklm.google.com/notebook/YOUR_NOTEBOOK_ID

What happens after init:

  • โœ… Creates notebooklm-config.json with your settings
  • โœ… Creates chrome_profile_notebooklm/ folder for persistent authentication
  • โœ… Opens browser for one-time Google login (if needed)
  • โœ… Saves session for future headless operation
# Start server (STDIO for MCP clients)
uv run notebooklm-mcp --config notebooklm-config.json server

# Start HTTP server for web testing
uv run notebooklm-mcp --config notebooklm-config.json server --transport http --port 8001

# Interactive chat mode
uv run notebooklm-mcp --config notebooklm-config.json chat  --message "Who are you ?"

๐Ÿ‘จโ€๐Ÿ’ป For Developers

If you're contributing to this project, check out our Taskfile for enhanced developer experience:

git clone https://github.com/khengyun/notebooklm-mcp.git
cd notebooklm-mcp

# Complete setup with development tools
task setup

# Show all available development tasks
task --list

๐Ÿ”ง Alternative Installation

If you prefer pip over UV:

# Install with pip
pip install notebooklm-mcp

# Initialize
notebooklm-mcp init https://notebooklm.google.com/notebook/YOUR_NOTEBOOK_ID

# Start server
notebooklm-mcp --config notebooklm-config.json server

๏ฟฝ Project Structure After Init

After running init, your working directory will contain:

your-project/
โ”œโ”€โ”€ notebooklm-config.json          # Configuration file
โ”œโ”€โ”€ chrome_profile_notebooklm/      # Browser profile (persistent auth)
โ”‚   โ”œโ”€โ”€ Default/                    # Chrome profile data
โ”‚   โ”œโ”€โ”€ SingletonSocket             # Session files
โ”‚   โ””โ”€โ”€ ...                         # Other Chrome data
โ””โ”€โ”€ your-other-files

Key files:

  • notebooklm-config.json: Contains notebook ID, server settings, auth configuration
  • chrome_profile_notebooklm/: Stores Google authentication session (enables headless operation)

๏ฟฝ๐Ÿ› ๏ธ Available Tools

Tool Description Parameters
healthcheck Server health status None
send_chat_message Send message to NotebookLM message: str, wait_for_response: bool
get_chat_response Get response with timeout timeout: int
chat_with_notebook Complete interaction message: str, notebook_id?: str
navigate_to_notebook Switch notebooks notebook_id: str
get_default_notebook Current notebook None
set_default_notebook Set default notebook_id: str
get_quick_response Instant response None

๐Ÿ‘จโ€๐Ÿ’ป Developer Workflow

For contributors and advanced users who want enhanced productivity, we provide a comprehensive Taskfile with 20+ automation tasks:

# ๐Ÿ“ฆ Dependency Management
task deps-add -- requests       # Add dependency
task deps-add-dev -- pytest     # Add dev dependency
task deps-remove -- requests    # Remove dependency
task deps-list                  # List dependencies
task deps-update                # Update all dependencies

# ๐Ÿงช Testing & Quality
task test                       # Run all tests
task test-quick                 # Quick validation test
task test-coverage              # Coverage analysis
task enforce-test               # MANDATORY after function changes
task lint                       # Run all linting
task format                     # Format code (Black + isort + Ruff)

# ๐Ÿ—๏ธ Build & Release
task build                      # Build package
task clean                      # Clean artifacts

# ๐Ÿš€ Server Commands
task server-stdio              # STDIO server
task server-http               # HTTP server
task server-sse                # SSE server

# Show all available tasks
task --list

๐Ÿ’ก Pro Tip: Install Task for the best developer experience: go install github.com/go-task/task/v3/cmd/task@latest

๐ŸŒ Transport Options

STDIO (Default)

task server-stdio
# For: LangGraph, CrewAI, AutoGen

HTTP

task server-http  
# Access: http://localhost:8001/mcp
# For: Web testing, REST APIs

SSE

task server-sse
# Access: http://localhost:8002/
# For: Real-time streaming

๐Ÿงช Testing & Development

HTTP Client Testing

from fastmcp import Client
from fastmcp.client.transports import StreamableHttpTransport

transport = StreamableHttpTransport(url="http://localhost:8001/mcp")
async with Client(transport) as client:
    tools = await client.list_tools()
    result = await client.call_tool("healthcheck", {})

Command Line Testing

# Test with curl
curl -X POST http://localhost:8001/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}'

๐Ÿ“Š Client Integration

LangGraph

from fastmcp import Client
from fastmcp.client.transports import StreamableHttpTransport

# HTTP transport
transport = StreamableHttpTransport(url="http://localhost:8001/mcp")
client = Client(transport)
tools = await client.list_tools()

CrewAI

from crewai_tools import BaseTool
from fastmcp import Client

class NotebookLMTool(BaseTool):
    name = "notebooklm"
    description = "Chat with NotebookLM"
    
    async def _arun(self, message: str):
        client = Client("http://localhost:8001/mcp")
        result = await client.call_tool("chat_with_notebook", {"message": message})
        return result

๐Ÿ”’ Authentication

Automatic Setup

# First time - opens browser for login
notebooklm-mcp init https://notebooklm.google.com/notebook/abc123

# Subsequent runs - uses saved session
notebooklm-mcp --config notebooklm-config.json server

Manual Setup

# Interactive browser login
notebooklm-mcp --config notebooklm-config.json server

# Check connection
notebooklm-mcp --config notebooklm-config.json test --notebook YOUR_NOTEBOOK_ID

๐Ÿณ Docker Deployment

Quick Start

docker run -e NOTEBOOKLM_NOTEBOOK_ID="YOUR_ID" notebooklm-mcp

With Compose

version: '3.8'
services:
  notebooklm-mcp:
    image: notebooklm-mcp:latest
    ports:
      - "8001:8001"
    environment:
      - NOTEBOOKLM_NOTEBOOK_ID=your-notebook-id
      - TRANSPORT=http
    volumes:
      - ./chrome_profile:/app/chrome_profile

โš™๏ธ Configuration

Config File (notebooklm-config.json)

{
  "default_notebook_id": "your-notebook-id",
  "headless": true,
  "timeout": 30,
  "auth": {
    "profile_dir": "./chrome_profile_notebooklm"
  },
  "debug": false
}

Environment Variables

export NOTEBOOKLM_NOTEBOOK_ID="your-notebook-id"
export NOTEBOOKLM_HEADLESS=true
export NOTEBOOKLM_DEBUG=false

๐Ÿš€ Performance

FastMCP v2 Benefits

  • โšก 5x faster tool registration with decorators
  • ๐Ÿ“‹ Auto-generated schemas from Python type hints
  • ๐Ÿ”’ Built-in validation with Pydantic
  • ๐Ÿงช Better testing and debugging capabilities
  • ๐Ÿ“Š Type safety throughout the stack

Benchmarks

Feature Traditional MCP FastMCP v2
Tool registration Manual schema Auto-generated
Type validation Manual Automatic
Error handling Basic Enhanced
Development speed Standard 5x faster
HTTP support Limited Full

๐Ÿ› ๏ธ Development

Setup

git clone https://github.com/khengyun/notebooklm-mcp
cd notebooklm-mcp

# With UV (recommended)
uv sync --all-groups

# Or with pip
pip install -e ".[dev]"

Testing

# Run tests with UV
uv run pytest

# With coverage
uv run pytest --cov=notebooklm_mcp

# Integration tests  
uv run pytest tests/test_integration.py

# Or use Taskfile for development
task test
task test-coverage

Code Quality

# Format code with UV
uv run black src/ tests/
uv run ruff check src/ tests/

# Type checking
uv run mypy src/

# Or use Taskfile shortcuts
task format
task lint

๐Ÿ“š Documentation

๐Ÿ”— Related Projects

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ†˜ Support


Built with โค๏ธ using FastMCP v2 - Modern MCP development made simple!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notebooklm_mcp-2.0.11.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notebooklm_mcp-2.0.11-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file notebooklm_mcp-2.0.11.tar.gz.

File metadata

  • Download URL: notebooklm_mcp-2.0.11.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for notebooklm_mcp-2.0.11.tar.gz
Algorithm Hash digest
SHA256 3aa15e68a5f5da59500257c45c5f2d7fa1e6d87a463581f7e733984153a8ac9f
MD5 b5d6be15dd52aabec429401638274ac1
BLAKE2b-256 fa3a8e2d9131a09ac6833dd5dab6ab1401596e23275a1bcf3e9f54fa17c1487d

See more details on using hashes here.

File details

Details for the file notebooklm_mcp-2.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for notebooklm_mcp-2.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 83d596538f13d136d4c7dc1d5e7b9dc473f2544a3cb61a0420ff0dd04112343f
MD5 256f15d163ef6fd232fdcf5718d12f7b
BLAKE2b-256 c7e8edeb1395aa312cc3122399695ff35a0cd51277bbde7b4974c140876525ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page