Socket
Book a DemoInstallSign in
Socket

@chinchillaenterprises/mcp-dev-logger

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chinchillaenterprises/mcp-dev-logger

MCP server for capturing and streaming development server output (npm run dev, etc.)

2.3.3
latest
Source
npmnpm
Version published
Weekly downloads
104
42.47%
Maintainers
4
Weekly downloads
ย 
Created
Source

MCP Dev Logger v2.3.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.).

๐ŸŽ‰ New in v2.3.3

  • Larger Default Viewport: Test browser now defaults to 1920x1080 (was 1280x800)
  • Modern Screen Support: Better for dashboard layouts, admin interfaces, and component showcases
  • Improved Development Experience: More realistic modern browser experience out of the box
  • Dev Tools Friendly: Adequate space for dev tools + content simultaneously

Previous Features (v2.3.2)

  • Fixed React Hydration Errors: Test browser banner now uses shadow DOM and waits for React hydration to complete
  • Hydration-Safe Banner: Banner injection no longer interferes with Next.js/React hydration process
  • Improved Stability: Better detection of React readiness before DOM modifications
  • Shadow DOM Isolation: Test browser banner completely isolated from application DOM

Previous Features (v2.3.1)

  • Enhanced Error Capture: Now captures JavaScript errors that don't trigger console.error, including:
    • React hydration errors
    • Unhandled promise rejections
    • Page-level JavaScript errors
    • Network request failures (4xx/5xx responses)
  • Visual Error Alerts: Red banner notification when JavaScript errors occur
  • Better Error Context: Full stack traces for all JavaScript errors

Previous Features (v2.3.0)

  • One-Click Student Workflow: New dev_start_frontend_with_browser tool that starts server AND launches browser automatically
  • Smart Port Detection: Automatically detects which port your dev server is using
  • Server Ready Detection: Waits for server to be fully ready before launching browser
  • Simplified Teaching: Reduces student setup from 3 commands to just 1

Previous Features (v2.2.0)

  • Browser Console Capture: Capture browser console.log, console.error, and other console outputs alongside server logs
  • Unified Log Stream: See both server-side and client-side logs in one place
  • Student-Friendly Browser: TEST BROWSER with visual indicators for teaching

Previous Features (v2.1.0)

  • Organized Log Structure: Logs are now organized by process type (frontend/backend/amplify/custom)
  • Automatic Cleanup: Keeps only the last 3 days of logs to prevent disk space issues
  • Improved File Naming: Cleaner log file names without redundant prefixes

Features

  • Universal Dev Server Logging: Works with any development server command
  • Browser Console Capture: Capture console.log, console.error, console.warn from the browser
  • Multi-Process Support: Run multiple dev servers simultaneously (frontend + backend)
  • Real-time Log Streaming: Capture build errors, TypeScript errors, hot reload events
  • Organized Log Storage: Structured as logs/YYYY-MM-DD/processType/logfile.log
  • Automatic Log Cleanup: Removes logs older than 3 days automatically
  • Smart Process Management: Start, stop, and restart individual dev servers by ID
  • Log Filtering: Search through logs with grep patterns
  • Framework Agnostic: One tool for all development servers
  • Auto-Generated Process IDs: Intelligent process ID generation based on command and output file
  • Process State Persistence: Maintains process state across server restarts (where possible)
  • Signal Handling: Proper cleanup with SIGTERM for graceful shutdowns
  • Unified Server + Browser Logs: See both frontend and backend logs in one stream

Installation

claude mcp add dev-logger -s user -- npx @chinchillaenterprises/mcp-dev-logger

For Development/Testing

# Clone and build locally
git clone <repository-url>
cd mcp-dev-logger
npm install
npm run build

# Add to Claude Code (local development)
claude mcp add dev-logger-local -s user -- node $(pwd)/dist/index.js

Tools Provided

