mcpbrowser 0.2.1 → 0.2.3
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 +33 -20
- package/extension/.vscodeignore +6 -0
- package/extension/LICENSE +21 -0
- package/extension/README.md +61 -0
- package/extension/icon.png +0 -0
- package/extension/icon.svg +35 -0
- package/extension/package-lock.json +44 -0
- package/extension/package.json +55 -0
- package/extension/src/extension.js +257 -0
- package/package.json +1 -1
- package/server.json +3 -3
- package/src/mcp-browser.js +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
# MCPBrowser (MCP fetch tool with authenticated Chrome)
|
|
2
2
|
|
|
3
|
+
[](https://marketplace.visualstudio.com/items?itemName=cherchyk.mcpbrowser)
|
|
3
4
|
[](https://www.npmjs.com/package/mcpbrowser)
|
|
4
5
|
[](https://opensource.org/licenses/MIT)
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Alternative web fetcher for GitHub Copilot when normal URL access fails due to authentication or anti-crawler restrictions. Uses your Chrome/Edge browser session via DevTools Protocol to bypass login requirements and bot detection.
|
|
7
8
|
|
|
8
|
-
## 🚀
|
|
9
|
+
## 🚀 Installation Options
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
<summary><b>📋 Click to copy the configuration snippet</b></summary>
|
|
11
|
+
### Option 1: VS Code Extension (Easiest - One Click)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**From VS Code Marketplace:**
|
|
14
|
+
```bash
|
|
15
|
+
code --install-extension cherchyk.mcpbrowser
|
|
16
|
+
```
|
|
17
|
+
Or search "MCPBrowser" in VS Code Extensions view.
|
|
14
18
|
|
|
15
|
-
**
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
**From GitHub Release:**
|
|
20
|
+
Download from [GitHub Releases](https://github.com/cherchyk/MCPBrowser/releases):
|
|
21
|
+
```bash
|
|
22
|
+
code --install-extension mcpbrowser-0.1.4.vsix
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The extension automatically:
|
|
26
|
+
- Installs the MCPBrowser npm package globally
|
|
27
|
+
- Configures mcp.json for GitHub Copilot
|
|
28
|
+
- Complete one-click setup - no manual steps needed
|
|
29
|
+
|
|
30
|
+
📦 [View on Marketplace](https://marketplace.visualstudio.com/items?itemName=cherchyk.mcpbrowser)
|
|
31
|
+
|
|
32
|
+
### Option 2: npm Package (Recommended for Manual Setup)
|
|
33
|
+
Published on npm as [mcpbrowser](https://www.npmjs.com/package/mcpbrowser) v0.2.2.
|
|
18
34
|
|
|
35
|
+
Add to your `mcp.json`:
|
|
19
36
|
```jsonc
|
|
20
37
|
"MCPBrowser": {
|
|
21
38
|
"type": "stdio",
|
|
@@ -25,21 +42,16 @@ Add this to your VS Code `mcp.json` file:
|
|
|
25
42
|
}
|
|
26
43
|
```
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"type": "stdio",
|
|
32
|
-
"command": "npx",
|
|
33
|
-
"args": ["-y", "github:cherchyk/MCPBrowser"],
|
|
34
|
-
"description": "Loads authenticated web pages using your Chrome session"
|
|
35
|
-
}
|
|
36
|
-
```
|
|
45
|
+
**mcp.json Location:**
|
|
46
|
+
- Windows: `%APPDATA%\Code\User\mcp.json`
|
|
47
|
+
- Mac/Linux: `~/.config/Code/User/mcp.json`
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
### Option 3: MCP Registry
|
|
50
|
+
Available in the [MCP Registry](https://registry.modelcontextprotocol.io/) as `io.github.cherchyk/browser` v0.2.2.
|
|
39
51
|
|
|
40
|
-
|
|
52
|
+
Search for "browser" in the registry to find configuration instructions.
|
|
41
53
|
|
|
42
|
-
### Option
|
|
54
|
+
### Option 4: Clone from GitHub (Development)
|
|
43
55
|
```bash
|
|
44
56
|
git clone https://github.com/cherchyk/MCPBrowser.git
|
|
45
57
|
cd MCPBrowser
|
|
@@ -106,6 +118,7 @@ In Copilot Chat, you should see the `MCPBrowser` server listed. Ask it to load a
|
|
|
106
118
|
|
|
107
119
|
## How it works
|
|
108
120
|
- Tool `load_and_extract` (inside the MCP server) drives your live Chrome (DevTools Protocol) so it inherits your auth cookies, returning `text` and `html` (truncated up to 2M chars per field) for analysis.
|
|
121
|
+
- **Smart confirmation**: Copilot asks for confirmation ONLY on first request to a new domain - explains browser will open for authentication. Subsequent requests to same domain work automatically (session preserved).
|
|
109
122
|
- **Domain-aware tab reuse**: Automatically reuses the same tab for URLs on the same domain, preserving authentication session. Different domains open new tabs.
|
|
110
123
|
- **Automatic page loading**: Waits for network idle (`networkidle0`) by default, ensuring JavaScript-heavy pages (SPAs, dashboards) fully load before returning content.
|
|
111
124
|
- **Automatic auth detection**: Detects ANY authentication redirect (domain changes, login/auth/sso/oauth URLs) and waits for you to complete sign-in, then returns to target page.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 cherchyk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# MCPBrowser
|
|
2
|
+
|
|
3
|
+
Alternative web fetcher for GitHub Copilot when normal URL access fails due to authentication or anti-crawler restrictions.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **One-Click Setup**: Installs npm package and configures mcp.json automatically
|
|
8
|
+
- 🔐 **Bypass Authentication**: Opens pages in your Chrome/Edge browser - you authenticate if needed, MCPBrowser waits and fetches the final page content
|
|
9
|
+
- 🤖 **Beat Anti-Crawler**: Works when sites block Copilot's normal fetching
|
|
10
|
+
- ⚙️ **Auto-Configuration**: Complete setup with a single click
|
|
11
|
+
|
|
12
|
+
## How It Works
|
|
13
|
+
|
|
14
|
+
When Copilot needs to access an authenticated or protected page:
|
|
15
|
+
1. MCPBrowser opens the URL in your Chrome/Edge browser
|
|
16
|
+
2. If authentication is required, you log in normally in the browser
|
|
17
|
+
3. MCPBrowser waits for the page to fully load (handles redirects automatically)
|
|
18
|
+
4. Once loaded, it extracts the content and returns it to Copilot
|
|
19
|
+
5. The browser tab stays open to reuse your session for future requests
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Installation Steps
|
|
24
|
+
|
|
25
|
+
1. Install this extension from VS Code marketplace
|
|
26
|
+
2. You'll see a notification: **"MCPBrowser is available! Would you like to configure it for GitHub Copilot?"**
|
|
27
|
+
3. Click **"Configure Now"**
|
|
28
|
+
4. Wait for "Installing MCPBrowser npm package..." to complete
|
|
29
|
+
5. When you see **"MCPBrowser configured successfully!"**, click **"Restart Now"**
|
|
30
|
+
6. After restart, MCPBrowser is ready to use with Copilot!
|
|
31
|
+
|
|
32
|
+
### Using with GitHub Copilot
|
|
33
|
+
|
|
34
|
+
Once configured, Copilot will automatically use MCPBrowser when it encounters auth/crawler blocks. You can also explicitly request it:
|
|
35
|
+
|
|
36
|
+
**Example prompts:**
|
|
37
|
+
```
|
|
38
|
+
Read https://internal.company.com/docs (I'm already logged in)
|
|
39
|
+
|
|
40
|
+
Load the content from https://portal.azure.com/resources - use my authenticated session
|
|
41
|
+
|
|
42
|
+
Fetch https://github.com/private-repo/issues using MCPBrowser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Copilot will use your Chrome/Edge browser session to access these pages, bypassing authentication and anti-crawler restrictions.
|
|
46
|
+
|
|
47
|
+
### Manual Commands
|
|
48
|
+
|
|
49
|
+
Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`):
|
|
50
|
+
- **Configure MCPBrowser for GitHub Copilot** - Set up or update configuration
|
|
51
|
+
- **Remove MCPBrowser from GitHub Copilot** - Remove configuration
|
|
52
|
+
|
|
53
|
+
## About MCPBrowser
|
|
54
|
+
|
|
55
|
+
Alternative web fetcher for GitHub Copilot when normal URL access fails. Uses Chrome DevTools Protocol to access authenticated and crawler-protected pages through your browser session.
|
|
56
|
+
|
|
57
|
+
Learn more: [MCPBrowser on GitHub](https://github.com/cherchyk/MCPBrowser)
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<svg width="128" height="128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<!-- Background circle -->
|
|
3
|
+
<circle cx="64" cy="64" r="60" fill="#0078D4"/>
|
|
4
|
+
|
|
5
|
+
<!-- Browser window outline -->
|
|
6
|
+
<rect x="24" y="28" width="80" height="56" rx="4" fill="white"/>
|
|
7
|
+
<rect x="28" y="32" width="72" height="48" rx="2" fill="#E8F4FD"/>
|
|
8
|
+
|
|
9
|
+
<!-- Browser chrome bar -->
|
|
10
|
+
<rect x="28" y="32" width="72" height="8" fill="#0078D4"/>
|
|
11
|
+
|
|
12
|
+
<!-- Browser dots (window controls) -->
|
|
13
|
+
<circle cx="33" cy="36" r="1.5" fill="white"/>
|
|
14
|
+
<circle cx="38" cy="36" r="1.5" fill="white"/>
|
|
15
|
+
<circle cx="43" cy="36" r="1.5" fill="white"/>
|
|
16
|
+
|
|
17
|
+
<!-- Lock/Shield icon (authentication symbol) -->
|
|
18
|
+
<g transform="translate(48, 48)">
|
|
19
|
+
<!-- Shield -->
|
|
20
|
+
<path d="M 16 4 L 16 14 C 16 18 12 22 8 24 C 4 22 0 18 0 14 L 0 4 L 8 0 Z"
|
|
21
|
+
fill="#10B981" stroke="none"/>
|
|
22
|
+
<!-- Checkmark inside shield -->
|
|
23
|
+
<path d="M 5 12 L 7 14 L 12 8"
|
|
24
|
+
stroke="white"
|
|
25
|
+
stroke-width="2"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
fill="none"/>
|
|
29
|
+
</g>
|
|
30
|
+
|
|
31
|
+
<!-- Connection indicator (small dots) -->
|
|
32
|
+
<circle cx="90" cy="48" r="3" fill="#10B981"/>
|
|
33
|
+
<circle cx="98" cy="48" r="2" fill="#10B981" opacity="0.7"/>
|
|
34
|
+
<circle cx="104" cy="48" r="1.5" fill="#10B981" opacity="0.4"/>
|
|
35
|
+
</svg>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcpbrowser",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "mcpbrowser",
|
|
9
|
+
"version": "0.1.2",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/node": "^20.19.27",
|
|
13
|
+
"@types/vscode": "^1.107.0"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"vscode": "^1.107.0"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"node_modules/@types/node": {
|
|
20
|
+
"version": "20.19.27",
|
|
21
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.27.tgz",
|
|
22
|
+
"integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==",
|
|
23
|
+
"dev": true,
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"undici-types": "~6.21.0"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"node_modules/@types/vscode": {
|
|
30
|
+
"version": "1.107.0",
|
|
31
|
+
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.107.0.tgz",
|
|
32
|
+
"integrity": "sha512-XS8YE1jlyTIowP64+HoN30OlC1H9xqSlq1eoLZUgFEC8oUTO6euYZxti1xRiLSfZocs4qytTzR6xCBYtioQTCg==",
|
|
33
|
+
"dev": true,
|
|
34
|
+
"license": "MIT"
|
|
35
|
+
},
|
|
36
|
+
"node_modules/undici-types": {
|
|
37
|
+
"version": "6.21.0",
|
|
38
|
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
|
39
|
+
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
|
40
|
+
"dev": true,
|
|
41
|
+
"license": "MIT"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcpbrowser",
|
|
3
|
+
"displayName": "MCPBrowser",
|
|
4
|
+
"description": "Alternative web fetcher for Copilot when auth/crawler blocks prevent normal access. Installs and configures MCPBrowser",
|
|
5
|
+
"version": "0.1.4",
|
|
6
|
+
"publisher": "cherchyk",
|
|
7
|
+
"icon": "icon.png",
|
|
8
|
+
"engines": {
|
|
9
|
+
"vscode": "^1.107.0"
|
|
10
|
+
},
|
|
11
|
+
"categories": [
|
|
12
|
+
"Other"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"github-copilot",
|
|
18
|
+
"browser",
|
|
19
|
+
"authentication"
|
|
20
|
+
],
|
|
21
|
+
"activationEvents": [
|
|
22
|
+
"onStartupFinished"
|
|
23
|
+
],
|
|
24
|
+
"main": "./src/extension.js",
|
|
25
|
+
"contributes": {
|
|
26
|
+
"commands": [
|
|
27
|
+
{
|
|
28
|
+
"command": "mcpbrowser.configure",
|
|
29
|
+
"title": "Configure MCPBrowser for GitHub Copilot"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"command": "mcpbrowser.remove",
|
|
33
|
+
"title": "Remove MCPBrowser from GitHub Copilot"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/cherchyk/MCPBrowser.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/cherchyk/MCPBrowser/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/cherchyk/MCPBrowser#readme",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^20.19.27",
|
|
48
|
+
"@types/vscode": "^1.107.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
52
|
+
},
|
|
53
|
+
"author": "",
|
|
54
|
+
"type": "commonjs"
|
|
55
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
const vscode = require('vscode');
|
|
2
|
+
const fs = require('fs').promises;
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const { exec } = require('child_process');
|
|
6
|
+
const util = require('util');
|
|
7
|
+
const execPromise = util.promisify(exec);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get the path to VS Code's mcp.json configuration file
|
|
11
|
+
*/
|
|
12
|
+
function getMcpConfigPath() {
|
|
13
|
+
if (process.platform === 'win32') {
|
|
14
|
+
return path.join(process.env.APPDATA, 'Code', 'User', 'mcp.json');
|
|
15
|
+
}
|
|
16
|
+
// macOS and Linux
|
|
17
|
+
return path.join(os.homedir(), '.config', 'Code', 'User', 'mcp.json');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Check if MCPBrowser is already configured in mcp.json
|
|
22
|
+
*/
|
|
23
|
+
async function isMcpBrowserConfigured() {
|
|
24
|
+
try {
|
|
25
|
+
const mcpPath = getMcpConfigPath();
|
|
26
|
+
const content = await fs.readFile(mcpPath, 'utf-8');
|
|
27
|
+
const config = JSON.parse(content);
|
|
28
|
+
return config.servers && config.servers.MCPBrowser !== undefined;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// File doesn't exist or can't be read
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Install MCPBrowser npm package globally
|
|
37
|
+
*/
|
|
38
|
+
async function installMcpBrowser() {
|
|
39
|
+
try {
|
|
40
|
+
vscode.window.showInformationMessage('Installing MCPBrowser npm package...');
|
|
41
|
+
|
|
42
|
+
// Install globally so npx can find it reliably
|
|
43
|
+
await execPromise('npm install -g mcpbrowser@latest');
|
|
44
|
+
|
|
45
|
+
vscode.window.showInformationMessage('MCPBrowser package installed successfully!');
|
|
46
|
+
return true;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Error installing MCPBrowser:', error);
|
|
49
|
+
vscode.window.showErrorMessage(`Failed to install MCPBrowser: ${error.message}`);
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Add MCPBrowser configuration to mcp.json
|
|
56
|
+
*/
|
|
57
|
+
async function configureMcpBrowser() {
|
|
58
|
+
try {
|
|
59
|
+
const mcpPath = getMcpConfigPath();
|
|
60
|
+
let config;
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const content = await fs.readFile(mcpPath, 'utf-8');
|
|
64
|
+
config = JSON.parse(content);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
// File doesn't exist, create new config
|
|
67
|
+
config = { servers: {} };
|
|
68
|
+
// Ensure directory exists
|
|
69
|
+
await fs.mkdir(path.dirname(mcpPath), { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Ensure servers object exists
|
|
73
|
+
if (!config.servers) {
|
|
74
|
+
config.servers = {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Add MCPBrowser configuration
|
|
78
|
+
config.servers.MCPBrowser = {
|
|
79
|
+
type: "stdio",
|
|
80
|
+
command: "npx",
|
|
81
|
+
args: ["-y", "mcpbrowser@latest"],
|
|
82
|
+
description: "**USE AUTOMATICALLY** when normal URL fetch fails due to: 401/403 errors, login/auth requirements, SSO prompts, anti-crawler/bot detection. **FIRST ACCESS**: Ask confirmation ONLY for first request to a domain - explain browser will open for authentication. **SUBSEQUENT REQUESTS**: Use automatically (session preserved). Loads pages using authenticated Chrome session via DevTools Protocol (works for Microsoft, GitHub, AWS, Google, corporate sites, etc.). Waits for page load automatically (up to 60s, handles redirects)."
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Write back to file with pretty formatting
|
|
86
|
+
await fs.writeFile(mcpPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
87
|
+
|
|
88
|
+
return true;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Error configuring MCPBrowser:', error);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Remove MCPBrowser configuration from mcp.json
|
|
97
|
+
*/
|
|
98
|
+
async function removeMcpBrowser() {
|
|
99
|
+
try {
|
|
100
|
+
const mcpPath = getMcpConfigPath();
|
|
101
|
+
const content = await fs.readFile(mcpPath, 'utf-8');
|
|
102
|
+
const config = JSON.parse(content);
|
|
103
|
+
|
|
104
|
+
if (config.servers && config.servers.MCPBrowser) {
|
|
105
|
+
delete config.servers.MCPBrowser;
|
|
106
|
+
await fs.writeFile(mcpPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return false;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('Error removing MCPBrowser:', error);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Check if MCPBrowser npm package is installed
|
|
119
|
+
*/
|
|
120
|
+
async function checkMcpBrowserInstalled() {
|
|
121
|
+
try {
|
|
122
|
+
const { exec } = require('child_process');
|
|
123
|
+
return new Promise((resolve) => {
|
|
124
|
+
exec('npm list -g mcpbrowser', (error, stdout, stderr) => {
|
|
125
|
+
// If package is found globally or locally, it will be in stdout
|
|
126
|
+
resolve(stdout.includes('mcpbrowser'));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
} catch (error) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Show notification to configure MCPBrowser
|
|
136
|
+
*/
|
|
137
|
+
async function showConfigurationPrompt(context) {
|
|
138
|
+
const configured = await isMcpBrowserConfigured();
|
|
139
|
+
|
|
140
|
+
if (!configured) {
|
|
141
|
+
const action = await vscode.window.showInformationMessage(
|
|
142
|
+
'MCPBrowser is available! Would you like to configure it for GitHub Copilot?',
|
|
143
|
+
'Configure Now',
|
|
144
|
+
'Not Now',
|
|
145
|
+
"Don't Ask Again"
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
if (action === 'Configure Now') {
|
|
149
|
+
vscode.commands.executeCommand('mcpbrowser.configure');
|
|
150
|
+
} else if (action === "Don't Ask Again") {
|
|
151
|
+
// Store in workspace state to not show again
|
|
152
|
+
context.globalState.update('mcpbrowser.dontAskAgain', true);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Extension activation
|
|
159
|
+
*/
|
|
160
|
+
async function activate(context) {
|
|
161
|
+
console.log('MCPBrowser extension is now active');
|
|
162
|
+
|
|
163
|
+
// Register configure command
|
|
164
|
+
let configureCommand = vscode.commands.registerCommand('mcpbrowser.configure', async () => {
|
|
165
|
+
try {
|
|
166
|
+
const configured = await isMcpBrowserConfigured();
|
|
167
|
+
|
|
168
|
+
if (configured) {
|
|
169
|
+
const action = await vscode.window.showWarningMessage(
|
|
170
|
+
'MCPBrowser is already configured. Do you want to update it?',
|
|
171
|
+
'Update',
|
|
172
|
+
'Cancel'
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
if (action !== 'Update') {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Step 1: Install npm package
|
|
181
|
+
const installed = await installMcpBrowser();
|
|
182
|
+
if (!installed) {
|
|
183
|
+
return; // Installation failed, abort
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Step 2: Configure mcp.json
|
|
187
|
+
await configureMcpBrowser();
|
|
188
|
+
|
|
189
|
+
const restart = await vscode.window.showInformationMessage(
|
|
190
|
+
'✓ MCPBrowser configured successfully! Restart VS Code to use it with GitHub Copilot.',
|
|
191
|
+
'Restart Now',
|
|
192
|
+
'Later'
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
if (restart === 'Restart Now') {
|
|
196
|
+
vscode.commands.executeCommand('workbench.action.reloadWindow');
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
vscode.window.showErrorMessage(
|
|
200
|
+
`Failed to configure MCPBrowser: ${error.message}`
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Register remove command
|
|
206
|
+
let removeCommand = vscode.commands.registerCommand('mcpbrowser.remove', async () => {
|
|
207
|
+
try {
|
|
208
|
+
const confirm = await vscode.window.showWarningMessage(
|
|
209
|
+
'Are you sure you want to remove MCPBrowser configuration?',
|
|
210
|
+
'Remove',
|
|
211
|
+
'Cancel'
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (confirm !== 'Remove') {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const removed = await removeMcpBrowser();
|
|
219
|
+
|
|
220
|
+
if (removed) {
|
|
221
|
+
vscode.window.showInformationMessage(
|
|
222
|
+
'✓ MCPBrowser configuration removed. Restart VS Code for changes to take effect.'
|
|
223
|
+
);
|
|
224
|
+
} else {
|
|
225
|
+
vscode.window.showInformationMessage(
|
|
226
|
+
'MCPBrowser was not configured.'
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
} catch (error) {
|
|
230
|
+
vscode.window.showErrorMessage(
|
|
231
|
+
`Failed to remove MCPBrowser: ${error.message}`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
context.subscriptions.push(configureCommand);
|
|
237
|
+
context.subscriptions.push(removeCommand);
|
|
238
|
+
|
|
239
|
+
// Show configuration prompt if not already configured and user hasn't dismissed
|
|
240
|
+
const dontAskAgain = context.globalState.get('mcpbrowser.dontAskAgain', false);
|
|
241
|
+
if (!dontAskAgain) {
|
|
242
|
+
// Wait a bit after startup to not be intrusive
|
|
243
|
+
setTimeout(() => {
|
|
244
|
+
showConfigurationPrompt(context);
|
|
245
|
+
}, 5000);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Extension deactivation
|
|
251
|
+
*/
|
|
252
|
+
function deactivate() {}
|
|
253
|
+
|
|
254
|
+
module.exports = {
|
|
255
|
+
activate,
|
|
256
|
+
deactivate
|
|
257
|
+
};
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.cherchyk/browser",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Alternative web fetcher for authenticated and crawler-protected pages. Bypasses login requirements and anti-bot restrictions using Chrome DevTools Protocol",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/cherchyk/MCPBrowser",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.3",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "mcpbrowser",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.3",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|
package/src/mcp-browser.js
CHANGED
|
@@ -191,7 +191,7 @@ async function main() {
|
|
|
191
191
|
const tools = [
|
|
192
192
|
{
|
|
193
193
|
name: "load_and_extract",
|
|
194
|
-
description: "
|
|
194
|
+
description: "**FALLBACK MECHANISM**: Use this when normal URL fetching fails due to authentication requirements, login redirects, 401/403 errors, anti-crawler/bot detection, or session requirements. **FIRST ACCESS ONLY**: Ask user for confirmation ONLY if this is the first request to this domain/site - explain a browser window will open where they may need to authenticate. **SUBSEQUENT REQUESTS**: Use automatically without asking - browser session is already authenticated. Loads web pages using your authenticated Chrome/Edge browser session via DevTools Protocol, bypassing auth and crawler restrictions. Automatically handles auth redirects, waits for network idle, and supports tab reuse to preserve sessions. Returns both plain text and HTML content.",
|
|
195
195
|
inputSchema: {
|
|
196
196
|
type: "object",
|
|
197
197
|
properties: {
|