@chinchillaenterprises/mcp-dev-logger 2.0.2 โ†’ 2.3.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.
package/README.md CHANGED
@@ -1,19 +1,41 @@
1
- # MCP Dev Logger
1
+ # MCP Dev Logger v2.3.0
2
2
 
3
- A Model Context Protocol (MCP) server for capturing and streaming development server output. 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
+
5
+ ## ๐ŸŽ‰ New in v2.3.0
6
+
7
+ - **One-Click Student Workflow**: New `dev_start_frontend_with_browser` tool that starts server AND launches browser automatically
8
+ - **Smart Port Detection**: Automatically detects which port your dev server is using
9
+ - **Server Ready Detection**: Waits for server to be fully ready before launching browser
10
+ - **Simplified Teaching**: Reduces student setup from 3 commands to just 1
11
+
12
+ ## Previous Features (v2.2.0)
13
+
14
+ - **Browser Console Capture**: Capture browser console.log, console.error, and other console outputs alongside server logs
15
+ - **Unified Log Stream**: See both server-side and client-side logs in one place
16
+ - **Student-Friendly Browser**: TEST BROWSER with visual indicators for teaching
17
+
18
+ ## Previous Features (v2.1.0)
19
+
20
+ - **Organized Log Structure**: Logs are now organized by process type (frontend/backend/amplify/custom)
21
+ - **Automatic Cleanup**: Keeps only the last 3 days of logs to prevent disk space issues
22
+ - **Improved File Naming**: Cleaner log file names without redundant prefixes
4
23
 
5
24
  ## Features
6
25
 
7
26
  - **Universal Dev Server Logging**: Works with any development server command
27
+ - **Browser Console Capture**: Capture console.log, console.error, console.warn from the browser
8
28
  - **Multi-Process Support**: Run multiple dev servers simultaneously (frontend + backend)
9
29
  - **Real-time Log Streaming**: Capture build errors, TypeScript errors, hot reload events
10
- - **Persistent Logs**: All output saved to file for historical debugging
30
+ - **Organized Log Storage**: Structured as `logs/YYYY-MM-DD/processType/logfile.log`
31
+ - **Automatic Log Cleanup**: Removes logs older than 3 days automatically
11
32
  - **Smart Process Management**: Start, stop, and restart individual dev servers by ID
12
33
  - **Log Filtering**: Search through logs with grep patterns
13
34
  - **Framework Agnostic**: One tool for all development servers
14
35
  - **Auto-Generated Process IDs**: Intelligent process ID generation based on command and output file
15
36
  - **Process State Persistence**: Maintains process state across server restarts (where possible)
16
37
  - **Signal Handling**: Proper cleanup with SIGTERM for graceful shutdowns
38
+ - **Unified Server + Browser Logs**: See both frontend and backend logs in one stream
17
39
 
18
40
  ## Installation
19
41
 
@@ -122,6 +144,86 @@ Clear the log file.
122
144
  - `processId` (optional): Process ID to clear logs for (smart fallback for single process)
123
145
  - `backup` (optional): Whether to backup logs before clearing (default: false)
124
146
 