Important Note: When using these tools through Claude Code's MCP integration, the tool names will be prefixed with mcp__dev-logger__. For example:

  • dev_start_log_streaming becomes mcp__dev-logger__dev_start_log_streaming
  • dev_tail_logs becomes mcp__dev-logger__dev_tail_logs
  • And so on for all tools

This prefix pattern applies to all MCP servers and helps Claude distinguish between different servers' tools.

1. dev_start_log_streaming

Start a development server and stream its output to a log file. Supports multiple concurrent processes.

Parameters:

  • command (optional): Dev command to run (default: "npm run dev")
  • outputFile (optional): File to write logs to (default: "dev-server-logs.txt")
  • processId (optional): Custom process ID (auto-generated if not provided)
  • cwd (optional): Working directory
  • env (optional): Environment variables to pass

Example:

{
  "command": "npm run dev",
  "outputFile": "frontend-logs.txt",
  "cwd": "/path/to/project",
  "env": {
    "PORT": "3001",
    "NODE_ENV": "development"
  }
}

2. dev_list_processes

List all running development processes with their status and details.

No parameters required.

3. dev_stop_log_streaming

Stop development server(s) and logging.

Parameters:

  • processId (optional): Process ID to stop (if not provided, stops all processes)

4. dev_restart_log_streaming

Restart a specific development server (useful when it crashes or hangs).

Parameters:

  • processId (required): Process ID to restart
  • clearLogs (optional): Whether to clear the log file on restart (default: false)

5. dev_get_status

Check if development server(s) are running and get their status.

Parameters:

  • processId (optional): Process ID to get status for (if not provided, shows all processes)

Returns:

  • Running status
  • Process ID(s)
  • PID(s)
  • Uptime
  • Current command(s)
  • Log file location(s)

6. dev_tail_logs

Get the last N lines from the log file.

Parameters:

  • processId (optional): Process ID to tail logs from (smart fallback for single process)
  • lines (optional): Number of lines to return (default: 50)
  • filter (optional): Grep pattern to filter logs

Example:

{
  "processId": "npm-frontend",
  "lines": 100,
  "filter": "ERROR"
}

7. dev_clear_logs

Clear the log file.

Parameters:

  • processId (optional): Process ID to clear logs for (smart fallback for single process)
  • backup (optional): Whether to backup logs before clearing (default: false)

8. dev_launch_test_browser

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.

