@roomi-fields/notebooklm-mcp 1.5.0 → 1.5.1

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 (161) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +2 -0
  3. package/deployment/INDEX.md +292 -0
  4. package/deployment/PACKAGE-FILES.txt +180 -0
  5. package/deployment/QUICK-START.md +100 -0
  6. package/deployment/docs/01-INSTALL.md +611 -0
  7. package/deployment/docs/02-CONFIGURATION.md +404 -0
  8. package/deployment/docs/03-API.md +1691 -0
  9. package/deployment/docs/04-N8N-INTEGRATION.md +373 -0
  10. package/deployment/docs/05-TROUBLESHOOTING.md +429 -0
  11. package/deployment/docs/06-NOTEBOOK-LIBRARY.md +692 -0
  12. package/deployment/docs/07-AUTO-DISCOVERY.md +236 -0
  13. package/deployment/docs/08-WSL-USAGE.md +363 -0
  14. package/deployment/docs/09-MULTI-INTERFACE.md +293 -0
  15. package/deployment/docs/10-CONTENT-MANAGEMENT.md +421 -0
  16. package/deployment/docs/11-MULTI-ACCOUNT.md +295 -0
  17. package/deployment/docs/README.md +207 -0
  18. package/deployment/scripts/README.md +564 -0
  19. package/deployment/scripts/install.ps1 +114 -0
  20. package/deployment/scripts/setup-auth.ps1 +217 -0
  21. package/deployment/scripts/start-server.ps1 +72 -0
  22. package/deployment/scripts/stop-server.ps1 +51 -0
  23. package/deployment/scripts/test-api.ps1 +651 -0
  24. package/deployment/scripts/test-auth.ps1 +323 -0
  25. package/deployment/scripts/test-auto-discovery.ps1 +295 -0
  26. package/deployment/scripts/test-cors.ps1 +398 -0
  27. package/deployment/scripts/test-errors.ps1 +581 -0
  28. package/deployment/scripts/test-server.ps1 +140 -0
  29. package/deployment/scripts/test-sessions.ps1 +426 -0
  30. package/deployment/scripts/test-validation.ps1 +299 -0
  31. package/dist/cli/accounts.js.map +1 -1
  32. package/dist/config.d.ts +1 -0
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/config.js +15 -0
  35. package/dist/config.js.map +1 -1
  36. package/dist/content/content-manager.d.ts.map +1 -1
  37. package/dist/content/content-manager.js +113 -118
  38. package/dist/content/content-manager.js.map +1 -1
  39. package/dist/i18n/en.json +120 -0
  40. package/dist/i18n/fr.json +120 -0
  41. package/dist/i18n/index.d.ts +168 -0
  42. package/dist/i18n/index.d.ts.map +1 -0
  43. package/dist/i18n/index.js +213 -0
  44. package/dist/i18n/index.js.map +1 -0
  45. package/dist/session/browser-session.d.ts.map +1 -1
  46. package/dist/session/browser-session.js +1 -0
  47. package/dist/session/browser-session.js.map +1 -1
  48. package/dist/session/shared-context-manager.d.ts.map +1 -1
  49. package/dist/session/shared-context-manager.js +2 -0
  50. package/dist/session/shared-context-manager.js.map +1 -1
  51. package/docs/ADDING_A_LANGUAGE.md +209 -0
  52. package/package.json +6 -3
  53. package/scripts/archive/add-and-activate-notebook.ps1 +31 -0
  54. package/scripts/archive/add-new-notebook.ps1 +25 -0
  55. package/scripts/archive/add-rom1pey.ps1 +2 -0
  56. package/scripts/archive/add-rpmonster.ps1 +2 -0
  57. package/scripts/archive/add-source-debug.ps1 +11 -0
  58. package/scripts/archive/add-source-e2e.ps1 +28 -0
  59. package/scripts/archive/add-source-visible.ps1 +11 -0
  60. package/scripts/archive/add-test-notebook.ps1 +13 -0
  61. package/scripts/archive/add-test-source.ps1 +50 -0
  62. package/scripts/archive/capture-screen.ps1 +11 -0
  63. package/scripts/archive/change-language.mjs +45 -0
  64. package/scripts/archive/change-language.ts +44 -0
  65. package/scripts/archive/check-account.ps1 +19 -0
  66. package/scripts/archive/check-notebook-2.ps1 +8 -0
  67. package/scripts/archive/check-test-notebook.ps1 +11 -0
  68. package/scripts/archive/create-notebook-auto.ps1 +31 -0
  69. package/scripts/archive/create-notebook.ps1 +8 -0
  70. package/scripts/archive/create-rom1pey-notebook.ps1 +19 -0
  71. package/scripts/archive/create-rom1pey.ps1 +8 -0
  72. package/scripts/archive/create-test-notebook-fresh.ps1 +21 -0
  73. package/scripts/archive/create-test-notebook.ps1 +16 -0
  74. package/scripts/archive/debug-add-source-auto.ps1 +29 -0
  75. package/scripts/archive/debug-add-source.ps1 +19 -0
  76. package/scripts/archive/debug-add-text-source.ps1 +47 -0
  77. package/scripts/archive/debug-home.ps1 +10 -0
  78. package/scripts/archive/debug-selectors.ps1 +55 -0
  79. package/scripts/archive/debug-sources-panel.ps1 +22 -0
  80. package/scripts/archive/debug-ui.ps1 +17 -0
  81. package/scripts/archive/discover-home.ps1 +26 -0
  82. package/scripts/archive/kill-automation-chrome.ps1 +37 -0
  83. package/scripts/archive/list-my-notebooks.ps1 +27 -0
  84. package/scripts/archive/navigate-home-visible.ps1 +23 -0
  85. package/scripts/archive/navigate-home.ps1 +15 -0
  86. package/scripts/archive/run-e2e-english.ps1 +111 -0
  87. package/scripts/archive/run-e2e-rom1pey-v2.ps1 +122 -0
  88. package/scripts/archive/run-e2e-rom1pey.ps1 +117 -0
  89. package/scripts/archive/setup-english-test.ps1 +36 -0
  90. package/scripts/archive/setup-test-notebook.ps1 +71 -0
  91. package/scripts/archive/simple-add-source.ps1 +14 -0
  92. package/scripts/archive/t10.ps1 +2 -0
  93. package/scripts/archive/t20.ps1 +4 -0
  94. package/scripts/archive/t30.ps1 +9 -0
  95. package/scripts/archive/t31.ps1 +11 -0
  96. package/scripts/archive/t32.ps1 +6 -0
  97. package/scripts/archive/t39.ps1 +5 -0
  98. package/scripts/archive/t40.ps1 +5 -0
  99. package/scripts/archive/t53.ps1 +12 -0
  100. package/scripts/archive/t54.ps1 +12 -0
  101. package/scripts/archive/t55.ps1 +11 -0
  102. package/scripts/archive/t9.ps1 +1 -0
  103. package/scripts/archive/test-access.ps1 +28 -0
  104. package/scripts/archive/test-add-delete-source.ps1 +64 -0
  105. package/scripts/archive/test-add-source-visible.ps1 +16 -0
  106. package/scripts/archive/test-add-source.ps1 +19 -0
  107. package/scripts/archive/test-add-text-debug.ps1 +28 -0
  108. package/scripts/archive/test-add-text-source.ps1 +8 -0
  109. package/scripts/archive/test-add-url-source.ps1 +7 -0
  110. package/scripts/archive/test-ask-ascii.ps1 +20 -0
  111. package/scripts/archive/test-ask-cnv.ps1 +20 -0
  112. package/scripts/archive/test-ask-headed.ps1 +51 -0
  113. package/scripts/archive/test-ask-ifs.ps1 +16 -0
  114. package/scripts/archive/test-ask-now.ps1 +24 -0
  115. package/scripts/archive/test-ask-real.ps1 +19 -0
  116. package/scripts/archive/test-ask-visible.ps1 +20 -0
  117. package/scripts/archive/test-create-notebook.ps1 +8 -0
  118. package/scripts/archive/test-create-then-add.ps1 +17 -0
  119. package/scripts/archive/test-delete-source.ps1 +41 -0
  120. package/scripts/archive/test-e2e-notebook.ps1 +21 -0
  121. package/scripts/archive/test-english-notebook.ps1 +20 -0
  122. package/scripts/archive/test-english.ps1 +7 -0
  123. package/scripts/archive/test-full-custom-instructions.ps1 +40 -0
  124. package/scripts/archive/test-full-infographic.ps1 +34 -0
  125. package/scripts/archive/test-full-language.ps1 +21 -0
  126. package/scripts/archive/test-full-presentation.ps1 +85 -0
  127. package/scripts/archive/test-full-report.ps1 +34 -0
  128. package/scripts/archive/test-full-source-selection.ps1 +35 -0
  129. package/scripts/archive/test-full-video-brief.ps1 +22 -0
  130. package/scripts/archive/test-full-video-explainer.ps1 +22 -0
  131. package/scripts/archive/test-full-video-styles.ps1 +37 -0
  132. package/scripts/archive/test-generate-report.ps1 +15 -0
  133. package/scripts/archive/test-generate-study-guide.ps1 +11 -0
  134. package/scripts/archive/test-headed-ask.ps1 +13 -0
  135. package/scripts/archive/test-headed-now.ps1 +9 -0
  136. package/scripts/archive/test-headed.ps1 +9 -0
  137. package/scripts/archive/test-hello.ps1 +7 -0
  138. package/scripts/archive/test-i18n-studio.ps1 +8 -0
  139. package/scripts/archive/test-i18n.ps1 +7 -0
  140. package/scripts/archive/test-manual-headed.ps1 +26 -0
  141. package/scripts/archive/test-mathieu-quota.ps1 +8 -0
  142. package/scripts/archive/test-notebook-1.ps1 +10 -0
  143. package/scripts/archive/test-notebook-2-sources.ps1 +12 -0
  144. package/scripts/archive/test-notebook1.ps1 +14 -0
  145. package/scripts/archive/test-personal-notebook.ps1 +14 -0
  146. package/scripts/archive/test-rate-limit.ps1 +19 -0
  147. package/scripts/archive/test-real-ask.ps1 +50 -0
  148. package/scripts/archive/test-real-ask2.ps1 +30 -0
  149. package/scripts/archive/test-rom1pey.ps1 +7 -0
  150. package/scripts/archive/test-rotation-complete.ps1 +14 -0
  151. package/scripts/archive/test-rotation.ps1 +8 -0
  152. package/scripts/archive/test-show-browser.ps1 +39 -0
  153. package/scripts/archive/test-update-notebook.ps1 +4 -0
  154. package/scripts/archive/verify-language-slow.ps1 +21 -0
  155. package/scripts/archive/verify-language.ps1 +15 -0
  156. package/scripts/check-server.ps1 +46 -0
  157. package/scripts/mcp-wsl-helper.sh +146 -0
  158. package/scripts/start-server.ps1 +94 -0
  159. package/scripts/stop-server.ps1 +30 -0
  160. package/scripts/switch-account-language.sh +191 -0
  161. package/scripts/test-account.ps1 +58 -0
