@dynamicu/chromedebug-mcp 2.5.14 → 2.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamicu/chromedebug-mcp",
3
- "version": "2.5.14",
3
+ "version": "2.6.1",
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",
@@ -118,6 +118,8 @@
118
118
  "joi": "^18.0.0",
119
119
  "jsonwebtoken": "^9.0.2",
120
120
  "multer": "^2.0.2",
121
+ "pino": "^10.1.0",
122
+ "pino-pretty": "^13.1.2",
121
123
  "puppeteer": "^24.25.0",
122
124
  "uuid": "^11.1.0",
123
125
  "web-vitals": "^5.1.0",
@@ -62,8 +62,8 @@ module.exports = {
62
62
  { from: 'chrome-extension/logger.js', to: 'logger.js' },
63
63
  { from: 'chrome-extension/license-helper.js', to: 'license-helper.js' },
64
64
  { from: 'chrome-extension/firebase-client.js', to: 'firebase-client.js' },
65
- { from: 'chrome-extension/firebase-config.js', to: 'firebase-config.js' },
66
- { from: 'chrome-extension/firebase-config.module.js', to: 'firebase-config.module.js' },
65
+ { from: 'chrome-extension/firebase-config.public.js', to: 'firebase-config.public.js' },
66
+ { from: 'chrome-extension/firebase-config.public-sw.js', to: 'firebase-config.js' },
67
67
  { from: 'chrome-extension/activation-manager.js', to: 'activation-manager.js' },
68
68
  { from: 'chrome-extension/frame-capture.js', to: 'frame-capture.js' },
69
69
  { from: 'chrome-extension/chrome-session-manager.js', to: 'chrome-session-manager.js' },
@@ -323,7 +323,7 @@ export class MemoryMonitor {
323
323
  componentUsage.set(id, usage);
324
324
  totalBytes += usage;
325
325
  } catch (error) {
326
- console.warn(`Error getting memory usage for component ${id}:`, error);
326
+ console.error(`Error getting memory usage for component ${id}:`, error);
327
327
  componentUsage.set(id, 0);
328
328
  }
329
329
  }
