As a “Vibe Coder,” your strength lies in using natural language to orchestrate complex systems. But what happens when your project documentation, trading strategies, or research notes are scattered across dozens of PDFs and notebooks?
By connecting NotebookLM to Antigravity using the Model Context Protocol (MCP), you give your AI agent a “library card” to your personal knowledge base. Whether you are refining KOSPI trading algorithms or building a music analyzer, this integration is a game-changer.
Phase 1: Preparation & Environment Setup
Before we touch any code, let’s create a clean workspace.
- Create a Workspace Folder: Open your File Explorer and create a folder at
C:\mcp\notebooklm. This keeps your scripts organized. - Open the Command Prompt (CMD): * Press the
Windows Key, type “cmd”.- Right-click “Command Prompt” and select “Run as Administrator”.
- Install the MCP Server: Type the following command and hit Enter:
pip install notebooklm-mcp-server- Authenticate your Google Account: Run this command to link your NotebookLM data:
notebooklm-mcp-auth- A browser window will pop up. Sign in with your Google account and grant the necessary permissions.
💡 Stuch during Phase 1 or 2? If you encounter any unexpected errors or have questions while setting up your environment, feel free to ask me (Gemini) for help! I can troubleshoot your specific terminal output in real-time.
Phase 2: Creating the run_mcp.py Wrapper
Antigravity expects clean JSON-RPC data. However, the default NotebookLM server often sends “ASCII art” banners that cause connection errors. We will use a wrapper script to filter these out.
Save the following code as run_mcp.py inside your C:\mcp\notebooklm folder.
import sys
import subprocess
import io
# 1. Define a filter to ensure clean communication with Antigravity
class AntigravityFilter:
def __init__(self, original_stream):
self.original_stream = original_stream
self.encoding = getattr(original_stream, 'encoding', 'utf-8')
def write(self, data):
# Filter out decorative ASCII characters that break Antigravity's parser
if any(char in data for char in ['╭', '│', '╰', '─', '┐', '└', '┘']):
return len(data)
# Suppress standard server start-up messages
if "FastMCP server" in data:
return len(data)
return self.original_stream.write(data)
def flush(self):
if hasattr(self.original_stream, 'flush'):
self.original_stream.flush()
def __getattr__(self, name):
return getattr(self.original_stream, name)
# 2. Patch stdout BEFORE the server starts
sys.stdout = AntigravityFilter(sys.stdout)
# 3. Launch the actual NotebookLM MCP Server
try:
from notebooklm_mcp.server import main
if __name__ == "__main__":
sys.exit(main())
except ImportError:
print("Error: notebooklm-mcp-server not found. Please run 'pip install notebooklm-mcp-server'.")Phase 3: Configuring Antigravity
- Open Antigravity.
- Click the three dots (…) or Settings icon in the Agent panel.
- Navigate to MCP Servers -> Manage MCP Servers.
- Add the following snippet into your
mcp_config.jsonfile:
{
"mcpServers": {
"notebooklm": {
"command": "python",
"args": [
"-u",
"C:\\mcp\\notebooklm\\run_mcp.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}🛠️ Troubleshooting & Tips
| Issue | Solution |
| “Invalid trailing data” error | This means the ASCII filter in run_mcp.py missed a character. Ensure you are running the script with the -u flag as shown in the JSON config. |
| “Command ‘python’ not found” | Your Python is not in the System PATH. Replace "python" in the config with the full path (e.g., "C:\\Python310\\python.exe"). |
| Authentication Expired | Simply run notebooklm-mcp-auth again in your terminal to refresh the token. |
🌟 Use Cases for Vibe Coders
Once connected (type @mcp:notebooklm: to see the tools), try these prompts:
- For Algorithmic Trading: > “Check my current Python script against the ‘Volume Spread Analysis’ notes in my NotebookLM. Does my logic follow Neeraj Joshi’s principles?”
- For Development Rules: > “Review this frontend component. Does it align with the
Frontend_Rules.mdstored in my Development notebook?” - For Creative Projects:“I’ve uploaded several sheet music PDFs to NotebookLM. Summarize the recurring musical themes across these hymns.”