@dynamicu/chromedebug-mcp 2.5.0 → 2.5.4

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
@@ -40,24 +40,52 @@ The MCP server will automatically start both the stdio MCP server and HTTP serve
40
40
 
41
41
  #### Windows
42
42
 
43
- On Windows, the MCP server and HTTP server should be run separately for best reliability:
43
+ ⚠️ **Important: WSL2 Recommended for Windows Users**
44
44
 
45
- **Step 1: Add MCP Server for Claude Code**
46
- ```bash
47
- claude mcp add chromedebug -s user -- cmd /c chromedebug-mcp
48
- ```
45
+ ChromeDebug MCP uses stdio-based communication which works best on Unix systems. For Windows users, we **strongly recommend using WSL2** for full compatibility.
49
46
 
50
- **Step 2: Start HTTP Server for Chrome Extension (separate terminal)**
51
- ```bash
52
- chromedebug-mcp-server
53
- ```
47
+ **WSL2 Setup (5 minutes):**
48
+
49
+ 1. **Install WSL2** (PowerShell as Administrator):
50
+ ```powershell
51
+ wsl --install
52
+ ```
53
+
54
+ 2. **Restart your computer**
54
55
 
55
- **Why Separate?** On Windows, the stdio-based MCP server (for Claude Code) works best when running independently from the HTTP server (for Chrome extension). This separation provides better stability and prevents connection issues.
56
+ 3. **Open WSL terminal** and install Node.js:
57
+ ```bash
58
+ sudo apt update
59
+ sudo apt install nodejs npm -y
60
+ ```
61
+
62
+ 4. **Install ChromeDebug in WSL**:
63
+ ```bash
64
+ npm install -g @dynamicu/chromedebug-mcp
65
+ ```
66
+
67
+ 5. **Configure Claude Code** to use WSL:
68
+ ```bash
69
+ claude mcp add chromedebug -s user -- wsl chromedebug-mcp
70
+ ```
71
+
72
+ 6. **Verify it works**:
73
+ ```bash
74
+ claude mcp list
75
+ # Should show: chromedebug: wsl chromedebug-mcp - ✓ Connected
76
+ ```
77
+
78
+ **Alternative: Native Windows (Limited Support)**
79
+
80
+ If you cannot use WSL2, you can force native Windows mode, but stdio communication may be unreliable:
81
+
82
+ ```powershell
83
+ # Set environment variable to enable native Windows mode
84
+ set CHROMEDEBUG_FORCE_WINDOWS=1
85
+ chromedebug-mcp --help
86
+ ```
56
87
 
57
- **Note for Windows Users:**
58
- - Process cleanup is currently limited on Windows. The server will start successfully but won't clean up orphaned processes from previous sessions.
59
- - If you only need Claude Code integration (no Chrome extension), the MCP server alone is sufficient.
60
- - If you need the Chrome extension, run both servers in separate terminal windows.
88
+ **Note:** Native Windows may experience stdio communication issues due to cmd.exe limitations. WSL2 is strongly recommended for the best experience.
61
89
 
62
90
  ### Standalone HTTP Server (New in v2.4.3)
63
91
 
@@ -64,7 +64,7 @@ const CHROMEDEBUG_CONFIG = {
64
64
  3027
65
65
  ],
66
66
  discoveryTimeout: 3000,
67
- lastGenerated: '2025-10-01T22:12:24.724Z'
67
+ lastGenerated: '2025-10-17T23:32:00.030Z'
68
68
  };
69
69
 
70
70
  // Export for use in extension scripts
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamicu/chromedebug-mcp",
3
- "version": "2.5.0",
3
+ "version": "2.5.4",
4
4
  "description": "ChromeDebug MCP - MCP server that provides full control over a Chrome browser instance for debugging and automation with AI assistants like Claude Code",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "chromedebug-mcp": "./src/index.js",
8
+ "chromedebug-mcp": "./src/cli.js",
9
9
  "chromedebug-mcp-server": "./src/standalone-server.js"
10
10
  },