@@ -563,7 +563,7 @@ export class CaptureMemoryManager extends ICaptureMemoryManager {
563
563
 
564
564
  // Set up memory monitoring
565
565
  this.monitor.onMemoryEvent('critical', async (usage) => {
566
- console.warn('Critical memory usage detected:', usage.totalMB, 'MB');
566
+ console.error('Critical memory usage detected:', usage.totalMB, 'MB');
567
567
  await this.requestCleanup('aggressive');
568
568
  });
569
569
 
@@ -573,7 +573,7 @@ export class CaptureMemoryManager extends ICaptureMemoryManager {
573
573
 
574
574
  // Set up backpressure monitoring
575
575
  this.backpressure.onStateChange('critical', ({ utilization }) => {
576
- console.warn('Critical backpressure detected, utilization:', utilization);
576
+ console.error('Critical backpressure detected, utilization:', utilization);
577
577
  });
578
578
 
579
579
  this.backpressure.onStateChange('blocked', ({ utilization }) => {
package/src/cli.js CHANGED
@@ -18,8 +18,12 @@ import {
18
18
  findActiveSessions
19
19
  } from './services/unified-session-manager.js';
20
20
  import logger from './utils/logger.js';
21
+ import { interceptStdout } from './logger.js';
21
22
  import { installPro } from './commands/install-pro.js';
22
23
 
24
+ // CRITICAL: Intercept stdout FIRST to prevent MCP JSON-RPC pollution
25
+ interceptStdout();
26
+
23
27
  /**
24
28
  * Main CLI entry point
25
29
  */
@@ -43,7 +43,7 @@ async function logInstall(message, isError = false) {
43
43
  if (isError) {
44
44
  console.error(message);
45
45
  } else {
46
- console.log(message);
46
+ console.error(message);
47
47
  }
48
48
  }
49
49
 
@@ -169,8 +169,8 @@ async function checkExistingInstallation() {
169
169
  function promptConfirmation(message) {
170
170
  // For now, we'll auto-continue with a warning
171
171
  // In future, could add readline for interactive prompts
172
- console.log(`\n${message}`);
173
- console.log('Continuing with installation...\n');
172
+ console.error(`\n${message}`);
173
+ console.error('Continuing with installation...\n');
174
174
  return true;
175
175
  }
176
176
 
@@ -429,7 +429,7 @@ async function configureShell() {
429
429
  * Main installation flow
430
430
  */
431
431
  export async function installPro(args) {
432
- console.log('\nChromeDebug PRO License Installer\n');
432
+ console.error('\nChromeDebug PRO License Installer\n');
433
433
 
434
434
  try {
435
435
  // Create ChromeDebug directory
@@ -447,13 +447,13 @@ export async function installPro(args) {
447
447
  const { license, extensionPath } = parsedArgs;
448
448
 
449
449
  // 2. Validate license key
450
- console.log('Validating license key...');
450
+ console.error('Validating license key...');
451
451
  if (!validateLicenseKey(license)) {
452
452
  await logInstall(`Invalid license key: ${maskLicenseKey(license)}`, true);
453
453
  return process.exit(1);
454
454
  }
455
455
  await logInstall(`License key validated: ${maskLicenseKey(license)}`);
456
- console.log(` License key validated: ${maskLicenseKey(license)}\n`);
456
+ console.error(` License key validated: ${maskLicenseKey(license)}\n`);
457
457
 
458
458
  // 3. Pre-flight checks
459
459
  if (!(await preflightChecks())) {
@@ -477,17 +477,17 @@ This will overwrite the existing installation.`;
477
477
  }
478
478
 
479
479
  // 5. Extract extension
480
- console.log('Extracting PRO extension...');
480
+ console.error('Extracting PRO extension...');
481
481
  const extensionInfo = await extractExtension(extensionPath, EXTENSION_DIR);
482
482
  await logInstall(`Extension extracted: ${extensionInfo.name} v${extensionInfo.version}`);
483
- console.log(` PRO extension extracted to ${EXTENSION_DIR}`);
484
- console.log(` Version: ${extensionInfo.version}\n`);
483
+ console.error(` PRO extension extracted to ${EXTENSION_DIR}`);
484
+ console.error(` Version: ${extensionInfo.version}\n`);
485
485
 
486
486
  // Set extension directory permissions
487
487
  await fs.chmod(EXTENSION_DIR, 0o755);
488
488
 
489
489
  // 5.5. Create license activation file for auto-activation
490
- console.log('Creating license activation file...');
490
+ console.error('Creating license activation file...');
491
491
  const activationFile = {
492
492
  license_key: license,
493
493
  activated_at: new Date().toISOString(),
@@ -502,16 +502,16 @@ This will overwrite the existing installation.`;
502
502
  'utf8'
503
503
  );
504
504
  await logInstall(`License activation file created: ${activationFilePath}`);
505
- console.log(` Activation file created for auto-activation\n`);
505
+ console.error(` Activation file created for auto-activation\n`);
506
506
 
507
507
  // 6. Save license information
508
- console.log('Saving license information...');
508
+ console.error('Saving license information...');
509
509
  await saveLicenseInfo(license, extensionInfo.version);
510
510
  await logInstall(`License saved: ${maskLicenseKey(license)}`);
511
- console.log(` License saved to ${LICENSE_FILE}\n`);
511
+ console.error(` License saved to ${LICENSE_FILE}\n`);
512
512
 
513
513
  // 7. Configure shell environment
514
- console.log('Configuring shell environment...');
514
+ console.error('Configuring shell environment...');
515
515
  let shellResult;
516
516
  let shellConfigFailed = false;
517
517
 
@@ -520,48 +520,48 @@ This will overwrite the existing installation.`;
520
520
  await logInstall(`Shell configured: ${shellResult.shell} (${shellResult.configFile})`);
521
521
 
522
522
  if (shellResult.updated) {
523
- console.log(` Shell configured: export ${ENV_VAR_NAME}="${EXTENSION_DIR}"`);
524
- console.log(` Config file: ${shellResult.configFile}`);
525
- console.log(` Backup saved: ${shellResult.configFile}.chromedebug-backup\n`);
523
+ console.error(` Shell configured: export ${ENV_VAR_NAME}="${EXTENSION_DIR}"`);
524
+ console.error(` Config file: ${shellResult.configFile}`);
525
+ console.error(` Backup saved: ${shellResult.configFile}.chromedebug-backup\n`);
526
526
  } else {
527
- console.log(` Shell already configured correctly\n`);
527
+ console.error(` Shell already configured correctly\n`);
528
528
  }
529
529
  } catch (shellErr) {
530
530
  shellConfigFailed = true;
531
531
  await logInstall(`Shell configuration failed: ${shellErr.message}`, false);
532
- console.log(`⚠ Could not automatically configure shell environment`);
533
- console.log(` Error: ${shellErr.message}\n`);
532
+ console.error(`⚠ Could not automatically configure shell environment`);
533
+ console.error(` Error: ${shellErr.message}\n`);
534
534
  }
535
535
 
536
536
  // 8. Success!
537
537
  await logInstall('=== Installation Completed Successfully ===');
538
538
 
539
- console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
540
- console.log('✓ PRO features are now active!');
541
- console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
539
+ console.error('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
540
+ console.error('✓ PRO features are now active!');
541
+ console.error('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
542
542
 
543
543
  if (shellConfigFailed) {
544
- console.log('⚠ Manual Configuration Required:');
545
- console.log(` Add this line to your shell configuration file:`);
546
- console.log(` export ${ENV_VAR_NAME}="${EXTENSION_DIR}"\n`);
544
+ console.error('⚠ Manual Configuration Required:');
545
+ console.error(` Add this line to your shell configuration file:`);
546
+ console.error(` export ${ENV_VAR_NAME}="${EXTENSION_DIR}"\n`);
547
547
  }
548
548
 
549
- console.log('Next steps:');
549
+ console.error('Next steps:');
550
550
  if (shellResult && shellResult.configFile) {
551
- console.log(`1. Restart your terminal or run: source ${shellResult.configFile}`);
551
+ console.error(`1. Restart your terminal or run: source ${shellResult.configFile}`);
552
552
  } else {
553
- console.log(`1. Add the environment variable to your shell config and restart terminal`);
553
+ console.error(`1. Add the environment variable to your shell config and restart terminal`);
554
554
  }
555
- console.log('2. Close any running Chrome instances');
556
- console.log('3. Launch ChromeDebug MCP: chromedebug-mcp');
557
- console.log('4. The PRO extension will be loaded automatically\n');
555
+ console.error('2. Close any running Chrome instances');
556
+ console.error('3. Launch ChromeDebug MCP: chromedebug-mcp');
557
+ console.error('4. The PRO extension will be loaded automatically\n');
558
558
 
559
- console.log('Verify installation:');
560
- console.log(` echo $${ENV_VAR_NAME}`);
561
- console.log(` (should output: ${EXTENSION_DIR})\n`);
559
+ console.error('Verify installation:');
560
+ console.error(` echo $${ENV_VAR_NAME}`);
561
+ console.error(` (should output: ${EXTENSION_DIR})\n`);
562
562
 
563
- console.log('Installation log: ' + INSTALL_LOG);
564
- console.log('\nNeed help? https://github.com/dynamicupgrade/ChromeDebug/issues\n');
563
+ console.error('Installation log: ' + INSTALL_LOG);
564
+ console.error('\nNeed help? https://github.com/dynamicupgrade/ChromeDebug/issues\n');
565
565
  } catch (err) {
566
566
  await logInstall(`Installation failed: ${err.message}`, true);
567
567
  console.error('\n Installation failed\n');
@@ -169,7 +169,7 @@ export class FirebaseLicenseManager {
169
169
  if (!forceRefresh) {
170
170
  const cached = this.cache.get(licenseKey);
171
171
  if (cached) {
172
- console.log('[License] Using cached validation result');
172
+ console.error('[License] Using cached validation result');
173
173
  return {
174
174
  ...cached,
175
175
  fromCache: true
@@ -217,7 +217,7 @@ export class FirebaseLicenseManager {
217
217
  const gracePeriodMs = this.gracePeriodDays * 24 * 60 * 60 * 1000;
218
218
 
219
219
  if (cacheAge <= gracePeriodMs) {
220
- console.log('[License] Using grace period validation');
220
+ console.error('[License] Using grace period validation');
221
221
  return {
222
222
  ...cached,
223
223
  fromCache: true,
@@ -437,8 +437,8 @@ let licenseManagerInstance = null;
437
437
  export function getLicenseManager(config = {}) {
438
438
  // Check if Firebase is configured
439
439
  if (!process.env.FIREBASE_PROJECT_ID) {
440
- console.warn('[License] Firebase not configured - licensing disabled');
441
- console.warn('[License] Set FIREBASE_PROJECT_ID to enable licensing');
440
+ console.error('[License] Firebase not configured - licensing disabled');
441
+ console.error('[License] Set FIREBASE_PROJECT_ID to enable licensing');
442
442
 
443
443
  // Return stub that allows all operations (development mode)
444
444
  return {