Repository navigation
Zero Friction Onboarding
Wdelday74 edited this page Oct 18, 2026
·
1 revision
The Zero-Friction Onboarding Orchestrator (install_and_onboard.py / gemini-notebook-mcp onboard) is an autonomous 6-stage state machine designed to bootstrap the Google Notebook MCP Gateway with zero manual browser configuration, zero token copying, and zero third-party Python dependencies.
flowchart TD
S1["Stage 1: Browser Selection<br/>• OS Default Browser Scan<br/>• Crostini Garcon Guard<br/>• 6-Chromium Registry"] --> S2["Stage 2: Native Host Registration<br/>• Dual-Scope Manifests<br/>• Baked Socket Path & Caps<br/>• Launcher Generation"]
S2 --> S3["Stage 3: Broker & Browser Launch<br/>• Stale Socket & Lock Cleanup<br/>• Policy Broker Daemon<br/>• Sommelier Wayland Guards"]
S3 --> S4["Stage 4: Extension Injection<br/>• RFC 6455 WebSocket Client<br/>• CDP Extensions.loadUnpacked<br/>• Dynamic ID Re-Handshake"]
S4 --> S5["Stage 5: Login Detection<br/>• Accounts Flow Intercept<br/>• WIZ_global_data Hydration<br/>• CSRF & Account Assertion"]
S5 --> S6["Stage 6: Allowlist & Project Seed<br/>• wXbhsf Compact Discovery<br/>• Interactive Selection<br/>• .notebook_mcp.json Binding"]
-
OS Detection Mechanism:
-
Linux: Queries
xdg-settings get default-web-browserand inspects$BROWSER. -
macOS: Queries
LSHandlersregistry viadefaults read com.apple.LaunchServices/com.apple.launchservices.secure. -
Windows: Queries
HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice.
-
Linux: Queries
-
The 6-Browser Compatibility Register:
Matches the detected binary against the 6 tested Chromium browsers:
google-chrome-beta,google-chrome,chromium,brave,edge,edge-beta. -
The Crostini Garcon Guard:
On ChromeOS Linux (Crostini), the default browser handler is often
garcon-url-handler. Garcon routes URLs to the host ChromeOS browser outside the container. The host ChromeOS browser cannot reach the container's/tmp/notebooklm-mcp-broker.sockand cannot load unpacked extensions from Crostini disk paths. The orchestrator detects Garcon, issues a warning, and prompts the user to select an installed native Linux Chromium binary (defaulting to/usr/bin/google-chrome-beta).
Chrome Native Messaging requires a JSON manifest (com.mcp.gemini.broker.json) pointing to the native messaging launcher.
-
Deterministic Extension ID Computation:
Computes candidate 32-character extension IDs directly from
manifest.jsonand directory path hashing (hex lettersa-p). -
Dual-Scope Manifest Placement:
Writes the manifest to both:
-
Global Scope:
~/.config/<browser>/NativeMessagingHosts/(or OS equivalent in Registry/Application Support). -
Isolated Profile Scope:
~/.config/notebooklm-mcp-bridge/chrome-profile/NativeMessagingHosts/.
-
Global Scope:
-
Self-Contained Launcher Wrapper:
Because Chrome spawns the native host directly without terminal environment variables, the orchestrator generates a launcher script (
native_host_launcher.pyor.cmdon Windows) that explicitly bakes in:os.environ.setdefault("MCP_BROKER_SOCKET", "<resolved_socket_path>") os.environ.setdefault("NOTEBOOKLM_MCP_SOCKET", "<resolved_socket_path>") os.environ.setdefault("UV_THREADPOOL_SIZE", "3") os.environ.setdefault("OMP_NUM_THREADS", "3")
-
Stale Socket & Lock Unlinking:
- Probes the broker socket. If the socket exists but
connect()raisesConnectionRefusedError, it unlinks the stale socket file before spawning the broker. - Cleans up stale Chrome
SingletonLock,SingletonSocket, andSingletonCookiesymlinks inchrome-profileto prevent crash-recovery deadlocks.
- Probes the broker socket. If the socket exists but
-
Developer Mode Pre-Seeding:
- Pre-seeds
chrome-profile/Default/Preferenceswith{"extensions": {"ui": {"developer_mode": true}}}so Developer mode is already turned ON when the extensions management page opens.
- Pre-seeds
-
Resource Capping:
Applies
UV_THREADPOOL_SIZE=3,OMP_NUM_THREADS=3,NODE_OPTIONS="--max-old-space-size=1024 --max-semi-space-size=128", and file descriptor limit 65536. -
Crostini Sommelier Wayland Guards:
If running under ChromeOS Wayland (
/usr/bin/sommelier), passes--no-sandbox --no-zygote --disable-dev-shm-usageto prevent Wayland compositor crashes. -
Initial Launch Target:
Launches the browser directly at
chrome://extensions(rather than the login page) so the companion extension is verified before authentication occurs.
Chrome 137+ enterprise and security policies frequently ignore the --load-extension command-line flag. The orchestrator enforces an Extension-First Verification Gate:
-
Pure Standard-Library RFC 6455 WebSocket Client:
Implemented purely in
socket,struct, andhashlibwith zero third-party packages:-
Continuation Frame Reassembly: Correctly buffers fragmented payloads (
FIN == 0with opcode0x1, followed by opcode0x0continuation frames untilFIN == 1). -
Masked Pong Replies: Responds to server
Ping(0x9) frames with client-maskedPong(0x8A) frames echoing ping payloads per RFC 6455 §5.5.3.
-
Continuation Frame Reassembly: Correctly buffers fragmented payloads (
-
CDP
Extensions.loadUnpacked& 1-Click Guided Fallback: Attempts automated injection via CDP. If the browser restricts CDP extension loading, the orchestrator copies the absolute extension path to the system clipboard (wl-copy,xclip,xsel,pbcopy,clip) and prompts the user to click Load unpacked (1 click) and paste the path. -
Dynamic Extension ID Sync:
Detects
service_worker.jsregistration in/json. If Chrome assigns an extension ID different from candidate hashes, updatesallowed_originsincom.mcp.gemini.broker.jsonand immediately re-triggersExtensions.loadUnpackedsoservice_worker.jsconnects without delay.
-
Automated Navigation:
Only after Stage 4 confirms the companion extension's service worker is active, the orchestrator automatically navigates the browser tab to
https://notebook.google.com/(reloading or navigating existing pages via CDPPage.navigate, or opening/json/new). Because the extension is already running, content scripts attach immediately upon page load. -
Google Accounts Intercept:
Inspects open tabs via
http://127.0.0.1:9222/json/list. If the user is onaccounts.google.com(/signin,/ServiceLogin,/v3/signin), it pauses and alerts the user in the terminal to complete sign-in. -
In-Page Hydration Assertion:
Executes in-page
Runtime.evaluateonnotebook.google.com:Boolean(window.WIZ_global_data && window.WIZ_global_data.SNlM0e) && Boolean(window.WIZ_global_data.oM1Kwf || window.WIZ_global_data.FdrFJe)
-
Account Email Binding:
Extracts
window.WIZ_global_data.oM1Kwf(active Google email) to enforce the Pre-Flight Account Identity Guard (P-03).
-
Live Wire
wXbhsfFallback: Queries the broker IPC socket ({"action": "list_notebooks"}). If the native port is handshaking, falls back to executingwXbhsfinside the browser tab viafetch()withcredentials: "include". -
Wire Safety & Compact Extraction:
Uses Google's verified
[null, 1, null, [2]]view enum withsource-path=/andhl=en. Parseswrb.frrecords inside the browser and returns only compact[{id, title}]arrays over WebSocket, avoiding buffering multi-megabyte raw responses. -
Interactive Allowlist Configuration:
Displays a numbered table of notebooks. Allows selection:
- Specific notebooks by number (e.g.,
1,3) -
allfor all discovered notebooks - Custom UUID or notebook URL
- Specific notebooks by number (e.g.,
-
Project Working Directory Binding:
Writes
allowlist.jsonwith restricted permissions (0o600) and automatically writes or updates.notebook_mcp.jsonwith the selected project default notebook.
The orchestrator supports comprehensive automation flags:
python3 install_and_onboard.py [OPTIONS]
# or
gemini-notebook-mcp onboard [OPTIONS]| Flag | Type | Description |
|---|---|---|
--browser |
String | Force specific browser (google-chrome-beta, google-chrome, chromium, brave, edge). |
--non-interactive |
Flag | Run headlessly without terminal prompts; defaults to all notebooks and auto-selects browser. |
--skip-launch |
Flag | Register manifests and configure without launching browser or daemon. |
--port |
Integer | Remote debugging port for CDP (default: 9222). |
--socket-path |
Path | Explicit path for Policy Broker Unix domain socket. |
--verbose |
Flag | Enable debug-level diagnostic output on stderr. |
Google Notebook MCP Gateway • Zero-Credential-Export Integration for Google NotebookLM • Licensed under Apache 2.0
Version: v4.2.0-STRICT
Status: Grounded & Verified