11
11
  "publishConfig": {
@@ -116,7 +116,7 @@
116
116
  "joi": "^18.0.0",
117
117
  "jsonwebtoken": "^9.0.2",
118
118
  "multer": "^2.0.2",
119
- "puppeteer": "^23.10.0",
119
+ "puppeteer": "^24.25.0",
120
120
  "uuid": "^11.1.0",
121
121
  "web-vitals": "^5.1.0",
122
122
  "ws": "^8.16.0"
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Windows MCP Diagnostic Tool
5
+ * Helps identify why ChromeDebug MCP may not work on Windows
6
+ */
7
+
8
+ console.error('=== ChromeDebug Windows Diagnostic ===\n');
9
+
10
+ // Test 1: Environment
11
+ console.error('1. Environment Check:');
12
+ console.error(' Platform:', process.platform);
13
+ console.error(' Node Version:', process.version);
14
+ console.error(' argv[0]:', process.argv[0]);
15
+ console.error(' argv[1]:', process.argv[1]);
16
+ console.error(' CWD:', process.cwd());
17
+ console.error(' WSL:', process.env.WSL_DISTRO_NAME || 'No (native Windows)');
18
+ console.error(' Force Windows:', process.env.CHROMEDEBUG_FORCE_WINDOWS || 'No');
19
+ console.error('');
20
+
21
+ // Test 2: Module Detection
22
+ console.error('2. Module Detection:');
23
+ console.error(' import.meta.url:', import.meta.url);
24
+ console.error('');
25
+
26
+ // Test 3: Stdio Check
27
+ console.error('3. Stdio Configuration:');
28
+ console.error(' stdin.isTTY:', process.stdin.isTTY);
29
+ console.error(' stdout.isTTY:', process.stdout.isTTY);
30
+ console.error(' stderr.isTTY:', process.stderr.isTTY);
31
+ console.error('');
32
+
33
+ // Test 4: Recommendations
34
+ console.error('4. Recommendations:');
35
+ if (process.platform === 'win32' && !process.env.WSL_DISTRO_NAME) {
36
+ console.error(' ⚠️ Running on native Windows');
37
+ console.error(' ✓ Recommended: Install WSL2 for best compatibility');
38
+ console.error(' ✓ Quick setup: wsl --install');
39
+ console.error(' ✓ After WSL2: npm install -g @dynamicu/chromedebug-mcp');
40
+ console.error(' ✓ Configure Claude: claude mcp add chromedebug -s user -- wsl chromedebug-mcp');
41
+ } else if (process.env.WSL_DISTRO_NAME) {
42
+ console.error(' ✅ Running in WSL2 - Full compatibility available');
43
+ } else {
44
+ console.error(' ✅ Running on Unix-based system - Full compatibility available');
45
+ }
46
+ console.error('');
47
+
48
+ console.error('For more information:');
49
+ console.error(' https://github.com/dynamicupgrade/ChromeDebug#windows-setup');
50
+ console.error('');
51
+
52
+ // Exit successfully
53
+ process.exit(0);
package/src/cli.js ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Chrome Debug MCP Server - CLI Entry Point
5
+ *
6
+ * This file should only be executed directly as a CLI command.
7
+ * For library usage, import ChromePilotApp from './index.js'
8
+ *
9
+ * This separation ensures that importing the package as a library
10
+ * won't accidentally launch Chrome or start servers.
11
+ */
12
+
13
+ import { ChromePilotApp } from './index.js';
14
+ import {
15
+ initializeSessionManager,
16
+ getSessionInfo,
17
+ registerProcess,
18
+ findActiveSessions
19
+ } from './services/unified-session-manager.js';
20
+ import logger from './utils/logger.js';
21
+
22
+ /**
23
+ * Main CLI entry point
24
+ */
25
+ async function main() {
26
+ const app = new ChromePilotApp();
27
+
28
+ // Parse arguments first to get session settings
29
+ const args = app.parseArguments();
30
+
31
+ // Detect Windows and provide WSL2 guidance
32
+ if (process.platform === 'win32' && !process.env.WSL_DISTRO_NAME && !process.env.CHROMEDEBUG_FORCE_WINDOWS) {
33
+ console.error(`
34
+ ⚠️ ChromeDebug MCP runs best on Unix-based systems.
35
+
36
+ Windows users have two options:
37
+
38
+ 1. WSL2 (RECOMMENDED - Full Compatibility):
39
+ • Install WSL2: Run in PowerShell as Admin:
40
+ wsl --install
41
+ • Restart your computer
42
+ • Inside WSL, install Node.js:
43
+ sudo apt update && sudo apt install nodejs npm
44
+ • Install ChromeDebug in WSL:
45
+ npm install -g @dynamicu/chromedebug-mcp
46
+ • Configure Claude to use WSL:
47
+ claude mcp add chromedebug -s user -- wsl chromedebug-mcp
48
+
49
+ 2. Native Windows (LIMITED - May have stdio issues):
50
+ • Set: set CHROMEDEBUG_FORCE_WINDOWS=1
51
+ • Then run: chromedebug-mcp
52
+ • Note: MCP stdio communication may fail due to cmd.exe limitations
53
+
54
+ For details: https://github.com/dynamicupgrade/ChromeDebug#windows-setup
55
+ `);
56
+ process.exit(1);
57
+ }
58
+
59
+ try {
60
+ // Initialize unified session manager with options
61
+ const sessionManager = await initializeSessionManager({
62
+ sessionId: args.sessionId,
63
+ skipCleanup: args.noCleanup,
64
+ verbose: args.verbose
65
+ });
66
+
67
+ // Register this process for tracking
68
+ await registerProcess(process.pid, 'mcp-server');
69
+
70
+ // Log session information if verbose
71
+ if (args.verbose) {
72
+ const sessionInfo = getSessionInfo();
73
+ logger.debug('Session Information:');
74
+ logger.debug(` Session ID: ${sessionInfo.sessionId}`);
75
+ logger.debug(` PID: ${sessionInfo.pid}`);
76
+ logger.debug(` Port: ${sessionInfo.port}`);
77
+ logger.debug(` Session File: ${sessionInfo.sessionFile}`);
78
+
79
+ // Show other active sessions
80
+ const activeSessions = await findActiveSessions();
81
+ if (activeSessions.length > 1) {
82
+ logger.debug(` Other active sessions: ${activeSessions.length - 1}`);
83
+ activeSessions.filter(s => s.sessionId !== sessionInfo.sessionId).forEach(session => {
84
+ logger.debug(` - ${session.sessionId} (PID: ${session.pid}, Port: ${session.port})`);
85
+ });
86
+ }
87
+ }
88
+
89
+ // Pass session manager to app
90
+ app.sessionManager = sessionManager;
91
+
92
+ await app.start();
93
+ } catch (error) {
94
+ logger.error('Fatal error starting Chrome Debug:', error);
95
+ process.exit(1);
96
+ }
97
+ }
98
+
99
+ // Handle graceful shutdown
100
+ process.on('SIGINT', async () => {
101
+ logger.info('Received SIGINT, shutting down gracefully...');
102
+ process.exit(0);
103
+ });
104
+
105
+ process.on('SIGTERM', async () => {
106
+ logger.info('Received SIGTERM, shutting down gracefully...');
107
+ process.exit(0);
108
+ });
109
+
110
+ // Always run main in CLI context
111
+ main().catch((error) => {
112
+ logger.error('Unhandled error:', error);
113
+ process.exit(1);
114
+ });
package/src/index.js CHANGED
@@ -254,73 +254,6 @@ For more information, see the documentation in CLAUDE.md
254
254
  }
