@dynamicu/chromedebug-mcp 2.5.2 → 2.5.5

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
@@ -199,7 +199,7 @@ Install the FREE version directly from the Chrome Web Store:
199
199
 
200
200
  For unlimited recordings and advanced features, purchase the PRO version:
201
201
 
202
- 💎 **[Get PRO Version](https://dynamicu.lemonsqueezy.com/buy/641143)**
202
+ 💎 **[Get PRO Version](https://chromedebug.com/buy/996773cb-682b-430f-b9e3-9ce2130bd967)**
203
203
 
204
204
  - ✅ Unlimited recordings
205
205
  - ✅ Advanced function tracing
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamicu/chromedebug-mcp",
3
- "version": "2.5.2",
3
+ "version": "2.5.5",
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": {
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,101 +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
- // Detect Windows and provide WSL2 guidance
267
- if (process.platform === 'win32' && !process.env.WSL_DISTRO_NAME && !process.env.CHROMEDEBUG_FORCE_WINDOWS) {
268
- console.error(`
269
- ⚠️ ChromeDebug MCP runs best on Unix-based systems.
270
-
271
- Windows users have two options:
272
-
273
- 1. WSL2 (RECOMMENDED - Full Compatibility):
274
- • Install WSL2: Run in PowerShell as Admin:
275
- wsl --install
276
- • Restart your computer
277
- • Inside WSL, install Node.js:
278
- sudo apt update && sudo apt install nodejs npm
279
- • Install ChromeDebug in WSL:
280
- npm install -g @dynamicu/chromedebug-mcp
281
- • Configure Claude to use WSL:
282
- claude mcp add chromedebug -s user -- wsl chromedebug-mcp
283
-
284
- 2. Native Windows (LIMITED - May have stdio issues):
285
- • Set: set CHROMEDEBUG_FORCE_WINDOWS=1
286
- • Then run: chromedebug-mcp
287
- • Note: MCP stdio communication may fail due to cmd.exe limitations
288
-
289
- For details: https://github.com/dynamicupgrade/ChromeDebug#windows-setup
290
- `);
291
- process.exit(1);
292
- }
293
-
294
- try {
295
- // Initialize unified session manager with options
296
- const sessionManager = await initializeSessionManager({
297
- sessionId: args.sessionId,
298
- skipCleanup: args.noCleanup,
299
- verbose: args.verbose
300
- });
301
-
302
- // Register this process for tracking
303
- await registerProcess(process.pid, 'mcp-server');
304
-
305
- // Log session information if verbose
306
- if (args.verbose) {
307
- const sessionInfo = getSessionInfo();
308
- logger.debug('Session Information:');
309
- logger.debug(` Session ID: ${sessionInfo.sessionId}`);
310
- logger.debug(` PID: ${sessionInfo.pid}`);
311
- logger.debug(` Port: ${sessionInfo.port}`);
312
- logger.debug(` Session File: ${sessionInfo.sessionFile}`);
313
-
314
- // Show other active sessions
315
- const activeSessions = await findActiveSessions();
316
- if (activeSessions.length > 1) {
317
- logger.debug(` Other active sessions: ${activeSessions.length - 1}`);
318
- activeSessions.filter(s => s.sessionId !== sessionInfo.sessionId).forEach(session => {
319
- logger.debug(` - ${session.sessionId} (PID: ${session.pid}, Port: ${session.port})`);
320
- });
321
- }
322
- }
323
-
324
- // Pass session manager to app
325
- app.sessionManager = sessionManager;
326
-
327
- await app.start();
328
- } catch (error) {
329
- logger.error('Fatal error starting Chrome Debug:', error);
330
- process.exit(1);
331
- }
332
- }
333
-
334
- // Handle graceful shutdown
335
- process.on('SIGINT', async () => {
336
- logger.info('Received SIGINT, shutting down gracefully...');
337
- process.exit(0);
338
- });
339
-
340
- process.on('SIGTERM', async () => {
341
- logger.info('Received SIGTERM, shutting down gracefully...');
342
- process.exit(0);
343
- });
344
-
345
- // Export for testing
346
- export { ChromePilotApp };
347
-
348
- // Run if this is the main module
349
- if (import.meta.url === `file://${process.argv[1]}`) {
350
- main().catch((error) => {
351
- logger.error('Unhandled error:', error);
352
- process.exit(1);
353
- });
354
- }
257
+ // Export for library usage and testing
258
+ // This file is now safe to import without side effects
259
+ export { ChromePilotApp };