@chinchillaenterprises/mcp-dev-logger 2.1.0 โ†’ 2.3.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.
package/README.md CHANGED
@@ -1,8 +1,31 @@
1
- # MCP Dev Logger v2.1.0
1
+ # MCP Dev Logger v2.3.1
2
2
 
3
- A Model Context Protocol (MCP) server for capturing and streaming development server output with enhanced organization and automatic cleanup. Perfect for monitoring `npm run dev`, `yarn dev`, `pnpm dev`, or any other development server commands across all frameworks (Next.js, Vite, Create React App, etc.).
3
+ A Model Context Protocol (MCP) server for capturing and streaming development server output with browser console logging, enhanced organization, and automatic cleanup. Perfect for monitoring `npm run dev`, `yarn dev`, `pnpm dev`, or any other development server commands across all frameworks (Next.js, Vite, Create React App, etc.).
4
4
 
5
- ## ๐ŸŽ‰ New in v2.1.0
5
+ ## ๐ŸŽ‰ New in v2.3.1
6
+
7
+ - **Enhanced Error Capture**: Now captures JavaScript errors that don't trigger console.error, including:
8
+ - React hydration errors
9
+ - Unhandled promise rejections
10
+ - Page-level JavaScript errors
11
+ - Network request failures (4xx/5xx responses)
12
+ - **Visual Error Alerts**: Red banner notification when JavaScript errors occur
13
+ - **Better Error Context**: Full stack traces for all JavaScript errors
14
+
15
+ ## Previous Features (v2.3.0)
16
+
17
+ - **One-Click Student Workflow**: New `dev_start_frontend_with_browser` tool that starts server AND launches browser automatically
18
+ - **Smart Port Detection**: Automatically detects which port your dev server is using
19
+ - **Server Ready Detection**: Waits for server to be fully ready before launching browser
20
+ - **Simplified Teaching**: Reduces student setup from 3 commands to just 1
21
+
22
+ ## Previous Features (v2.2.0)
23
+
24
+ - **Browser Console Capture**: Capture browser console.log, console.error, and other console outputs alongside server logs
25
+ - **Unified Log Stream**: See both server-side and client-side logs in one place
26
+ - **Student-Friendly Browser**: TEST BROWSER with visual indicators for teaching
27
+
28
+ ## Previous Features (v2.1.0)
6
29
 
7
30
  - **Organized Log Structure**: Logs are now organized by process type (frontend/backend/amplify/custom)
8
31
  - **Automatic Cleanup**: Keeps only the last 3 days of logs to prevent disk space issues
@@ -11,6 +34,7 @@ A Model Context Protocol (MCP) server for capturing and streaming development se
11
34
  ## Features
12
35
 
13
36
  - **Universal Dev Server Logging**: Works with any development server command
37
+ - **Browser Console Capture**: Capture console.log, console.error, console.warn from the browser
14
38
  - **Multi-Process Support**: Run multiple dev servers simultaneously (frontend + backend)
15
39
  - **Real-time Log Streaming**: Capture build errors, TypeScript errors, hot reload events
16
40
  - **Organized Log Storage**: Structured as `logs/YYYY-MM-DD/processType/logfile.log`
@@ -21,6 +45,7 @@ A Model Context Protocol (MCP) server for capturing and streaming development se
21
45
  - **Auto-Generated Process IDs**: Intelligent process ID generation based on command and output file
22
46
  - **Process State Persistence**: Maintains process state across server restarts (where possible)
23
47
  - **Signal Handling**: Proper cleanup with SIGTERM for graceful shutdowns
48
+ - **Unified Server + Browser Logs**: See both frontend and backend logs in one stream
24
49
 
25
50
  ## Installation
26
51
 
@@ -129,6 +154,86 @@ Clear the log file.
129
154
  - `processId` (optional): Process ID to clear logs for (smart fallback for single process)
130
155
  - `backup` (optional): Whether to backup logs before clearing (default: false)
131
156
 