Parameters:

  • processId (optional): Process ID to attach browser console to
  • browserUrl (optional): URL to open in test browser (default: http://localhost:3000)
  • teachingMode (optional): Enable teaching mode with DevTools open and slower actions (default: true)
  • viewport (optional): Browser window size (default: { width: 1280, height: 800 })
  • highlightErrors (optional): Add visual indicator when console errors occur (default: true)

Key Features:

  • ๐ŸชŸ Always visible browser window (not headless)
  • ๐Ÿ” DevTools automatically open in teaching mode
  • ๐ŸŒ Slower actions for easier teaching/learning
  • โšก Red flash on console errors
  • ๐Ÿ“ Green banner showing "TEST BROWSER" status
  • ๐ŸŽฏ All console logs captured to the same log file as server logs

Example:

{
  "processId": "npm-frontend",
  "browserUrl": "http://localhost:3000",
  "teachingMode": true,
  "highlightErrors": true
}

9. dev_stop_browser_console

Stop browser console capture for a specific process.

Parameters:

  • processId (optional): Process ID to stop browser console capture for

10. dev_start_frontend_with_browser ๐Ÿš€ NEW in v2.3.0!

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!

Parameters:

  • command (optional): Dev command to run (default: "npm run dev")
  • port (optional): Port to wait for (default: auto-detect from output)
  • waitTimeout (optional): Max time to wait for server in ms (default: 30000)
  • browserDelay (optional): Delay after server ready in ms (default: 1000)
  • teachingMode (optional): Enable teaching features (default: true)
  • processId (optional): Custom process ID (default: "frontend-with-browser")
  • env (optional): Environment variables
  • cwd (optional): Working directory

Key Features:

  • ๐ŸŽฏ Automatically detects when server is ready
  • ๐ŸชŸ Launches test browser with DevTools open
  • ๐Ÿ“ Captures both server AND browser console logs
  • โšก Red flash on browser errors
  • ๐Ÿงช Green "TEST BROWSER" banner
  • โฑ๏ธ Single command instead of multiple steps

Example:

{
  "command": "npm run dev",
  "teachingMode": true,
  "processId": "student-project"
}

Success Output:

โœ… Starting development server...
โœ… Server ready on http://localhost:3000
โœ… Launching test browser...

๐ŸŽฏ TEST BROWSER LAUNCHED!

๐Ÿ‘‰ Use the browser window that just opened (with green banner)
๐Ÿ“ All console logs are being saved
๐Ÿ” DevTools is open for debugging
โš ๏ธ  Errors will flash red on screen

Happy debugging! ๐Ÿš€

Usage Examples

Multi-Process Development (v2.0.0)

// Start frontend and backend simultaneously
dev_start_log_streaming({
  "command": "npm run dev",
  "outputFile": "frontend.log",
  "processId": "frontend"
})

dev_start_log_streaming({
  "command": "npx ampx sandbox --stream-function-logs",
  "outputFile": "backend.log", 
  "processId": "backend"
})

// List all running processes
dev_list_processes()

// Stop just the frontend
dev_stop_log_streaming({ "processId": "frontend" })

// Restart backend with clean logs
dev_restart_log_streaming({ 
  "processId": "backend", 
  "clearLogs": true 
})

Start Next.js Development Server

// Start Next.js dev server
{
  "command": "npm run dev",
  "outputFile": "nextjs-dev.log"
}

Monitor Vite Dev Server

// Start Vite with custom port
{
  "command": "vite --port 3001",
  "outputFile": "vite-dev.log",
  "env": {
    "NODE_ENV": "development"
  }
}

Check for TypeScript Errors

// Tail logs filtering for TypeScript errors
{
  "lines": 200,
  "filter": "TS\\d+"
}

Debug Build Errors

// Get recent errors from build process
{
  "lines": 100,
  "filter": "ERROR|FAILED|error"
}

Log Organization (v2.1.0+)

Logs are organized in a structured directory hierarchy:

logs/
โ”œโ”€โ”€ 2025-07-10/              # Date folder (YYYY-MM-DD)
โ”‚   โ”œโ”€โ”€ frontend/            # Process type folder
โ”‚   โ”‚   โ”œโ”€โ”€ nextjs-14-32-15.log
โ”‚   โ”‚   โ””โ”€โ”€ vite-16-45-22.log
โ”‚   โ”œโ”€โ”€ backend/
โ”‚   โ”‚   โ”œโ”€โ”€ express-14-33-01.log
โ”‚   โ”‚   โ””โ”€โ”€ api-15-22-11.log
โ”‚   โ””โ”€โ”€ amplify/
โ”‚       โ””โ”€โ”€ sandbox-14-35-22.log
โ””โ”€โ”€ 2025-07-09/              # Older logs (auto-removed after 3 days)
    โ””โ”€โ”€ ...

Log Format

Logs are written with timestamps, process IDs, and error markers. Browser console logs are prefixed with [BROWSER]:

[2024-01-15T10:30:45.123Z] Starting: npm run dev (Process ID: npm-frontend)
[2024-01-15T10:30:46.456Z] [npm-frontend] > my-app@1.0.0 dev
[2024-01-15T10:30:46.457Z] [npm-frontend] > next dev
[2024-01-15T10:30:47.123Z] [npm-frontend] โ–ฒ Next.js 14.0.0
[2024-01-15T10:30:47.124Z] [npm-frontend] - Local: http://localhost:3000
[2024-01-15T10:30:48.789Z] [npm-frontend] [ERROR] Error: Cannot find module './components/Header'
[2024-01-15T10:30:49.123Z] [npm-frontend] [BROWSER] Console capture started for http://localhost:3000
[2024-01-15T10:30:49.456Z] [npm-frontend] [BROWSER] [LOG] React DevTools detected
[2024-01-15T10:30:49.789Z] [npm-frontend] [BROWSER] [WARN] React: Each child should have a unique key prop
[2024-01-15T10:30:50.123Z] [npm-frontend] [BROWSER] [ERROR] Failed to fetch /api/user: 404 Not Found
[2024-01-15T10:30:50.456Z] [npm-frontend] [BROWSER] [LOG] { user: null, loading: false }

[2024-01-15T10:30:50.123Z] Starting: npx ampx sandbox --stream-function-logs (Process ID: npx-backend)
[2024-01-15T10:30:51.456Z] [npx-backend] [INFO] Amplify sandbox starting...
[2024-01-15T10:30:52.123Z] [npx-backend] Process exited with code 0 and signal null

Process ID Generation

The server automatically generates intelligent process IDs based on the command and output file:

  • Command: npm run dev + Output: frontend.log โ†’ Process ID: npm-frontend
  • Command: npx ampx sandbox --stream-function-logs + Output: backend.log โ†’ Process ID: npx-backend
  • Duplicate IDs are automatically suffixed with -1, -2, etc.

Common Use Cases

1. Debugging Build Failures

# Start dev server
dev_start_log_streaming

# When build fails, check recent errors
dev_tail_logs { "filter": "ERROR", "lines": 100 }

2. Monitoring TypeScript Compilation

# Start with TypeScript focus
dev_start_log_streaming { "command": "npm run dev", "outputFile": "ts-errors.log" }

# Check for TS errors
dev_tail_logs { "filter": "TS\\d+|typescript", "lines": 50 }

3. Port Conflicts

# Start on different port
dev_start_log_streaming {
  "command": "npm run dev",
  "env": { "PORT": "3001" }
}

4. Clean Restart After Crash

# Restart and clear old logs
dev_restart_log_streaming { "clearLogs": true }

5. Amplify Development Workflow

# Start Amplify backend logging
dev_start_log_streaming {
  "command": "npx ampx sandbox --stream-function-logs",
  "outputFile": "backend-logs.txt",
  "processId": "amplify-backend"
}

# Monitor Lambda function logs
dev_tail_logs { "processId": "amplify-backend", "filter": "ERROR|WARN", "lines": 100 }

6. Student Testing Workflow (v2.2.0)

// Step 1: Start the student's dev server
dev_start_log_streaming({
  "command": "npm run dev",
  "processId": "student-app"
})

// Step 2: Launch the TEST BROWSER for the student
dev_launch_test_browser({
  "processId": "student-app",
  "browserUrl": "http://localhost:3000",
  "teachingMode": true  // DevTools open, slower actions
})

// Step 3: Tell student: "Use the TEST BROWSER window that just opened!"
// They click buttons, fill forms, trigger errors - ALL console logs are captured

// Step 4: When student says "I clicked submit and nothing happened"
dev_tail_logs({ 
  "processId": "student-app", 
  "filter": "\\[BROWSER\\].*\\[ERROR\\]", 
  "lines": 20 
})
// Shows: [BROWSER] [ERROR] Cannot read property 'name' of undefined

// Step 5: Show all browser activity
dev_tail_logs({ 
  "processId": "student-app", 
  "filter": "\\[BROWSER\\]", 
  "lines": 50 
})

// Step 6: When done testing
dev_stop_browser_console({ "processId": "student-app" })

What Students See:

  • A browser window opens with "๐Ÿงช TEST BROWSER" banner
  • DevTools is already open to the Console tab
  • When errors occur, the browser flashes red
  • All their console.log() statements are captured
  • They can debug using the actual browser they're testing in

Tips for Instructors/TAs:

  • Always emphasize: Students must use the TEST BROWSER, not their regular browser
  • Common mistake: Students open localhost:3000 in their regular Chrome - no logs captured!
  • Quick check: Look for [BROWSER] prefix in logs to confirm they're using test browser
  • Teaching moment: Show how server errors appear without [BROWSER] prefix
  • Debugging together: The red flash makes it easy to spot when errors occur

7. Simplified One-Click Workflow (v2.3.0) ๐ŸŽฏ

The new dev_start_frontend_with_browser combines steps 1 and 2 above into a single command:

// BEFORE (v2.2.0): Two separate commands
dev_start_log_streaming({ "command": "npm run dev", "processId": "student-app" })
// Wait for server to start...
dev_launch_test_browser({ "processId": "student-app" })

// NOW (v2.3.0): Single command does everything!
dev_start_frontend_with_browser({
  "command": "npm run dev",
  "processId": "student-project",
  "teachingMode": true
})
// Server starts, waits for ready, then browser launches automatically!

Benefits for Students:

  • ๐Ÿš€ One command instead of two
  • โฑ๏ธ No need to wait and guess when server is ready
  • ๐ŸŽฏ Browser launches at the perfect time
  • ๐Ÿ“ All logs in one place from the start
  • ๐Ÿ”ง Less chance for mistakes

Common Student Scenarios:

// Scenario 1: React app on default port
dev_start_frontend_with_browser()
// That's it! Uses all smart defaults

// Scenario 2: Vite app with custom command
dev_start_frontend_with_browser({
  "command": "npm run dev -- --host",
  "processId": "vite-project"
})

// Scenario 3: Next.js on different port
dev_start_frontend_with_browser({
  "command": "npm run dev",
  "port": 3001,  // If auto-detect fails
  "env": { "PORT": "3001" }
})

// Scenario 4: Quick demo mode (no DevTools)
dev_start_frontend_with_browser({
  "teachingMode": false  // Faster, no DevTools
})

Troubleshooting

Dev Server Not Starting

  • Check the log file for error messages
  • Verify the command works when run directly in terminal
  • Check working directory is correct
  • Ensure all dependencies are installed

Logs Not Appearing

  • Check the output file path is writable
  • Some frameworks buffer output - logs may appear in chunks
  • Use dev_get_status to verify server is running

Process Won't Stop

  • Use dev_stop_log_streaming first
  • If that fails, the process may have crashed - check system process manager
  • Restart Claude Code to clean up orphaned processes

Implementation Details

Process Management

  • Uses Node.js spawn with detached: true for proper process isolation
  • Implements graceful shutdown with SIGTERM signals
  • Automatically removes event listeners on process termination to prevent memory leaks
  • Attempts to kill process groups (-pid) to handle child processes

State Persistence

  • Saves process state to ${tmpdir}/mcp-dev-logger.json
  • Restores process information on server restart (where possible)
  • Handles process cleanup on server shutdown

Log Streaming

  • Real-time streaming of both stdout and stderr
  • Timestamped log entries with process ID tagging
  • Error entries are clearly marked with [ERROR] prefix
  • Supports concurrent logging from multiple processes to different files

Limitations

  • Process management is best-effort - some processes may not respond to signals
  • Very large log files may impact performance of dev_tail_logs
  • Only captures server-side console output (not browser console logs)
  • Process state restoration is limited after server restarts (PIDs become invalid)

Development

Building

npm run build

Watch Mode

npm run dev

Testing

# Test with local installation
claude mcp add dev-logger-test -s user -- node $(pwd)/dist/index.js

# Start Claude and test tools
claude
> /mcp  # Check if server is connected

Contributing

  • Fork the repository
  • Create feature branch
  • Make changes and test thoroughly
  • Submit pull request with clear description

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  • Open an issue in the repository
  • Check existing issues for similar problems
  • Include log samples when reporting bugs

Keywords

mcp

FAQs

Package last updated on 23 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.