mcpbrowser 0.2.3 → 0.2.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 +2 -2
- package/package.json +2 -3
- package/server.json +1 -1
- package/src/mcp-browser.js +46 -7
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The extension automatically:
|
|
|
30
30
|
📦 [View on Marketplace](https://marketplace.visualstudio.com/items?itemName=cherchyk.mcpbrowser)
|
|
31
31
|
|
|
32
32
|
### Option 2: npm Package (Recommended for Manual Setup)
|
|
33
|
-
Published on npm as [mcpbrowser](https://www.npmjs.com/package/mcpbrowser) v0.2.
|
|
33
|
+
Published on npm as [mcpbrowser](https://www.npmjs.com/package/mcpbrowser) v0.2.3.
|
|
34
34
|
|
|
35
35
|
Add to your `mcp.json`:
|
|
36
36
|
```jsonc
|
|
@@ -47,7 +47,7 @@ Add to your `mcp.json`:
|
|
|
47
47
|
- Mac/Linux: `~/.config/Code/User/mcp.json`
|
|
48
48
|
|
|
49
49
|
### Option 3: MCP Registry
|
|
50
|
-
Available in the [MCP Registry](https://registry.modelcontextprotocol.io/) as `io.github.cherchyk/browser` v0.2.
|
|
50
|
+
Available in the [MCP Registry](https://registry.modelcontextprotocol.io/) as `io.github.cherchyk/browser` v0.2.3.
|
|
51
51
|
|
|
52
52
|
Search for "browser" in the registry to find configuration instructions.
|
|
53
53
|
|
package/package.json
CHANGED
package/server.json
CHANGED
package/src/mcp-browser.js
CHANGED
|
@@ -14,13 +14,49 @@ dotenv.config();
|
|
|
14
14
|
const chromeHost = process.env.CHROME_REMOTE_DEBUG_HOST || "127.0.0.1";
|
|
15
15
|
const chromePort = Number(process.env.CHROME_REMOTE_DEBUG_PORT || 9222);
|
|
16
16
|
const explicitWSEndpoint = process.env.CHROME_WS_ENDPOINT;
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// Use default Chrome profile if not explicitly set
|
|
19
|
+
function getDefaultUserDataDir() {
|
|
20
|
+
const platform = os.platform();
|
|
21
|
+
const home = os.homedir();
|
|
22
|
+
|
|
23
|
+
if (platform === "win32") {
|
|
24
|
+
return path.join(home, "AppData/Local/Google/Chrome/User Data");
|
|
25
|
+
} else if (platform === "darwin") {
|
|
26
|
+
return path.join(home, "Library/Application Support/Google/Chrome");
|
|
27
|
+
} else {
|
|
28
|
+
return path.join(home, ".config/google-chrome");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const userDataDir = process.env.CHROME_USER_DATA_DIR || getDefaultUserDataDir();
|
|
18
33
|
const chromePathEnv = process.env.CHROME_PATH;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
|
|
35
|
+
function getDefaultChromePaths() {
|
|
36
|
+
const platform = os.platform();
|
|
37
|
+
|
|
38
|
+
if (platform === "win32") {
|
|
39
|
+
return [
|
|
40
|
+
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
|
41
|
+
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
42
|
+
"C:/Program Files/Microsoft/Edge/Application/msedge.exe",
|
|
43
|
+
];
|
|
44
|
+
} else if (platform === "darwin") {
|
|
45
|
+
return [
|
|
46
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
47
|
+
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
|
48
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
49
|
+
];
|
|
50
|
+
} else {
|
|
51
|
+
return [
|
|
52
|
+
"/usr/bin/google-chrome",
|
|
53
|
+
"/usr/bin/chromium-browser",
|
|
54
|
+
"/usr/bin/chromium",
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const defaultChromePaths = getDefaultChromePaths();
|
|
24
60
|
|
|
25
61
|
let cachedBrowser = null;
|
|
26
62
|
let lastKeptPage = null; // reuse the same tab when requested
|
|
@@ -191,7 +227,7 @@ async function main() {
|
|
|
191
227
|
const tools = [
|
|
192
228
|
{
|
|
193
229
|
name: "load_and_extract",
|
|
194
|
-
description: "
|
|
230
|
+
description: "⚠️ BROWSER ACCESS: Opens pages in your Chrome browser with your default profile (saved passwords, extensions, authenticated sessions). Use when normal URL fetching fails due to authentication requirements, login redirects, 401/403 errors, anti-crawler/bot detection, or session requirements. Automatically handles auth redirects, waits for network idle, and supports tab reuse to preserve sessions. Returns both plain text and HTML content.",
|
|
195
231
|
inputSchema: {
|
|
196
232
|
type: "object",
|
|
197
233
|
properties: {
|
|
@@ -201,6 +237,9 @@ async function main() {
|
|
|
201
237
|
required: ["url"],
|
|
202
238
|
additionalProperties: false,
|
|
203
239
|
},
|
|
240
|
+
annotations: {
|
|
241
|
+
title: "Access Authenticated Web Page"
|
|
242
|
+
}
|
|
204
243
|
},
|
|
205
244
|
];
|
|
206
245
|
|