157
+ ### 8. dev_launch_test_browser
158
+ Launch a TEST BROWSER for students to interact with. All console logs from this browser are captured automatically. Students should use THIS browser (not their regular browser) to test their app.
159
+
160
+ **Parameters:**
161
+ - `processId` (optional): Process ID to attach browser console to
162
+ - `browserUrl` (optional): URL to open in test browser (default: http://localhost:3000)
163
+ - `teachingMode` (optional): Enable teaching mode with DevTools open and slower actions (default: true)
164
+ - `viewport` (optional): Browser window size (default: { width: 1280, height: 800 })
165
+ - `highlightErrors` (optional): Add visual indicator when console errors occur (default: true)
166
+
167
+ **Key Features:**
168
+ - ๐ŸชŸ Always visible browser window (not headless)
169
+ - ๐Ÿ” DevTools automatically open in teaching mode
170
+ - ๐ŸŒ Slower actions for easier teaching/learning
171
+ - โšก Red flash on console errors
172
+ - ๐Ÿ“ Green banner showing "TEST BROWSER" status
173
+ - ๐ŸŽฏ All console logs captured to the same log file as server logs
174
+
175
+ **Example:**
176
+ ```json
177
+ {
178
+ "processId": "npm-frontend",
179
+ "browserUrl": "http://localhost:3000",
180
+ "teachingMode": true,
181
+ "highlightErrors": true
182
+ }
183
+ ```
184
+
185
+ ### 9. dev_stop_browser_console
186
+ Stop browser console capture for a specific process.
187
+
188
+ **Parameters:**
189
+ - `processId` (optional): Process ID to stop browser console capture for
190
+
191
+ ### 10. dev_start_frontend_with_browser ๐Ÿš€ NEW in v2.3.0!
192
+ **ONE-CLICK STUDENT WORKFLOW**: Start frontend server AND automatically launch test browser when ready. Perfect for teaching environments - reduces setup from 3 commands to 1!
193
+
194
+ **Parameters:**
195
+ - `command` (optional): Dev command to run (default: "npm run dev")
196
+ - `port` (optional): Port to wait for (default: auto-detect from output)
197
+ - `waitTimeout` (optional): Max time to wait for server in ms (default: 30000)
198
+ - `browserDelay` (optional): Delay after server ready in ms (default: 1000)
199
+ - `teachingMode` (optional): Enable teaching features (default: true)
200
+ - `processId` (optional): Custom process ID (default: "frontend-with-browser")
201
+ - `env` (optional): Environment variables
202
+ - `cwd` (optional): Working directory
203
+
204
+ **Key Features:**
205
+ - ๐ŸŽฏ Automatically detects when server is ready
206
+ - ๐ŸชŸ Launches test browser with DevTools open
207
+ - ๐Ÿ“ Captures both server AND browser console logs
208
+ - โšก Red flash on browser errors
209
+ - ๐Ÿงช Green "TEST BROWSER" banner
210
+ - โฑ๏ธ Single command instead of multiple steps
211
+
212
+ **Example:**
213
+ ```json
214
+ {
215
+ "command": "npm run dev",
216
+ "teachingMode": true,
217
+ "processId": "student-project"
218
+ }
219
+ ```
220
+
221
+ **Success Output:**
222
+ ```
223
+ โœ… Starting development server...
224
+ โœ… Server ready on http://localhost:3000
225
+ โœ… Launching test browser...
226
+
227
+ ๐ŸŽฏ TEST BROWSER LAUNCHED!
228
+
229
+ ๐Ÿ‘‰ Use the browser window that just opened (with green banner)
230
+ ๐Ÿ“ All console logs are being saved
231
+ ๐Ÿ” DevTools is open for debugging
232
+ โš ๏ธ Errors will flash red on screen
233
+
234
+ Happy debugging! ๐Ÿš€
235
+ ```
236
+
132
237
  ## Usage Examples
133
238
 
134
239
  ### Multi-Process Development (v2.0.0)
@@ -219,7 +324,7 @@ logs/
219
324
 
220
325
  ## Log Format
221
326
 
222
- Logs are written with timestamps, process IDs, and error markers:
327
+ Logs are written with timestamps, process IDs, and error markers. Browser console logs are prefixed with [BROWSER]:
223
328
 
224
329
  ```
225
330
  [2024-01-15T10:30:45.123Z] Starting: npm run dev (Process ID: npm-frontend)
@@ -228,6 +333,11 @@ Logs are written with timestamps, process IDs, and error markers:
228
333
  [2024-01-15T10:30:47.123Z] [npm-frontend] โ–ฒ Next.js 14.0.0
229
334
  [2024-01-15T10:30:47.124Z] [npm-frontend] - Local: http://localhost:3000
230
335
  [2024-01-15T10:30:48.789Z] [npm-frontend] [ERROR] Error: Cannot find module './components/Header'
336
+ [2024-01-15T10:30:49.123Z] [npm-frontend] [BROWSER] Console capture started for http://localhost:3000
337
+ [2024-01-15T10:30:49.456Z] [npm-frontend] [BROWSER] [LOG] React DevTools detected
338
+ [2024-01-15T10:30:49.789Z] [npm-frontend] [BROWSER] [WARN] React: Each child should have a unique key prop
339
+ [2024-01-15T10:30:50.123Z] [npm-frontend] [BROWSER] [ERROR] Failed to fetch /api/user: 404 Not Found
340
+ [2024-01-15T10:30:50.456Z] [npm-frontend] [BROWSER] [LOG] { user: null, loading: false }
231
341
 
232
342
  [2024-01-15T10:30:50.123Z] Starting: npx ampx sandbox --stream-function-logs (Process ID: npx-backend)
233
343
  [2024-01-15T10:30:51.456Z] [npx-backend] [INFO] Amplify sandbox starting...
@@ -288,6 +398,108 @@ dev_start_log_streaming {
288
398
  dev_tail_logs { "processId": "amplify-backend", "filter": "ERROR|WARN", "lines": 100 }
289
399
  ```
290
400
 
401
+ ### 6. Student Testing Workflow (v2.2.0)
402
+ ```typescript
403
+ // Step 1: Start the student's dev server
404
+ dev_start_log_streaming({
405
+ "command": "npm run dev",
406
+ "processId": "student-app"
407
+ })
408
+
409
+ // Step 2: Launch the TEST BROWSER for the student
410
+ dev_launch_test_browser({
411
+ "processId": "student-app",
412
+ "browserUrl": "http://localhost:3000",
413
+ "teachingMode": true // DevTools open, slower actions
414
+ })
415
+
416
+ // Step 3: Tell student: "Use the TEST BROWSER window that just opened!"
417
+ // They click buttons, fill forms, trigger errors - ALL console logs are captured
418
+
419
+ // Step 4: When student says "I clicked submit and nothing happened"
420
+ dev_tail_logs({
421
+ "processId": "student-app",
422
+ "filter": "\\[BROWSER\\].*\\[ERROR\\]",
423
+ "lines": 20
424
+ })
425
+ // Shows: [BROWSER] [ERROR] Cannot read property 'name' of undefined
426
+
427
+ // Step 5: Show all browser activity
428
+ dev_tail_logs({
429
+ "processId": "student-app",
430
+ "filter": "\\[BROWSER\\]",
431
+ "lines": 50
432
+ })
433
+
434
+ // Step 6: When done testing
435
+ dev_stop_browser_console({ "processId": "student-app" })
436
+ ```
437
+
438
+ **What Students See:**
439
+ - A browser window opens with "๐Ÿงช TEST BROWSER" banner
440
+ - DevTools is already open to the Console tab
441
+ - When errors occur, the browser flashes red
442
+ - All their console.log() statements are captured
443
+ - They can debug using the actual browser they're testing in
444
+
445
+ ### Tips for Instructors/TAs:
446
+ 1. **Always emphasize**: Students must use the TEST BROWSER, not their regular browser
447
+ 2. **Common mistake**: Students open localhost:3000 in their regular Chrome - no logs captured!
448
+ 3. **Quick check**: Look for [BROWSER] prefix in logs to confirm they're using test browser
449
+ 4. **Teaching moment**: Show how server errors appear without [BROWSER] prefix
450
+ 5. **Debugging together**: The red flash makes it easy to spot when errors occur
451
+
452
+ ### 7. Simplified One-Click Workflow (v2.3.0) ๐ŸŽฏ
453
+ The new `dev_start_frontend_with_browser` combines steps 1 and 2 above into a single command:
454
+
455
+ ```typescript
456
+ // BEFORE (v2.2.0): Two separate commands
457
+ dev_start_log_streaming({ "command": "npm run dev", "processId": "student-app" })
458
+ // Wait for server to start...
459
+ dev_launch_test_browser({ "processId": "student-app" })
460
+
461
+ // NOW (v2.3.0): Single command does everything!
462
+ dev_start_frontend_with_browser({
463
+ "command": "npm run dev",
464
+ "processId": "student-project",
465
+ "teachingMode": true
466
+ })
467
+ // Server starts, waits for ready, then browser launches automatically!
468
+ ```
469
+
470
+ **Benefits for Students:**
471
+ - ๐Ÿš€ One command instead of two
472
+ - โฑ๏ธ No need to wait and guess when server is ready
473
+ - ๐ŸŽฏ Browser launches at the perfect time
474
+ - ๐Ÿ“ All logs in one place from the start
475
+ - ๐Ÿ”ง Less chance for mistakes
476
+
477
+ **Common Student Scenarios:**
478
+
479
+ ```typescript
480
+ // Scenario 1: React app on default port
481
+ dev_start_frontend_with_browser()
482
+ // That's it! Uses all smart defaults
483
+
484
+ // Scenario 2: Vite app with custom command
485
+ dev_start_frontend_with_browser({
486
+ "command": "npm run dev -- --host",
487
+ "processId": "vite-project"
488
+ })
489
+
490
+ // Scenario 3: Next.js on different port
491
+ dev_start_frontend_with_browser({
492
+ "command": "npm run dev",
493
+ "port": 3001, // If auto-detect fails
494
+ "env": { "PORT": "3001" }
495
+ })
496
+
497
+ // Scenario 4: Quick demo mode (no DevTools)
498
+ dev_start_frontend_with_browser({
499
+ "teachingMode": false // Faster, no DevTools
500
+ })
501
+ ```
502
+
291
503
  ## Troubleshooting
292
504
 
293
505
  ### Dev Server Not Starting