mcpbrowser 0.2.8 → 0.2.10
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/extension/package.json +1 -1
- package/extension/src/extension.js +15 -2
- package/package.json +1 -1
- package/src/mcp-browser.js +18 -5
package/extension/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mcpbrowser",
|
|
3
3
|
"displayName": "MCP Browser",
|
|
4
4
|
"description": "Extends Copilot's web access to protected pages - handles login, SSO, and anti-crawler restrictions",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.9",
|
|
6
6
|
"publisher": "cherchyk",
|
|
7
7
|
"icon": "icon.png",
|
|
8
8
|
"engines": {
|
|
@@ -39,8 +39,21 @@ async function installMcpBrowser() {
|
|
|
39
39
|
try {
|
|
40
40
|
vscode.window.showInformationMessage('Installing MCPBrowser npm package...');
|
|
41
41
|
|
|
42
|
-
//
|
|
43
|
-
|
|
42
|
+
// Try with sudo if in Linux/Mac environment (like dev containers)
|
|
43
|
+
let installCmd = 'npm install -g mcpbrowser@latest';
|
|
44
|
+
|
|
45
|
+
// Check if we need sudo (Linux/Mac and not running as root)
|
|
46
|
+
if (process.platform !== 'win32' && process.getuid && process.getuid() !== 0) {
|
|
47
|
+
// Check if sudo is available
|
|
48
|
+
try {
|
|
49
|
+
await execPromise('which sudo');
|
|
50
|
+
installCmd = 'sudo ' + installCmd;
|
|
51
|
+
} catch {
|
|
52
|
+
// sudo not available, try without it
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
await execPromise(installCmd);
|
|
44
57
|
|
|
45
58
|
vscode.window.showInformationMessage('MCPBrowser package installed successfully!');
|
|
46
59
|
return true;
|
package/package.json
CHANGED
package/src/mcp-browser.js
CHANGED
|
@@ -200,12 +200,25 @@ async function fetchPage({
|
|
|
200
200
|
// Try to reuse existing pages first (when Chrome opened with profile)
|
|
201
201
|
if (!page) {
|
|
202
202
|
const pages = await browser.pages();
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
// Filter out pages that might not be controllable
|
|
204
|
+
const controllablePages = [];
|
|
205
|
+
for (const p of pages) {
|
|
206
|
+
try {
|
|
207
|
+
const url = p.url();
|
|
208
|
+
// Skip chrome:// pages and other internal pages
|
|
209
|
+
if (!url.startsWith('chrome://') && !url.startsWith('chrome-extension://')) {
|
|
210
|
+
controllablePages.push(p);
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
// Skip pages we can't access
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Use first controllable page or create new one
|
|
218
|
+
if (controllablePages.length > 0) {
|
|
219
|
+
page = controllablePages[0];
|
|
207
220
|
} else {
|
|
208
|
-
// Create new tab if no
|
|
221
|
+
// Create new tab if no controllable pages
|
|
209
222
|
page = await browser.newPage();
|
|
210
223
|
}
|
|
211
224
|
}
|