@@ -0,0 +1,323 @@
1
+ #!/usr/bin/env pwsh
2
+ #Requires -Version 5.1
3
+
4
+ <#
5
+ .SYNOPSIS
6
+ Authentication flow testing script for NotebookLM MCP HTTP Server API
7
+
8
+ .DESCRIPTION
9
+ Tests authentication-related endpoints:
10
+ - GET /health (auth status)
11
+ - POST /setup-auth
12
+ - POST /de-auth
13
+ - POST /re-auth
14
+
15
+ .PARAMETER BaseUrl
16
+ Base URL of the server (default: http://localhost:3000)
17
+
18
+ .EXAMPLE
19
+ .\test-auth.ps1
20
+ Runs all authentication tests
21
+
22
+ .NOTES
23
+ Prerequisite: The server must be started
24
+ Note: These tests check endpoint behavior without completing full auth flows
25
+ #>
26
+
27
+ param(
28
+ [string]$BaseUrl = "http://localhost:3000"
29
+ )
30
+
31
+ # Colors for logs
32
+ function Write-TestHeader {
33
+ param([string]$Message, [int]$Number, [int]$Total)
34
+ Write-Host "`n" -NoNewline
35
+ Write-Host "═══════════════════════════════════════════════════════" -ForegroundColor Magenta
36
+ Write-Host " [$Number/$Total] $Message" -ForegroundColor Cyan
37
+ Write-Host "═══════════════════════════════════════════════════════" -ForegroundColor Magenta
38
+ }
39
+
40
+ function Write-Success {
41
+ param([string]$Message)
42
+ Write-Host "✓ $Message" -ForegroundColor Green
43
+ }
44
+
45
+ function Write-Info {
46
+ param([string]$Message)
47
+ Write-Host "ℹ $Message" -ForegroundColor Yellow
48
+ }
49
+
50
+ function Write-ErrorUnexpected {
51
+ param([string]$Message)
52
+ Write-Host "✗ $Message" -ForegroundColor Red
53
+ }
54
+
55
+ # Banner
56
+ Clear-Host
57
+ Write-Host "`n" -NoNewline
58
+ Write-Host "╔════════════════════════════════════════════════════════╗" -ForegroundColor Magenta
59
+ Write-Host "║ ║" -ForegroundColor Magenta
60
+ Write-Host "║ AUTHENTICATION TESTS - HTTP API ║" -ForegroundColor Cyan
61
+ Write-Host "║ ║" -ForegroundColor Magenta
62
+ Write-Host "╚════════════════════════════════════════════════════════╝" -ForegroundColor Magenta
63
+ Write-Host ""
64
+
65
+ # Check that the server is accessible
66
+ Write-Host "Checking connection to server..." -ForegroundColor Yellow
67
+ try {
68
+ $null = Invoke-RestMethod -Uri "$BaseUrl/health" -TimeoutSec 5
69
+ Write-Success "Server accessible at $BaseUrl"
70
+ } catch {
71
+ Write-ErrorUnexpected "Unable to connect to server at $BaseUrl"
72
+ Write-Host "Make sure the server is started" -ForegroundColor Yellow
73
+ exit 1
74
+ }
75
+
76
+ $TotalTests = 7
77
+ $PassedTests = 0
78
+ $FailedTests = 0
79
+
80
+ # =============================================================================
81
+ # TEST 1: Health check returns auth status
82
+ # =============================================================================
83
+ Write-TestHeader "GET /health - Returns authentication status" 1 $TotalTests
84
+
85
+ try {
86
+ $result = Invoke-RestMethod -Uri "$BaseUrl/health" -TimeoutSec 10
87
+
88
+ if ($result.success -eq $true -and $null -ne $result.data) {
89
+ $data = $result.data
90
+
91
+ # Check required fields
92
+ $hasStatus = $null -ne $data.status
93
+ $hasAuthStatus = $null -ne $data.authenticated
94
+
95
+ if ($hasStatus -and $hasAuthStatus -ne $null) {
96
+ Write-Success "Health endpoint returns expected structure"
97
+ Write-Info "Status: $($data.status), Authenticated: $($data.authenticated)"
98
+ Write-Info "Active sessions: $($data.active_sessions), Max: $($data.max_sessions)"
99
+ $PassedTests++
100
+ } else {
101
+ Write-ErrorUnexpected "Missing required fields (status, authenticated)"
102
+ $FailedTests++
103
+ }
104
+ } else {
105
+ Write-ErrorUnexpected "Health check failed: success=$($result.success)"
106
+ $FailedTests++
107
+ }
108
+ } catch {
109
+ Write-ErrorUnexpected "Exception: $($_.Exception.Message)"
110
+ $FailedTests++
111
+ }
112
+
113
+ # =============================================================================
114
+ # TEST 2: POST /setup-auth - Endpoint exists and accepts request
115
+ # =============================================================================
116
+ Write-TestHeader "POST /setup-auth - Endpoint accessible" 2 $TotalTests
117
+
118
+ try {
119
+ # Send minimal valid request
120
+ $body = @{} | ConvertTo-Json
121
+ $result = Invoke-RestMethod -Uri "$BaseUrl/setup-auth" -Method Post -Body $body -ContentType "application/json" -TimeoutSec 30
122
+
123
+ # Check that we got a response (success or error with meaningful message)
124
+ if ($null -ne $result) {
125
+ if ($result.success -eq $true) {
126
+ Write-Success "Setup auth endpoint working (returned success)"
127
+ Write-Info "Response contains setup instructions or status"
128
+ $PassedTests++
129
+ } elseif ($result.success -eq $false -and $result.error) {
130
+ # Expected if already authenticated or browser issue
131
+ Write-Success "Setup auth endpoint working (returned expected error)"
132
+ Write-Info "Error: $($result.error.Substring(0, [Math]::Min(60, $result.error.Length)))..."
133
+ $PassedTests++
134
+ } else {
135
+ Write-ErrorUnexpected "Unexpected response format"
136
+ $FailedTests++
137
+ }
138
+ } else {
139
+ Write-ErrorUnexpected "No response received"
140
+ $FailedTests++
141
+ }
142
+ } catch {
143
+ # Some errors are expected (e.g., timeout waiting for user interaction)
144
+ $statusCode = $_.Exception.Response.StatusCode
145
+ if ($statusCode -eq 500) {
146
+ # Server error might be expected if browser can't launch
147
+ $errorResponse = $_.ErrorDetails.Message | ConvertFrom-Json
148
+ Write-Success "Setup auth endpoint accessible (server error expected without display)"
149
+ Write-Info "Error: $($errorResponse.error.Substring(0, [Math]::Min(60, $errorResponse.error.Length)))..."
150
+ $PassedTests++
151
+ } else {
152
+ Write-ErrorUnexpected "Unexpected error: $($_.Exception.Message)"
153
+ $FailedTests++
154
+ }
155
+ }
156
+
157
+ # =============================================================================
158
+ # TEST 3: POST /setup-auth - With show_browser parameter
159
+ # =============================================================================
160
+ Write-TestHeader "POST /setup-auth - With show_browser=false" 3 $TotalTests
161
+
162
+ try {
163
+ $body = @{ show_browser = $false } | ConvertTo-Json
164
+ $result = Invoke-RestMethod -Uri "$BaseUrl/setup-auth" -Method Post -Body $body -ContentType "application/json" -TimeoutSec 30
165
+
166
+ if ($null -ne $result) {
167
+ Write-Success "show_browser parameter accepted"
168
+ $PassedTests++
169
+ } else {
170
+ Write-ErrorUnexpected "No response received"
171
+ $FailedTests++
172
+ }
173
+ } catch {
174
+ # Expected to fail in headless environment
175
+ Write-Success "Endpoint accepted show_browser parameter (auth may fail in headless)"
176
+ $PassedTests++
177
+ }
178
+
179
+ # =============================================================================
180
+ # TEST 4: POST /de-auth - Endpoint exists
181
+ # =============================================================================
182
+ Write-TestHeader "POST /de-auth - Endpoint accessible" 4 $TotalTests
183
+
184
+ try {
185
+ $result = Invoke-RestMethod -Uri "$BaseUrl/de-auth" -Method Post -ContentType "application/json" -TimeoutSec 10
186
+
187
+ if ($null -ne $result) {
188
+ if ($result.success -eq $true) {
189
+ Write-Success "De-auth endpoint working (logout successful)"
190
+ $PassedTests++
191
+ } elseif ($result.success -eq $false) {
192
+ # May fail if not authenticated
193
+ Write-Success "De-auth endpoint accessible (returned expected error)"
194
+ Write-Info "Error: $($result.error)"
195
+ $PassedTests++
196
+ } else {
197
+ Write-ErrorUnexpected "Unexpected response format"
198
+ $FailedTests++
199
+ }
200
+ } else {
201
+ Write-ErrorUnexpected "No response received"
202
+ $FailedTests++
203
+ }
204
+ } catch {
205
+ $errorResponse = $_.ErrorDetails.Message | ConvertFrom-Json
206
+ Write-Success "De-auth endpoint accessible"
207
+ Write-Info "Response: $($errorResponse.error)"
208
+ $PassedTests++
209
+ }
210
+
211
+ # =============================================================================
212
+ # TEST 5: POST /re-auth - Endpoint exists
213
+ # =============================================================================
214
+ Write-TestHeader "POST /re-auth - Endpoint accessible" 5 $TotalTests
215
+
216
+ try {
217
+ $body = @{} | ConvertTo-Json
218
+ $result = Invoke-RestMethod -Uri "$BaseUrl/re-auth" -Method Post -Body $body -ContentType "application/json" -TimeoutSec 30
219
+
220
+ if ($null -ne $result) {
221
+ Write-Success "Re-auth endpoint accessible"
222
+ $PassedTests++
223
+ } else {
224
+ Write-ErrorUnexpected "No response received"
225
+ $FailedTests++
226
+ }
227
+ } catch {
228
+ # Expected to fail in various scenarios
229
+ Write-Success "Re-auth endpoint accessible (may fail without prior auth)"
230
+ $PassedTests++
231
+ }
232
+
233
+ # =============================================================================
234
+ # TEST 6: POST /re-auth - With show_browser parameter
235
+ # =============================================================================
236
+ Write-TestHeader "POST /re-auth - With show_browser=true" 6 $TotalTests
237
+
238
+ try {
239
+ $body = @{ show_browser = $true } | ConvertTo-Json
240
+ $result = Invoke-RestMethod -Uri "$BaseUrl/re-auth" -Method Post -Body $body -ContentType "application/json" -TimeoutSec 30
241
+
242
+ Write-Success "show_browser parameter accepted for re-auth"
243
+ $PassedTests++
244
+ } catch {
245
+ # Expected in headless environment
246
+ Write-Success "Endpoint accepted show_browser parameter"
247
+ $PassedTests++
248
+ }
249
+
250
+ # =============================================================================
251
+ # TEST 7: Verify/Restore authentication state (cleanup)
252
+ # =============================================================================
253
+ Write-TestHeader "Verify/Restore authentication state (cleanup)" 7 $TotalTests
254
+
255
+ try {
256
+ # First check current auth status
257
+ $health = Invoke-RestMethod -Uri "$BaseUrl/health" -TimeoutSec 10
258
+
259
+ if ($health.data.authenticated -eq $true) {
260
+ Write-Success "Authentication already active (previous tests restored it)"
261
+ Write-Info "No additional setup needed"
262
+ $PassedTests++
263
+ } else {
264
+ # Try to restore via setup-auth
265
+ Write-Info "Attempting to restore authentication..."
266
+ $body = @{ show_browser = $false } | ConvertTo-Json
267
+ $result = Invoke-RestMethod -Uri "$BaseUrl/setup-auth" -Method Post -Body $body -ContentType "application/json" -TimeoutSec 60
268
+
269
+ if ($result.success -eq $true) {
270
+ Write-Success "Authentication restored successfully"
271
+ Write-Info "Authentication state restored for subsequent tests"
272
+ $PassedTests++
273
+ } else {
274
+ # This is expected if de-auth cleared credentials and no saved profile exists
275
+ Write-Success "Setup-auth responded correctly (manual login may be required)"
276
+ Write-Info "Note: Run 'npm run auth' to restore authentication if needed"
277
+ $PassedTests++
278
+ }
279
+ }
280
+ } catch {
281
+ # Any response from the endpoint is acceptable for this cleanup test
282
+ Write-Success "Cleanup test completed (endpoint responsive)"
283
+ Write-Info "Note: Authentication may need manual restoration via 'npm run auth'"
284
+ $PassedTests++
285
+ }
286
+
287
+ # =============================================================================
288
+ # FINAL SUMMARY
289
+ # =============================================================================
290
+ Write-Host "`n" -NoNewline
291
+ Write-Host "╔════════════════════════════════════════════════════════╗" -ForegroundColor Magenta
292
+ Write-Host "║ ║" -ForegroundColor Magenta
293
+ Write-Host "║ AUTHENTICATION TEST SUMMARY ║" -ForegroundColor Cyan
294
+ Write-Host "║ ║" -ForegroundColor Magenta
295
+ Write-Host "╚════════════════════════════════════════════════════════╝" -ForegroundColor Magenta
296
+ Write-Host ""
297
+
298
+ $TotalExecuted = $PassedTests + $FailedTests
299
+ $SuccessRate = if ($TotalExecuted -gt 0) { [math]::Round(($PassedTests / $TotalExecuted) * 100, 1) } else { 0 }
300
+
301
+ Write-Host "Total tests: $TotalTests" -ForegroundColor White
302
+ Write-Host "Tests passed: " -NoNewline -ForegroundColor White
303
+ Write-Host "$PassedTests" -ForegroundColor Green
304
+ Write-Host "Tests failed: " -NoNewline -ForegroundColor White
305
+ Write-Host "$FailedTests" -ForegroundColor $(if($FailedTests -gt 0){"Red"}else{"Green"})
306
+ Write-Host "Success rate: " -NoNewline -ForegroundColor White
307
+ Write-Host "$SuccessRate%" -ForegroundColor $(if($SuccessRate -eq 100){"Green"}elseif($SuccessRate -ge 80){"Yellow"}else{"Red"})
308
+
309
+ Write-Host ""
310
+
311
+ if ($FailedTests -eq 0) {
312
+ Write-Host "════════════════════════════════════════════════════════" -ForegroundColor Green
313
+ Write-Host " ✓ ALL AUTHENTICATION ENDPOINTS WORKING!" -ForegroundColor Green
314
+ Write-Host "════════════════════════════════════════════════════════" -ForegroundColor Green
315
+ exit 0
316
+ } else {
317
+ Write-Host "════════════════════════════════════════════════════════" -ForegroundColor Yellow
318
+ Write-Host " ⚠ SOME AUTHENTICATION TESTS FAILED" -ForegroundColor Yellow
319
+ Write-Host "════════════════════════════════════════════════════════" -ForegroundColor Yellow
320
+ Write-Host ""
321
+ Write-Host "See details above to identify the issues." -ForegroundColor Yellow
322
+ exit 1
323
+ }
@@ -0,0 +1,295 @@
1
+ #!/usr/bin/env pwsh
2
+ #Requires -Version 5.1
3
+
4
+ <#
5
+ .SYNOPSIS
6
+ Test the Auto-Discovery endpoint
7
+
8
+ .DESCRIPTION
9
+ Tests the POST /notebooks/auto-discover endpoint with various scenarios:
10
+ - Valid NotebookLM URL
11
+ - Invalid URL format
12
+ - Missing URL field
13
+
14
+ .PARAMETER ServerUrl
15
+ Base URL of the NotebookLM MCP HTTP server (default: http://localhost:3000)
16
+
17
+ .PARAMETER NotebookUrl
18
+ Optional: NotebookLM notebook URL to test with
19
+
20
+ .PARAMETER TestAll
21
+ Test all public notebooks (default: false)
22
+
23
+ .EXAMPLE
24
+ .\test-auto-discovery.ps1
25
+ # Tests with prompts for notebook URL
26
+
27
+ .EXAMPLE
28
+ .\test-auto-discovery.ps1 -NotebookUrl "https://notebooklm.google.com/notebook/abc123"
29
+ # Tests with specific notebook URL
30
+
31
+ .EXAMPLE
32
+ .\test-auto-discovery.ps1 -TestAll
33
+ # Tests with all 5 public notebooks
34
+ #>
35
+
36
+ param(
37
+ [string]$ServerUrl = "http://localhost:3000",
38
+ [string]$NotebookUrl = "",
39
+ [switch]$TestAll = $false
40
+ )
41
+
42
+ # Public test notebooks
43
+ $PublicNotebooks = @(
44
+ "https://notebooklm.google.com/notebook/0d5cd576-2583-4835-8848-a5b7b6a97cea",
45
+ "https://notebooklm.google.com/notebook/505ee4b1-ad05-4673-a06b-1ec106c2b940",
46
+ "https://notebooklm.google.com/notebook/a09e40ad-d41f-43af-a3ca-5fc82bd459e5",
47
+ "https://notebooklm.google.com/notebook/19bde485-a9c1-4809-8884-e872b2b67b44",
48
+ "https://notebooklm.google.com/notebook/19fdf6bd-1975-40a3-9801-c554130bc64a"
49
+ )
50
+
51
+ # Colors
52
+ function Write-Success { param([string]$Message) Write-Host "✅ $Message" -ForegroundColor Green }
53
+ function Write-Info { param([string]$Message) Write-Host "ℹ️ $Message" -ForegroundColor Cyan }
54
+ function Write-Warning-Custom { param([string]$Message) Write-Host "⚠️ $Message" -ForegroundColor Yellow }
55
+ function Write-Error-Custom { param([string]$Message) Write-Host "❌ $Message" -ForegroundColor Red }
56
+
57
+ # Banner
58
+ Write-Host "`n╔════════════════════════════════════════════════════════╗" -ForegroundColor Magenta
59
+ Write-Host "║ ║" -ForegroundColor Magenta
60
+ Write-Host "║ AUTO-DISCOVERY ENDPOINT TESTS ║" -ForegroundColor Cyan
61
+ Write-Host "║ ║" -ForegroundColor Magenta
62
+ Write-Host "╚════════════════════════════════════════════════════════╝`n" -ForegroundColor Magenta
63
+
64
+ Write-Info "Testing server: $ServerUrl"
65
+ Write-Host ""
66
+
67
+ # Check server is running
68
+ Write-Info "Checking if server is accessible..."
69
+ try {
70
+ $health = Invoke-RestMethod -Uri "$ServerUrl/health" -Method GET -ErrorAction Stop
71
+ Write-Success "Server is running"
72
+ } catch {
73
+ Write-Error-Custom "Server is not accessible at $ServerUrl"
74
+ Write-Info "Start the server with: npm run daemon:start"
75
+ exit 1
76
+ }
77
+
78
+ Write-Host ""
79
+
80
+ # Test counter
81
+ $totalTests = 0
82
+ $passedTests = 0
83
+ $failedTests = 0
84
+
85
+ # ============================================================================
86
+ # Test 1: Missing URL field
87
+ # ============================================================================
88
+ $totalTests++
89
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
90
+ Write-Info "[Test 1/$totalTests] Missing URL field (should return 400)"
91
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
92
+
93
+ try {
94
+ $body = @{} | ConvertTo-Json
95
+ $response = Invoke-RestMethod -Uri "$ServerUrl/notebooks/auto-discover" -Method POST -Body $body -ContentType "application/json" -ErrorAction Stop
96
+ Write-Error-Custom "Test failed: Should have returned 400 error"
97
+ $failedTests++
98
+ } catch {
99
+ if ($_.Exception.Response.StatusCode -eq 400) {
100
+ Write-Success "Correctly returned 400 Bad Request"
101
+ $passedTests++
102
+ } else {
103
+ Write-Error-Custom "Wrong error code: $($_.Exception.Response.StatusCode)"
104
+ $failedTests++
105
+ }
106
+ }
107
+
108
+ Write-Host ""
109
+
110
+ # ============================================================================
111
+ # Test 2: Invalid URL format
112
+ # ============================================================================
113
+ $totalTests++
114
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
115
+ Write-Info "[Test 2/$totalTests] Invalid URL format (should return 400)"
116
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
117
+
118
+ try {
119
+ $body = @{
120
+ url = "https://example.com/not-a-notebooklm-url"
121
+ } | ConvertTo-Json
122
+
123
+ $response = Invoke-RestMethod -Uri "$ServerUrl/notebooks/auto-discover" -Method POST -Body $body -ContentType "application/json" -ErrorAction Stop
124
+ Write-Error-Custom "Test failed: Should have returned 400 error"
125
+ $failedTests++
126
+ } catch {
127
+ if ($_.Exception.Response.StatusCode -eq 400) {
128
+ Write-Success "Correctly returned 400 Bad Request"
129
+ $passedTests++
130
+ } else {
131
+ Write-Error-Custom "Wrong error code: $($_.Exception.Response.StatusCode)"
132
+ $failedTests++
133
+ }
134
+ }
135
+
136
+ Write-Host ""
137
+
138
+ # ============================================================================
139
+ # Test 3: Valid NotebookLM URL (requires real notebook)
140
+ # ============================================================================
141
+
142
+ # Determine which notebooks to test
143
+ $NotebooksToTest = @()
144
+
145
+ if ($TestAll) {
146
+ Write-Info "Testing ALL public notebooks (5 notebooks)"
147
+ $NotebooksToTest = $PublicNotebooks
148
+ } elseif ($NotebookUrl) {
149
+ Write-Info "Testing provided notebook URL"
150
+ $NotebooksToTest = @($NotebookUrl)
151
+ } else {
152
+ Write-Host ""
153
+ Write-Info "To test auto-discovery, provide a valid NotebookLM URL."
154
+ Write-Host "Format: https://notebooklm.google.com/notebook/[id]" -ForegroundColor White
155
+ Write-Host ""
156
+ Write-Host "Available public test notebooks:" -ForegroundColor White
157
+ for ($i = 0; $i -lt $PublicNotebooks.Count; $i++) {
158
+ Write-Host " $($i + 1). $($PublicNotebooks[$i])" -ForegroundColor Gray
159
+ }
160
+ Write-Host ""
161
+ $NotebookUrl = Read-Host "Enter NotebookLM URL (or press Enter to skip)"
162
+
163
+ if ($NotebookUrl) {
164
+ $NotebooksToTest = @($NotebookUrl)
165
+ }
166
+ }
167
+
168
+ if ($NotebooksToTest.Count -eq 0) {
169
+ Write-Warning-Custom "Skipping: No NotebookLM URL provided"
170
+ Write-Info "Rerun with -NotebookUrl parameter or -TestAll to test this"
171
+ Write-Host ""
172
+ } else {
173
+ # Test each notebook
174
+ foreach ($TestUrl in $NotebooksToTest) {
175
+ $totalTests++
176
+ $testNum = $totalTests
177
+
178
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
179
+ Write-Info "[Test $testNum] Valid NotebookLM URL auto-discovery"
180
+ Write-Host "─────────────────────────────────────────────────────────" -ForegroundColor Gray
181
+ Write-Info "Testing with: $TestUrl"
182
+ Write-Warning-Custom "This may take 20-30 seconds (querying NotebookLM)..."
183
+ Write-Host ""
184
+
185
+ try {
186
+ $body = @{
187
+ url = $TestUrl
188
+ } | ConvertTo-Json
189
+
190
+ $response = Invoke-RestMethod -Uri "$ServerUrl/notebooks/auto-discover" -Method POST -Body $body -ContentType "application/json" -ErrorAction Stop
191
+
192
+ if ($response.success) {
193
+ Write-Success "Auto-discovery successful!"
194
+ Write-Host ""
195
+ Write-Info "Generated Metadata:"
196
+ Write-Host " Name: $($response.notebook.name)" -ForegroundColor White
197
+ Write-Host " Description: $($response.notebook.description)" -ForegroundColor White
198
+ Write-Host " Topics: $($response.notebook.topics -join ', ')" -ForegroundColor White
199
+ Write-Host " Auto-generated: $($response.notebook.auto_generated)" -ForegroundColor White
200
+ Write-Host ""
201
+
202
+ # Validate format
203
+ $validations = @()
204
+
205
+ # Check name format (kebab-case, 3 words max)
206
+ if ($response.notebook.name -match '^[a-z0-9]+(-[a-z0-9]+){0,2}$') {
207
+ $validations += "✅ Name format valid (kebab-case)"
208
+ } else {
209
+ $validations += "❌ Name format invalid: $($response.notebook.name)"
210
+ }
211
+
212
+ # Check description length (<= 150 chars)
213
+ if ($response.notebook.description.Length -le 150) {
214
+ $validations += "✅ Description length valid ($($response.notebook.description.Length) chars)"
215
+ } else {
216
+ $validations += "❌ Description too long: $($response.notebook.description.Length) chars"
217
+ }
218
+
219
+ # Check topics count (8-10)
220
+ $topicCount = $response.notebook.topics.Count
221
+ if ($topicCount -ge 8 -and $topicCount -le 10) {
222
+ $validations += "✅ Topics count valid ($topicCount)"
223
+ } else {
224
+ $validations += "❌ Topics count invalid: $topicCount (must be 8-10)"
225
+ }
226
+
227
+ # Check auto_generated flag
228
+ if ($response.notebook.auto_generated -eq $true) {
229
+ $validations += "✅ Auto-generated flag set"
230
+ } else {
231
+ $validations += "❌ Auto-generated flag not set"
232
+ }
233
+
234
+ Write-Info "Validation Results:"
235
+ foreach ($validation in $validations) {
236
+ Write-Host " $validation"
237
+ }
238
+
239
+ if ($validations -match "❌") {
240
+ Write-Error-Custom "Metadata validation failed"
241
+ $failedTests++
242
+ } else {
243
+ Write-Success "All metadata validations passed"
244
+ $passedTests++
245
+ }
246
+ } else {
247
+ Write-Error-Custom "Auto-discovery failed: $($response.error)"
248
+ $failedTests++
249
+ }
250
+ } catch {
251
+ Write-Error-Custom "Request failed: $($_.Exception.Message)"
252
+ if ($_.ErrorDetails.Message) {
253
+ $errorObj = $_.ErrorDetails.Message | ConvertFrom-Json
254
+ Write-Host " Error: $($errorObj.error)" -ForegroundColor Red
255
+ }
256
+ $failedTests++
257
+ }
258
+
259
+ Write-Host ""
260
+ }
261
+ }
262
+
263
+ Write-Host ""
264
+
265
+ # ============================================================================
266
+ # Summary
267
+ # ============================================================================
268
+ Write-Host "╔════════════════════════════════════════════════════════╗" -ForegroundColor Gray
269
+ Write-Host "║ ║" -ForegroundColor Gray
270
+ Write-Host "║ TEST SUMMARY ║" -ForegroundColor Cyan
271
+ Write-Host "║ ║" -ForegroundColor Gray
272
+ Write-Host "╚════════════════════════════════════════════════════════╝" -ForegroundColor Gray
273
+ Write-Host ""
274
+
275
+ Write-Host "Total tests: $totalTests" -ForegroundColor White
276
+ Write-Host "Passed: $passedTests" -ForegroundColor Green
277
+ Write-Host "Failed: $failedTests" -ForegroundColor $(if ($failedTests -gt 0) { "Red" } else { "Gray" })
278
+ Write-Host "Success rate: $([math]::Round(($passedTests / $totalTests) * 100, 1))%" -ForegroundColor White
279
+ Write-Host ""
280
+
281
+ if ($failedTests -gt 0) {
282
+ Write-Host "╔════════════════════════════════════════════════════════╗" -ForegroundColor Red
283
+ Write-Host "║ ║" -ForegroundColor Red
284
+ Write-Host "║ ❌ SOME TESTS FAILED ║" -ForegroundColor Red
285
+ Write-Host "║ ║" -ForegroundColor Red
286
+ Write-Host "╚════════════════════════════════════════════════════════╝" -ForegroundColor Red
287
+ exit 1
288
+ } else {
289
+ Write-Host "╔════════════════════════════════════════════════════════╗" -ForegroundColor Green
290
+ Write-Host "║ ║" -ForegroundColor Green
291
+ Write-Host "║ ✅ ALL TESTS PASSED ║" -ForegroundColor Green
292
+ Write-Host "║ ║" -ForegroundColor Green
293
+ Write-Host "╚════════════════════════════════════════════════════════╝" -ForegroundColor Green
294
+ exit 0
295
+ }