NotebookLM MCP Server
The `notebooklm-mcp-server` package, currently at version 3.0.7, provides a robust Node.js-based server that enables AI agents to interact directly with Google's NotebookLM. Built with TypeScript and leveraging the Model Context Protocol (MCP), this server allows AI agents to securely read, search, and manage NotebookLM notebooks as if they were local files. This direct integration is designed to provide grounded context to AI models, significantly reducing hallucinations. It supports both global installation via npm and zero-configuration execution via npx, making it highly accessible for integration into various AI-augmented workflows. The project maintains an active release cadence, featuring an auto-update mechanism that ensures the server always runs the latest version with critical fixes and enhancements upon startup. Its core differentiation lies in offering a dedicated, protocol-driven solution for real-time context retrieval directly from NotebookLM for AI applications.
Common errors
-
Error: Auth: Session expired or invalid. Please re-authenticate.
cause The cached Google authentication token has become invalid, often due to inactivity or a change in account security.fixRun `npx notebooklm-mcp-server auth` and follow the browser prompts to log in to your Google account again. -
Error [ERR_REQUIRE_ESM]: require() of ES module .../notebooklm-mcp-server/dist/cli.js from ... not supported.
cause Attempting to use CommonJS `require()` syntax to load a module that is explicitly an ES Module.fixEnsure your project uses ES Modules (add `"type": "module"` to `package.json`) or use dynamic `import()` for ESM-only dependencies. The primary intended usage is via `npx`, which handles module resolution.
Warnings
- gotcha The server includes an auto-update feature. Upon startup, it checks for new versions and installs them automatically. A manual restart is required to apply the updates and ensure you're running the latest version.
- gotcha Authentication sessions with Google NotebookLM can expire. If your AI agent encounters authentication errors, it's typically due to an expired session.
- breaking The package requires Node.js version 18.0.0 or higher. Running it on older Node.js versions will result in execution errors.
Install
-
npm install notebooklm-mcp-server -
yarn add notebooklm-mcp-server -
pnpm add notebooklm-mcp-server
Imports
- createServer
const { createServer } = require('notebooklm-mcp-server');import { createServer } from 'notebooklm-mcp-server'; - MCPConfig
import { MCPConfig } from 'notebooklm-mcp-server';import type { MCPConfig } from 'notebooklm-mcp-server'; - CLI usage
node node_modules/notebooklm-mcp-server/dist/cli.js <command>
npx notebooklm-mcp-server <command>
Quickstart
import { Console } from 'console';
import { exec } from 'child_process';
const logger = new Console({ stdout: process.stdout, stderr: process.stderr });
async function setupAndStartServer() {
logger.log('1. Authenticating with Google NotebookLM...');
// This command will open a browser for Google login.
// It's a one-time setup to establish a persistent session.
// User needs to manually close the browser after successful login.
const authProcess = exec('npx notebooklm-mcp-server auth');
authProcess.stdout?.on('data', (data) => logger.log(`Auth Output: ${data}`));
authProcess.stderr?.on('data', (data) => logger.error(`Auth Error: ${data}`));
await new Promise(resolve => {
authProcess.on('exit', (code) => {
if (code === 0) {
logger.log('Authentication command finished. Please ensure you logged in via the browser and closed it.');
resolve(null); // Resolve to proceed even if auth browser is still open momentarily
} else {
logger.error(`Authentication failed with code ${code}. Please try again.`);
process.exit(1);
}
});
});
logger.log('\n2. Starting the NotebookLM MCP Server...');
// This command starts the server process.
// It will run until manually stopped (e.g., Ctrl+C in terminal where it's running).
const serverProcess = exec('npx notebooklm-mcp-server start');
serverProcess.stdout?.on('data', (data) => logger.log(`Server Output: ${data}`));
serverProcess.stderr?.on('data', (data) => logger.error(`Server Error: ${data}`));
logger.log('Server started in background. Check terminal output for status.');
logger.log('To stop the server, you would typically kill the process running `npx notebooklm-mcp-server start`.');
logger.log('Or if running in foreground in a dedicated terminal, press Ctrl+C.');
}
setupAndStartServer().catch(console.error);