@pan-sec/notebooklm-mcp 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +289 -0
  3. package/SECURITY.md +539 -0
  4. package/dist/auth/auth-manager.d.ts +137 -0
  5. package/dist/auth/auth-manager.d.ts.map +1 -0
  6. package/dist/auth/auth-manager.js +984 -0
  7. package/dist/auth/auth-manager.js.map +1 -0
  8. package/dist/auth/mcp-auth.d.ts +102 -0
  9. package/dist/auth/mcp-auth.d.ts.map +1 -0
  10. package/dist/auth/mcp-auth.js +286 -0
  11. package/dist/auth/mcp-auth.js.map +1 -0
  12. package/dist/config.d.ts +89 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +216 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/errors.d.ts +26 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +41 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/index.d.ts +32 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +371 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/library/notebook-library.d.ts +70 -0
  25. package/dist/library/notebook-library.d.ts.map +1 -0
  26. package/dist/library/notebook-library.js +279 -0
  27. package/dist/library/notebook-library.js.map +1 -0
  28. package/dist/library/types.d.ts +67 -0
  29. package/dist/library/types.d.ts.map +1 -0
  30. package/dist/library/types.js +8 -0
  31. package/dist/library/types.js.map +1 -0
  32. package/dist/resources/resource-handlers.d.ts +22 -0
  33. package/dist/resources/resource-handlers.d.ts.map +1 -0
  34. package/dist/resources/resource-handlers.js +216 -0
  35. package/dist/resources/resource-handlers.js.map +1 -0
  36. package/dist/session/browser-session.d.ts +108 -0
  37. package/dist/session/browser-session.d.ts.map +1 -0
  38. package/dist/session/browser-session.js +621 -0
  39. package/dist/session/browser-session.js.map +1 -0
  40. package/dist/session/session-manager.d.ts +77 -0
  41. package/dist/session/session-manager.d.ts.map +1 -0
  42. package/dist/session/session-manager.js +314 -0
  43. package/dist/session/session-manager.js.map +1 -0
  44. package/dist/session/session-timeout.d.ts +122 -0
  45. package/dist/session/session-timeout.d.ts.map +1 -0
  46. package/dist/session/session-timeout.js +281 -0
  47. package/dist/session/session-timeout.js.map +1 -0
  48. package/dist/session/shared-context-manager.d.ts +107 -0
  49. package/dist/session/shared-context-manager.d.ts.map +1 -0
  50. package/dist/session/shared-context-manager.js +447 -0
  51. package/dist/session/shared-context-manager.js.map +1 -0
  52. package/dist/tools/definitions/ask-question.d.ts +8 -0
  53. package/dist/tools/definitions/ask-question.d.ts.map +1 -0
  54. package/dist/tools/definitions/ask-question.js +211 -0
  55. package/dist/tools/definitions/ask-question.js.map +1 -0
  56. package/dist/tools/definitions/notebook-management.d.ts +3 -0
  57. package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
  58. package/dist/tools/definitions/notebook-management.js +243 -0
  59. package/dist/tools/definitions/notebook-management.js.map +1 -0
  60. package/dist/tools/definitions/session-management.d.ts +3 -0
  61. package/dist/tools/definitions/session-management.d.ts.map +1 -0
  62. package/dist/tools/definitions/session-management.js +41 -0
  63. package/dist/tools/definitions/session-management.js.map +1 -0
  64. package/dist/tools/definitions/system.d.ts +3 -0
  65. package/dist/tools/definitions/system.d.ts.map +1 -0
  66. package/dist/tools/definitions/system.js +143 -0
  67. package/dist/tools/definitions/system.js.map +1 -0
  68. package/dist/tools/definitions.d.ts +12 -0
  69. package/dist/tools/definitions.d.ts.map +1 -0
  70. package/dist/tools/definitions.js +26 -0
  71. package/dist/tools/definitions.js.map +1 -0
  72. package/dist/tools/handlers.d.ts +213 -0
  73. package/dist/tools/handlers.d.ts.map +1 -0
  74. package/dist/tools/handlers.js +813 -0
  75. package/dist/tools/handlers.js.map +1 -0
  76. package/dist/tools/index.d.ts +8 -0
  77. package/dist/tools/index.d.ts.map +1 -0
  78. package/dist/tools/index.js +8 -0
  79. package/dist/tools/index.js.map +1 -0
  80. package/dist/types.d.ts +82 -0
  81. package/dist/types.d.ts.map +1 -0
  82. package/dist/types.js +5 -0
  83. package/dist/types.js.map +1 -0
  84. package/dist/utils/audit-logger.d.ts +140 -0
  85. package/dist/utils/audit-logger.d.ts.map +1 -0
  86. package/dist/utils/audit-logger.js +361 -0
  87. package/dist/utils/audit-logger.js.map +1 -0
  88. package/dist/utils/cert-pinning.d.ts +97 -0
  89. package/dist/utils/cert-pinning.d.ts.map +1 -0
  90. package/dist/utils/cert-pinning.js +328 -0
  91. package/dist/utils/cert-pinning.js.map +1 -0
  92. package/dist/utils/cleanup-manager.d.ts +133 -0
  93. package/dist/utils/cleanup-manager.d.ts.map +1 -0
  94. package/dist/utils/cleanup-manager.js +673 -0
  95. package/dist/utils/cleanup-manager.js.map +1 -0
  96. package/dist/utils/cli-handler.d.ts +16 -0
  97. package/dist/utils/cli-handler.d.ts.map +1 -0
  98. package/dist/utils/cli-handler.js +102 -0
  99. package/dist/utils/cli-handler.js.map +1 -0
  100. package/dist/utils/crypto.d.ts +175 -0
  101. package/dist/utils/crypto.d.ts.map +1 -0
  102. package/dist/utils/crypto.js +612 -0
  103. package/dist/utils/crypto.js.map +1 -0
  104. package/dist/utils/logger.d.ts +61 -0
  105. package/dist/utils/logger.d.ts.map +1 -0
  106. package/dist/utils/logger.js +92 -0
  107. package/dist/utils/logger.js.map +1 -0
  108. package/dist/utils/page-utils.d.ts +54 -0
  109. package/dist/utils/page-utils.d.ts.map +1 -0
  110. package/dist/utils/page-utils.js +405 -0
  111. package/dist/utils/page-utils.js.map +1 -0
  112. package/dist/utils/response-validator.d.ts +98 -0
  113. package/dist/utils/response-validator.d.ts.map +1 -0
  114. package/dist/utils/response-validator.js +352 -0
  115. package/dist/utils/response-validator.js.map +1 -0
  116. package/dist/utils/secrets-scanner.d.ts +126 -0
  117. package/dist/utils/secrets-scanner.d.ts.map +1 -0
  118. package/dist/utils/secrets-scanner.js +443 -0
  119. package/dist/utils/secrets-scanner.js.map +1 -0
  120. package/dist/utils/secure-memory.d.ts +130 -0
  121. package/dist/utils/secure-memory.d.ts.map +1 -0
  122. package/dist/utils/secure-memory.js +279 -0
  123. package/dist/utils/secure-memory.js.map +1 -0
  124. package/dist/utils/security.d.ts +83 -0
  125. package/dist/utils/security.d.ts.map +1 -0
  126. package/dist/utils/security.js +272 -0
  127. package/dist/utils/security.js.map +1 -0
  128. package/dist/utils/settings-manager.d.ts +37 -0
  129. package/dist/utils/settings-manager.d.ts.map +1 -0
  130. package/dist/utils/settings-manager.js +125 -0
  131. package/dist/utils/settings-manager.js.map +1 -0
  132. package/dist/utils/stealth-utils.d.ts +135 -0
  133. package/dist/utils/stealth-utils.d.ts.map +1 -0
  134. package/dist/utils/stealth-utils.js +398 -0
  135. package/dist/utils/stealth-utils.js.map +1 -0
  136. package/dist/utils/tool-validation.d.ts +93 -0
  137. package/dist/utils/tool-validation.d.ts.map +1 -0
  138. package/dist/utils/tool-validation.js +277 -0
  139. package/dist/utils/tool-validation.js.map +1 -0
  140. package/docs/SECURITY_IMPLEMENTATION_PLAN.md +437 -0
  141. package/docs/configuration.md +94 -0
  142. package/docs/tools.md +34 -0
  143. package/docs/troubleshooting.md +59 -0
  144. package/docs/usage-guide.md +245 -0
  145. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Please Prompto!
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,289 @@
1
+ <div align="center">
2
+
3
+ # NotebookLM MCP Server (Security Hardened)
4
+
5
+ **Zero-hallucination answers from NotebookLM — now with enterprise-grade security**
6
+
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/)
8
+ [![MCP](https://img.shields.io/badge/MCP-2025-green.svg)](https://modelcontextprotocol.io/)
9
+ [![Security](https://img.shields.io/badge/Security-14%20Layers-red.svg)](./SECURITY.md)
10
+ [![Post-Quantum](https://img.shields.io/badge/Encryption-Post--Quantum-purple.svg)](./SECURITY.md#post-quantum-encryption)
11
+ [![Tests](https://img.shields.io/badge/Tests-111%20Passing-brightgreen.svg)](./tests/)
12
+
13
+ [Security Features](#security-features) • [Installation](#installation) • [Quick Start](#quick-start) • [Why This Fork?](#why-this-fork) • [Documentation](./SECURITY.md)
14
+
15
+ </div>
16
+
17
+ > 🔒 **Security-hardened fork** of [PleasePrompto/notebooklm-mcp](https://github.com/PleasePrompto/notebooklm-mcp)
18
+ > Maintained by [Pantheon Security](https://pantheonsecurity.io)
19
+
20
+ ---
21
+
22
+ ## Why This Fork?
23
+
24
+ The original NotebookLM MCP is excellent for productivity — but MCP servers handle sensitive data:
25
+ - **Browser sessions** with Google authentication
26
+ - **Cookies and tokens** stored on disk
27
+ - **Query history** that may contain proprietary information
28
+
29
+ This fork adds **14 security hardening layers** to protect that data.
30
+
31
+ ---
32
+
33
+ ## Security Features
34
+
35
+ | Layer | Feature | Protection |
36
+ |-------|---------|------------|
37
+ | 🔐 | **Post-Quantum Encryption** | ML-KEM-768 + ChaCha20-Poly1305 hybrid |
38
+ | 🔍 | **Secrets Scanning** | Detects 30+ credential patterns (AWS, GitHub, Slack...) |
39
+ | 📌 | **Certificate Pinning** | Blocks MITM attacks on Google connections |
40
+ | 🧹 | **Memory Scrubbing** | Zeros sensitive data after use |
41
+ | 📝 | **Audit Logging** | Tamper-evident logs with hash chains |
42
+ | ⏱️ | **Session Timeout** | 8h hard limit + 30m inactivity auto-logout |
43
+ | 🎫 | **MCP Authentication** | Token-based auth with brute-force lockout |
44
+ | 🛡️ | **Response Validation** | Detects prompt injection attempts |
45
+ | ✅ | **Input Validation** | URL whitelisting, sanitization |
46
+ | 🚦 | **Rate Limiting** | Per-session request throttling |
47
+ | 🙈 | **Log Sanitization** | Credentials masked in all output |
48
+ | 🐍 | **MEDUSA Integration** | Automated security scanning |
49
+
50
+ ### Post-Quantum Ready
51
+
52
+ Traditional encryption (RSA, ECDH) will be broken by quantum computers. This fork uses **hybrid encryption**:
53
+
54
+ ```
55
+ ML-KEM-768 (Kyber) + ChaCha20-Poly1305
56
+ ```
57
+
58
+ - **ML-KEM-768**: NIST-standardized post-quantum key encapsulation
59
+ - **ChaCha20-Poly1305**: Modern stream cipher (immune to timing attacks)
60
+
61
+ Even if one algorithm is broken, the other remains secure.
62
+
63
+ ---
64
+
65
+ ## Installation
66
+
67
+ ### Claude Code
68
+ ```bash
69
+ claude mcp add notebooklm npx notebooklm-mcp-secure@latest
70
+ ```
71
+
72
+ ### With Authentication (Recommended)
73
+ ```bash
74
+ claude mcp add notebooklm \
75
+ --env NLMCP_AUTH_ENABLED=true \
76
+ --env NLMCP_AUTH_TOKEN=$(openssl rand -base64 32) \
77
+ npx notebooklm-mcp-secure@latest
78
+ ```
79
+
80
+ ### Codex
81
+ ```bash
82
+ codex mcp add notebooklm -- npx notebooklm-mcp-secure@latest
83
+ ```
84
+
85
+ <details>
86
+ <summary>Cursor</summary>
87
+
88
+ Add to `~/.cursor/mcp.json`:
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "notebooklm": {
93
+ "command": "npx",
94
+ "args": ["-y", "notebooklm-mcp-secure@latest"],
95
+ "env": {
96
+ "NLMCP_AUTH_ENABLED": "true",
97
+ "NLMCP_AUTH_TOKEN": "your-secure-token"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+ </details>
104
+
105
+ <details>
106
+ <summary>Other MCP Clients</summary>
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "notebooklm": {
112
+ "command": "npx",
113
+ "args": ["notebooklm-mcp-secure@latest"],
114
+ "env": {
115
+ "NLMCP_AUTH_ENABLED": "true",
116
+ "NLMCP_AUTH_TOKEN": "your-secure-token"
117
+ }
118
+ }
119
+ }
120
+ }
121
+ ```
122
+ </details>
123
+
124
+ ---
125
+
126
+ ## Quick Start
127
+
128
+ ### 1. Install (see above)
129
+
130
+ ### 2. Authenticate
131
+ ```
132
+ "Log me in to NotebookLM"
133
+ ```
134
+ *Chrome opens → sign in with Google*
135
+
136
+ ### 3. Add your notebook
137
+ Go to [notebooklm.google.com](https://notebooklm.google.com) → Create notebook → Upload docs → Share link
138
+
139
+ ### 4. Use it
140
+ ```
141
+ "Research [topic] using this NotebookLM: [link]"
142
+ ```
143
+
144
+ ---
145
+
146
+ ## What Gets Protected
147
+
148
+ | Data | Protection |
149
+ |------|------------|
150
+ | Browser cookies | Post-quantum encrypted at rest |
151
+ | Session tokens | Auto-expire + memory scrubbing |
152
+ | Query history | Audit logged with tamper detection |
153
+ | Google connection | Certificate pinned (MITM blocked) |
154
+ | Log output | Credentials auto-redacted |
155
+ | API responses | Scanned for leaked secrets |
156
+
157
+ ---
158
+
159
+ ## Configuration
160
+
161
+ All security features are **enabled by default**. Override via environment variables:
162
+
163
+ ```bash
164
+ # Authentication
165
+ NLMCP_AUTH_ENABLED=true
166
+ NLMCP_AUTH_TOKEN=your-secret-token
167
+
168
+ # Encryption
169
+ NLMCP_USE_POST_QUANTUM=true
170
+ NLMCP_ENCRYPTION_KEY=base64-32-bytes # Optional custom key
171
+
172
+ # Session Limits
173
+ NLMCP_SESSION_MAX_LIFETIME=28800 # 8 hours
174
+ NLMCP_SESSION_INACTIVITY=1800 # 30 minutes
175
+
176
+ # Secrets Scanning
177
+ NLMCP_SECRETS_SCANNING=true
178
+ NLMCP_SECRETS_BLOCK=false # Block on detection
179
+ NLMCP_SECRETS_REDACT=true # Auto-redact
180
+
181
+ # Certificate Pinning
182
+ NLMCP_CERT_PINNING=true
183
+
184
+ # Audit Logging
185
+ NLMCP_AUDIT_ENABLED=true
186
+ ```
187
+
188
+ See [SECURITY.md](./SECURITY.md) for complete configuration reference.
189
+
190
+ ---
191
+
192
+ ## Security Scanning
193
+
194
+ Run MEDUSA security scanner:
195
+
196
+ ```bash
197
+ npm run security-scan
198
+ ```
199
+
200
+ Or integrate in CI/CD:
201
+
202
+ ```yaml
203
+ - name: Security Scan
204
+ run: npx notebooklm-mcp-secure && npm run security-scan
205
+ ```
206
+
207
+ ---
208
+
209
+ ## How It Works
210
+
211
+ ```
212
+ ┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
213
+ │ Claude/ │────▶│ MCP Server │────▶│ NotebookLM │
214
+ │ Codex │ │ (This Fork) │ │ (Google) │
215
+ └─────────────┘ └──────────────────┘ └─────────────┘
216
+
217
+ ┌──────┴──────┐
218
+ │ 14 Security │
219
+ │ Layers │
220
+ └─────────────┘
221
+ • PQ Encryption
222
+ • Secrets Scan
223
+ • Cert Pinning
224
+ • Memory Wipe
225
+ • Audit Logs
226
+ • Rate Limits
227
+ • ...
228
+ ```
229
+
230
+ Your agent asks questions → Security layers protect the pipeline → NotebookLM answers from your docs.
231
+
232
+ ---
233
+
234
+ ## Original Features (Preserved)
235
+
236
+ All original functionality from [PleasePrompto/notebooklm-mcp](https://github.com/PleasePrompto/notebooklm-mcp):
237
+
238
+ - **Zero hallucinations** — NotebookLM only answers from your uploaded docs
239
+ - **Autonomous research** — Claude asks follow-up questions automatically
240
+ - **Smart library** — Save notebooks with tags, auto-select by context
241
+ - **Cross-tool sharing** — Works with Claude Code, Codex, Cursor, etc.
242
+ - **Tool profiles** — Minimal, standard, or full tool sets
243
+
244
+ ---
245
+
246
+ ## Comparison
247
+
248
+ | Feature | Original | This Fork |
249
+ |---------|----------|-----------|
250
+ | Zero-hallucination Q&A | ✅ | ✅ |
251
+ | Library management | ✅ | ✅ |
252
+ | Multi-client support | ✅ | ✅ |
253
+ | **Post-quantum encryption** | ❌ | ✅ |
254
+ | **Secrets scanning** | ❌ | ✅ |
255
+ | **Certificate pinning** | ❌ | ✅ |
256
+ | **Memory scrubbing** | ❌ | ✅ |
257
+ | **Audit logging** | ❌ | ✅ |
258
+ | **MCP authentication** | ❌ | ✅ |
259
+ | **Prompt injection detection** | ❌ | ✅ |
260
+
261
+ ---
262
+
263
+ ## Reporting Vulnerabilities
264
+
265
+ Found a security issue? **Do not open a public GitHub issue.**
266
+
267
+ Email: support@pantheonsecurity.io
268
+
269
+ ---
270
+
271
+ ## Credits
272
+
273
+ - **Original MCP Server**: [Gérôme Dexheimer](https://github.com/PleasePrompto) — [notebooklm-mcp](https://github.com/PleasePrompto/notebooklm-mcp)
274
+ - **Security Hardening**: [Pantheon Security](https://pantheonsecurity.io)
275
+ - **Post-Quantum Crypto**: [@noble/post-quantum](https://www.npmjs.com/package/@noble/post-quantum)
276
+
277
+ ## License
278
+
279
+ MIT — Same as original.
280
+
281
+ ---
282
+
283
+ <div align="center">
284
+
285
+ **Security hardened with 🔒 by [Pantheon Security](https://pantheonsecurity.io)**
286
+
287
+ [Full Security Documentation](./SECURITY.md) • [Report Vulnerability](mailto:support@pantheonsecurity.io)
288
+
289
+ </div>