chrome-devtools-mcp-for-extension 0.8.7 → 0.8.8
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/build/src/tools/extensions.js +24 -40
- package/package.json +1 -1
|
@@ -448,7 +448,7 @@ export const toggleExtensionState = defineTool({
|
|
|
448
448
|
});
|
|
449
449
|
export const openExtensionPopup = defineTool({
|
|
450
450
|
name: 'open_extension_popup',
|
|
451
|
-
description: `
|
|
451
|
+
description: `Select an already-opened Chrome extension popup window for testing. The user should manually click the extension icon first to open the popup, then this tool will detect and select it. After selection, you can use take_snapshot, click, evaluate_script, etc. on the popup.`,
|
|
452
452
|
annotations: {
|
|
453
453
|
category: ToolCategories.EXTENSION_DEVELOPMENT,
|
|
454
454
|
readOnlyHint: false,
|
|
@@ -494,54 +494,38 @@ export const openExtensionPopup = defineTool({
|
|
|
494
494
|
}
|
|
495
495
|
response.appendResponseLine(`🔍 Found extension: ${extensionInfo.name} (${extensionInfo.id})`);
|
|
496
496
|
try {
|
|
497
|
-
// Find service worker target
|
|
498
497
|
const browser = page.browser();
|
|
499
498
|
if (!browser) {
|
|
500
499
|
response.appendResponseLine('❌ Failed to get browser instance.');
|
|
501
500
|
return;
|
|
502
501
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
await worker.evaluate('chrome.action.openPopup();');
|
|
518
|
-
// Wait for popup target
|
|
519
|
-
const popupTarget = await browser.waitForTarget((target) => target.type() === 'page' &&
|
|
520
|
-
target.url().includes(extensionInfo.id) &&
|
|
521
|
-
target.url().includes('popup'), { timeout: 5000 });
|
|
522
|
-
if (!popupTarget) {
|
|
523
|
-
response.appendResponseLine('❌ Popup did not open within timeout.');
|
|
524
|
-
return;
|
|
502
|
+
response.appendResponseLine('🔧 Looking for open popup window...');
|
|
503
|
+
// Get all pages
|
|
504
|
+
const pages = await browser.pages();
|
|
505
|
+
// Find popup page by URL (contains extension ID)
|
|
506
|
+
let popupPage = null;
|
|
507
|
+
let popupIndex = -1;
|
|
508
|
+
for (let i = 0; i < pages.length; i++) {
|
|
509
|
+
const p = pages[i];
|
|
510
|
+
const url = p.url();
|
|
511
|
+
if (url && url.includes(extensionInfo.id)) {
|
|
512
|
+
popupPage = p;
|
|
513
|
+
popupIndex = i;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
525
516
|
}
|
|
526
|
-
const popupPage = await popupTarget.page();
|
|
527
517
|
if (!popupPage) {
|
|
528
|
-
response.appendResponseLine('❌
|
|
518
|
+
response.appendResponseLine('❌ Popup window not found.');
|
|
519
|
+
response.appendResponseLine('💡 Please manually click the extension icon to open the popup first.');
|
|
529
520
|
return;
|
|
530
521
|
}
|
|
531
|
-
//
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
response.appendResponseLine(`📄 Popup URL: ${popupPage.url()}`);
|
|
539
|
-
response.appendResponseLine('');
|
|
540
|
-
response.appendResponseLine('💡 You can now use take_snapshot, click, evaluate_script, etc. on the popup');
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
response.appendResponseLine('⚠️ Popup opened but could not be selected automatically.');
|
|
544
|
-
}
|
|
522
|
+
// Select the popup page
|
|
523
|
+
context.setSelectedPageIdx(popupIndex);
|
|
524
|
+
response.appendResponseLine('');
|
|
525
|
+
response.appendResponseLine(`✅ Popup window selected: ${extensionInfo.name}`);
|
|
526
|
+
response.appendResponseLine(`📄 Popup URL: ${popupPage.url()}`);
|
|
527
|
+
response.appendResponseLine('');
|
|
528
|
+
response.appendResponseLine('💡 You can now use take_snapshot, click, evaluate_script, etc. on the popup');
|
|
545
529
|
}
|
|
546
530
|
catch (error) {
|
|
547
531
|
response.appendResponseLine(`❌ Error: ${error instanceof Error ? error.message : String(error)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp-for-extension",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
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",
|