255
255
  }
256
256
 
257
- /**
258
- * Main entry point
259
- */
260
- async function main() {
261
- const app = new ChromePilotApp();
262
-
263
- // Parse arguments first to get session settings
264
- const args = app.parseArguments();
265
-
266
- try {
267
- // Initialize unified session manager with options
268
- const sessionManager = await initializeSessionManager({
269
- sessionId: args.sessionId,
270
- skipCleanup: args.noCleanup,
271
- verbose: args.verbose
272
- });
273
-
274
- // Register this process for tracking
275
- await registerProcess(process.pid, 'mcp-server');
276
-
277
- // Log session information if verbose
278
- if (args.verbose) {
279
- const sessionInfo = getSessionInfo();
280
- logger.debug('Session Information:');
281
- logger.debug(` Session ID: ${sessionInfo.sessionId}`);
282
- logger.debug(` PID: ${sessionInfo.pid}`);
283
- logger.debug(` Port: ${sessionInfo.port}`);
284
- logger.debug(` Session File: ${sessionInfo.sessionFile}`);
285
-
286
- // Show other active sessions
287
- const activeSessions = await findActiveSessions();
288
- if (activeSessions.length > 1) {
289
- logger.debug(` Other active sessions: ${activeSessions.length - 1}`);
290
- activeSessions.filter(s => s.sessionId !== sessionInfo.sessionId).forEach(session => {
291
- logger.debug(` - ${session.sessionId} (PID: ${session.pid}, Port: ${session.port})`);
292
- });
293
- }
294
- }
295
-
296
- // Pass session manager to app
297
- app.sessionManager = sessionManager;
298
-
299
- await app.start();
300
- } catch (error) {
301
- logger.error('Fatal error starting Chrome Debug:', error);
302
- process.exit(1);
303
- }
304
- }
305
-
306
- // Handle graceful shutdown
307
- process.on('SIGINT', async () => {
308
- logger.info('Received SIGINT, shutting down gracefully...');
309
- process.exit(0);
310
- });
311
-
312
- process.on('SIGTERM', async () => {
313
- logger.info('Received SIGTERM, shutting down gracefully...');
314
- process.exit(0);
315
- });
316
-
317
- // Export for testing
318
- export { ChromePilotApp };
319
-
320
- // Run if this is the main module
321
- if (import.meta.url === `file://${process.argv[1]}`) {
322
- main().catch((error) => {
323
- logger.error('Unhandled error:', error);
324
- process.exit(1);
325
- });
326
- }
257
+ // Export for library usage and testing
258
+ // This file is now safe to import without side effects
259
+ export { ChromePilotApp };