147
+ ### 8. dev_launch_test_browser
148
+ 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.
149
+
150
+ **Parameters:**
151
+ - `processId` (optional): Process ID to attach browser console to
152
+ - `browserUrl` (optional): URL to open in test browser (default: http://localhost:3000)
153
+ - `teachingMode` (optional): Enable teaching mode with DevTools open and slower actions (default: true)
154
+ - `viewport` (optional): Browser window size (default: { width: 1280, height: 800 })
155
+ - `highlightErrors` (optional): Add visual indicator when console errors occur (default: true)
156
+
157
+ **Key Features:**
158
+ - ๐ŸชŸ Always visible browser window (not headless)
159
+ - ๐Ÿ” DevTools automatically open in teaching mode
160
+ - ๐ŸŒ Slower actions for easier teaching/learning
161
+ - โšก Red flash on console errors
162
+ - ๐Ÿ“ Green banner showing "TEST BROWSER" status
163
+ - ๐ŸŽฏ All console logs captured to the same log file as server logs
164
+
165
+ **Example:**
166
+ ```json
167
+ {
168
+ "processId": "npm-frontend",
169
+ "browserUrl": "http://localhost:3000",
170
+ "teachingMode": true,
171
+ "highlightErrors": true
172
+ }
173
+ ```
174
+
175
+ ### 9. dev_stop_browser_console
176
+ Stop browser console capture for a specific process.
177
+
178
+ **Parameters:**
179
+ - `processId` (optional): Process ID to stop browser console capture for
180
+
181
+ ### 10. dev_start_frontend_with_browser ๐Ÿš€ NEW in v2.3.0!
182
+ **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!
183
+
184
+ **Parameters:**
185
+ - `command` (optional): Dev command to run (default: "npm run dev")
186
+ - `port` (optional): Port to wait for (default: auto-detect from output)
187
+ - `waitTimeout` (optional): Max time to wait for server in ms (default: 30000)
188
+ - `browserDelay` (optional): Delay after server ready in ms (default: 1000)
189
+ - `teachingMode` (optional): Enable teaching features (default: true)
190
+ - `processId` (optional): Custom process ID (default: "frontend-with-browser")
191
+ - `env` (optional): Environment variables
192
+ - `cwd` (optional): Working directory
193
+
194
+ **Key Features:**
195
+ - ๐ŸŽฏ Automatically detects when server is ready
196
+ - ๐ŸชŸ Launches test browser with DevTools open
197
+ - ๐Ÿ“ Captures both server AND browser console logs
198
+ - โšก Red flash on browser errors
199
+ - ๐Ÿงช Green "TEST BROWSER" banner
200
+ - โฑ๏ธ Single command instead of multiple steps
201
+
202
+ **Example:**
203
+ ```json
204
+ {
205
+ "command": "npm run dev",
206
+ "teachingMode": true,
207
+ "processId": "student-project"
208
+ }
209
+ ```
210
+
211
+ **Success Output:**
212
+ ```
213
+ โœ… Starting development server...
214
+ โœ… Server ready on http://localhost:3000
215
+ โœ… Launching test browser...
216
+
217
+ ๐ŸŽฏ TEST BROWSER LAUNCHED!
218
+
219
+ ๐Ÿ‘‰ Use the browser window that just opened (with green banner)
220
+ ๐Ÿ“ All console logs are being saved
221
+ ๐Ÿ” DevTools is open for debugging
222
+ โš ๏ธ Errors will flash red on screen
223
+
224
+ Happy debugging! ๐Ÿš€
225
+ ```
226
+
125
227
  ## Usage Examples
126
228
 
127
229
  ### Multi-Process Development (v2.0.0)
@@ -191,9 +293,28 @@ dev_restart_log_streaming({
191
293
  }
192
294
  ```
193
295
 
296
+ ## Log Organization (v2.1.0+)
297
+
298
+ Logs are organized in a structured directory hierarchy:
299
+
300
+ ```
301
+ logs/
302
+ โ”œโ”€โ”€ 2025-07-10/ # Date folder (YYYY-MM-DD)
303
+ โ”‚ โ”œโ”€โ”€ frontend/ # Process type folder
304
+ โ”‚ โ”‚ โ”œโ”€โ”€ nextjs-14-32-15.log
305
+ โ”‚ โ”‚ โ””โ”€โ”€ vite-16-45-22.log
306
+ โ”‚ โ”œโ”€โ”€ backend/
307
+ โ”‚ โ”‚ โ”œโ”€โ”€ express-14-33-01.log
308
+ โ”‚ โ”‚ โ””โ”€โ”€ api-15-22-11.log
309
+ โ”‚ โ””โ”€โ”€ amplify/
310
+ โ”‚ โ””โ”€โ”€ sandbox-14-35-22.log
311
+ โ””โ”€โ”€ 2025-07-09/ # Older logs (auto-removed after 3 days)
312
+ โ””โ”€โ”€ ...
313
+ ```
314
+
194
315
  ## Log Format
195
316
 
196
- Logs are written with timestamps, process IDs, and error markers:
317
+ Logs are written with timestamps, process IDs, and error markers. Browser console logs are prefixed with [BROWSER]:
197
318
 
198
319
  ```
199
320
  [2024-01-15T10:30:45.123Z] Starting: npm run dev (Process ID: npm-frontend)
@@ -202,6 +323,11 @@ Logs are written with timestamps, process IDs, and error markers:
202
323
  [2024-01-15T10:30:47.123Z] [npm-frontend] โ–ฒ Next.js 14.0.0
203
324
  [2024-01-15T10:30:47.124Z] [npm-frontend] - Local: http://localhost:3000
204
325
  [2024-01-15T10:30:48.789Z] [npm-frontend] [ERROR] Error: Cannot find module './components/Header'
326
+ [2024-01-15T10:30:49.123Z] [npm-frontend] [BROWSER] Console capture started for http://localhost:3000
327
+ [2024-01-15T10:30:49.456Z] [npm-frontend] [BROWSER] [LOG] React DevTools detected
328
+ [2024-01-15T10:30:49.789Z] [npm-frontend] [BROWSER] [WARN] React: Each child should have a unique key prop
329
+ [2024-01-15T10:30:50.123Z] [npm-frontend] [BROWSER] [ERROR] Failed to fetch /api/user: 404 Not Found
330
+ [2024-01-15T10:30:50.456Z] [npm-frontend] [BROWSER] [LOG] { user: null, loading: false }
205
331
 
206
332
  [2024-01-15T10:30:50.123Z] Starting: npx ampx sandbox --stream-function-logs (Process ID: npx-backend)
207
333
  [2024-01-15T10:30:51.456Z] [npx-backend] [INFO] Amplify sandbox starting...
@@ -262,6 +388,108 @@ dev_start_log_streaming {
262
388
  dev_tail_logs { "processId": "amplify-backend", "filter": "ERROR|WARN", "lines": 100 }
263
389
  ```
264
390
 
391
+ ### 6. Student Testing Workflow (v2.2.0)
392
+ ```typescript
393
+ // Step 1: Start the student's dev server
394
+ dev_start_log_streaming({
395
+ "command": "npm run dev",
396
+ "processId": "student-app"
397
+ })
398
+
399
+ // Step 2: Launch the TEST BROWSER for the student
400
+ dev_launch_test_browser({
401
+ "processId": "student-app",
402
+ "browserUrl": "http://localhost:3000",
403
+ "teachingMode": true // DevTools open, slower actions
404
+ })
405
+
406
+ // Step 3: Tell student: "Use the TEST BROWSER window that just opened!"
407
+ // They click buttons, fill forms, trigger errors - ALL console logs are captured
408
+
409
+ // Step 4: When student says "I clicked submit and nothing happened"
410
+ dev_tail_logs({
411
+ "processId": "student-app",
412
+ "filter": "\\[BROWSER\\].*\\[ERROR\\]",
413
+ "lines": 20
414
+ })
415
+ // Shows: [BROWSER] [ERROR] Cannot read property 'name' of undefined
416
+
417
+ // Step 5: Show all browser activity
418
+ dev_tail_logs({
419
+ "processId": "student-app",
420
+ "filter": "\\[BROWSER\\]",
421
+ "lines": 50
422
+ })
423
+
424
+ // Step 6: When done testing
425
+ dev_stop_browser_console({ "processId": "student-app" })
426
+ ```
427
+
428
+ **What Students See:**
429
+ - A browser window opens with "๐Ÿงช TEST BROWSER" banner
430
+ - DevTools is already open to the Console tab
431
+ - When errors occur, the browser flashes red
432
+ - All their console.log() statements are captured
433
+ - They can debug using the actual browser they're testing in
434
+
435
+ ### Tips for Instructors/TAs:
436
+ 1. **Always emphasize**: Students must use the TEST BROWSER, not their regular browser
437
+ 2. **Common mistake**: Students open localhost:3000 in their regular Chrome - no logs captured!
438
+ 3. **Quick check**: Look for [BROWSER] prefix in logs to confirm they're using test browser
439
+ 4. **Teaching moment**: Show how server errors appear without [BROWSER] prefix
440
+ 5. **Debugging together**: The red flash makes it easy to spot when errors occur
441
+
442
+ ### 7. Simplified One-Click Workflow (v2.3.0) ๐ŸŽฏ
443
+ The new `dev_start_frontend_with_browser` combines steps 1 and 2 above into a single command:
444
+
445
+ ```typescript
446
+ // BEFORE (v2.2.0): Two separate commands
447
+ dev_start_log_streaming({ "command": "npm run dev", "processId": "student-app" })
448
+ // Wait for server to start...
449
+ dev_launch_test_browser({ "processId": "student-app" })
450
+
451
+ // NOW (v2.3.0): Single command does everything!
452
+ dev_start_frontend_with_browser({
453
+ "command": "npm run dev",
454
+ "processId": "student-project",
455
+ "teachingMode": true
456
+ })
457
+ // Server starts, waits for ready, then browser launches automatically!
458
+ ```
459
+
460
+ **Benefits for Students:**
461
+ - ๐Ÿš€ One command instead of two
462
+ - โฑ๏ธ No need to wait and guess when server is ready
463
+ - ๐ŸŽฏ Browser launches at the perfect time
464
+ - ๐Ÿ“ All logs in one place from the start
465
+ - ๐Ÿ”ง Less chance for mistakes
466
+
467
+ **Common Student Scenarios:**
468
+
469
+ ```typescript
470
+ // Scenario 1: React app on default port
471
+ dev_start_frontend_with_browser()
472
+ // That's it! Uses all smart defaults
473
+
474
+ // Scenario 2: Vite app with custom command
475
+ dev_start_frontend_with_browser({
476
+ "command": "npm run dev -- --host",
477
+ "processId": "vite-project"
478
+ })
479
+
480
+ // Scenario 3: Next.js on different port
481
+ dev_start_frontend_with_browser({
482
+ "command": "npm run dev",
483
+ "port": 3001, // If auto-detect fails
484
+ "env": { "PORT": "3001" }
485
+ })
486
+
487
+ // Scenario 4: Quick demo mode (no DevTools)
488
+ dev_start_frontend_with_browser({
489
+ "teachingMode": false // Faster, no DevTools
490
+ })
491
+ ```
492
+
265
493
  ## Troubleshooting
266
494
 
267
495
  ### Dev Server Not Starting