chrome-devtools-mcp-for-extension 0.9.11 → 0.9.12

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.
@@ -98,6 +98,61 @@ function scanExtensionsDirectory(extensionsDir) {
98
98
  }
99
99
  return extensionPaths;
100
100
  }
101
+ /**
102
+ * Get system Chrome executable path
103
+ */
104
+ function getSystemChromeExecutable(channel) {
105
+ const platform = os.platform();
106
+ if (platform === 'darwin') {
107
+ // macOS
108
+ if (channel === 'canary') {
109
+ return '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary';
110
+ }
111
+ else if (channel === 'beta') {
112
+ return '/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta';
113
+ }
114
+ else if (channel === 'dev') {
115
+ return '/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev';
116
+ }
117
+ return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
118
+ }
119
+ else if (platform === 'win32') {
120
+ // Windows
121
+ const programFiles = process.env['ProgramFiles'] || 'C:\\Program Files';
122
+ const programFilesX86 = process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)';
123
+ if (channel === 'canary') {
124
+ return path.join(process.env.LOCALAPPDATA || '', 'Google', 'Chrome SxS', 'Application', 'chrome.exe');
125
+ }
126
+ else if (channel === 'beta') {
127
+ return path.join(programFiles, 'Google', 'Chrome Beta', 'Application', 'chrome.exe');
128
+ }
129
+ else if (channel === 'dev') {
130
+ return path.join(programFiles, 'Google', 'Chrome Dev', 'Application', 'chrome.exe');
131
+ }
132
+ // Try both Program Files locations
133
+ const path1 = path.join(programFiles, 'Google', 'Chrome', 'Application', 'chrome.exe');
134
+ const path2 = path.join(programFilesX86, 'Google', 'Chrome', 'Application', 'chrome.exe');
135
+ if (fs.existsSync(path1))
136
+ return path1;
137
+ if (fs.existsSync(path2))
138
+ return path2;
139
+ return path1; // Default fallback
140
+ }
141
+ else {
142
+ // Linux
143
+ if (channel === 'canary' || channel === 'dev') {
144
+ return '/usr/bin/google-chrome-unstable';
145
+ }
146
+ else if (channel === 'beta') {
147
+ return '/usr/bin/google-chrome-beta';
148
+ }
149
+ // Try google-chrome first, fallback to chromium
150
+ if (fs.existsSync('/usr/bin/google-chrome')) {
151
+ return '/usr/bin/google-chrome';
152
+ }
153
+ return '/usr/bin/chromium-browser';
154
+ }
155
+ }
101
156
  /**
102
157
  * Get System Chrome User Data directory (not Chrome for Testing)
103
158
  */
@@ -447,8 +502,17 @@ export async function launch(options) {
447
502
  // Add Google login automation detection bypass
448
503
  args.push('--disable-blink-features=AutomationControlled');
449
504
  console.error('Added Google login bypass: --disable-blink-features=AutomationControlled');
505
+ // Use system Chrome instead of Chrome for Testing when loading extensions
450
506
  let puppeterChannel;
451
- if (!executablePath) {
507
+ let effectiveExecutablePath = executablePath;
508
+ if (!executablePath && extensionPaths.length > 0) {
509
+ // Auto-detect system Chrome executable for extension support
510
+ effectiveExecutablePath = getSystemChromeExecutable(channel);
511
+ console.error(`🔍 Auto-detected system Chrome: ${effectiveExecutablePath}`);
512
+ console.error(`💡 Using system Chrome for extension support (not Chrome for Testing)`);
513
+ }
514
+ else if (!executablePath) {
515
+ // No extensions, use Chrome for Testing via channel
452
516
  puppeterChannel =
453
517
  channel && channel !== 'stable'
454
518
  ? `chrome-${channel}`
@@ -457,7 +521,7 @@ export async function launch(options) {
457
521
  // Log complete Chrome configuration before launch
458
522
  console.error('Chrome Launch Configuration:');
459
523
  console.error(` Channel: ${puppeterChannel || 'default'}`);
460
- console.error(` Executable: ${executablePath || 'auto-detected'}`);
524
+ console.error(` Executable: ${effectiveExecutablePath || 'auto-detected'}`);
461
525
  console.error(` User Data Dir: ${userDataDir || 'temporary'}`);
462
526
  console.error(` Profile Directory: ${profileDirectory}`);
463
527
  console.error(` Profile Type: ${usingSystemProfile ? 'System Profile (auto-detected)' : 'Custom Profile'}`);
@@ -475,7 +539,7 @@ export async function launch(options) {
475
539
  const browser = await puppeteer.launch({
476
540
  ...connectOptions,
477
541
  channel: puppeterChannel,
478
- executablePath,
542
+ executablePath: effectiveExecutablePath,
479
543
  defaultViewport: null,
480
544
  userDataDir,
481
545
  pipe: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp-for-extension",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
4
4
  "description": "MCP server for Chrome extension development with Web Store automation. Fork of chrome-devtools-mcp with extension-specific tools.",
5
5
  "type": "module",
6
6
  "bin": "./build/src/index.js",