mcpbrowser 0.2.32 → 0.2.34
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 +4 -4
- package/package.json +42 -1
- package/server.json +2 -2
- package/.github/workflows/test.yml +0 -33
- package/LICENSE +0 -21
- package/extension/.vscodeignore +0 -7
- package/extension/LICENSE +0 -21
- package/extension/README.md +0 -65
- package/extension/icon.png +0 -0
- package/extension/icon.svg +0 -56
- package/extension/package-lock.json +0 -44
- package/extension/package.json +0 -55
- package/extension/src/extension.js +0 -270
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Restart Claude Desktop after configuration.
|
|
|
75
75
|
### Option 5: Clone from GitHub (Development)
|
|
76
76
|
```bash
|
|
77
77
|
git clone https://github.com/cherchyk/MCPBrowser.git
|
|
78
|
-
cd MCPBrowser
|
|
78
|
+
cd MCPBrowser/MCPBrowser # Navigate to MCP server directory
|
|
79
79
|
npm install
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -121,9 +121,9 @@ Add this entry to your `mcp.json` file under the `"servers"` section:
|
|
|
121
121
|
}
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
Replace `<PATH_TO_MCPBROWSER>` with the full path
|
|
125
|
-
- Windows: `"D:/dev/MCPBrowser/src/mcp-browser.js"`
|
|
126
|
-
- Linux/Mac: `"/home/user/MCPBrowser/src/mcp-browser.js"`
|
|
124
|
+
Replace `<PATH_TO_MCPBROWSER>` with the full path to the MCP server directory in the cloned repository, for example:
|
|
125
|
+
- Windows: `"D:/dev/MCPBrowser/MCPBrowser/src/mcp-browser.js"`
|
|
126
|
+
- Linux/Mac: `"/home/user/MCPBrowser/MCPBrowser/src/mcp-browser.js"`
|
|
127
127
|
|
|
128
128
|
### Step 3: Reload VS Code
|
|
129
129
|
Restart VS Code or reload the window for the changes to take effect.
|
package/package.json
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "mcpbrowser",
|
|
3
|
+
"version": "0.2.34",
|
|
4
|
+
"mcpName": "io.github.cherchyk/mcpbrowser",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "MCP server for in-browser web page fetching using Chrome DevTools Protocol",
|
|
7
|
+
"main": "src/mcp-browser.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcpbrowser": "src/mcp-browser.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"mcp": "node src/mcp-browser.js",
|
|
13
|
+
"test": "node --test tests/*.test.js"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"mcp-server",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"chrome",
|
|
20
|
+
"puppeteer",
|
|
21
|
+
"authentication",
|
|
22
|
+
"web-scraping",
|
|
23
|
+
"github-copilot"
|
|
24
|
+
],
|
|
25
|
+
"author": "cherchyk",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/cherchyk/MCPBrowser.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/cherchyk/MCPBrowser/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/cherchyk/MCPBrowser#readme",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
37
|
+
"puppeteer-core": "^23.4.1"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/server.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
-
"name": "io.github.cherchyk/
|
|
3
|
+
"name": "io.github.cherchyk/mcpbrowser",
|
|
4
4
|
"description": "In-browser web page fetching using Chrome DevTools Protocol. Handles auth-required pages, anti-bot/crawler blocks, and JavaScript-heavy sites",
|
|
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.34",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
name: MCP Server Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [18.x, 20.x, 22.x]
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Setup Node.js ${{ matrix.node-version }}
|
|
21
|
-
uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: ${{ matrix.node-version }}
|
|
24
|
-
cache: 'npm'
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: npm ci
|
|
28
|
-
|
|
29
|
-
- name: Run MCP server tests
|
|
30
|
-
run: npm run test:mcp
|
|
31
|
-
|
|
32
|
-
- name: Run unit tests (excluding integration tests)
|
|
33
|
-
run: node --test tests/auth-flow.test.js tests/domain-tab-pooling.test.js tests/mcp-server.test.js tests/prepare-html.test.js tests/redirect-detection.test.js
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
package/extension/.vscodeignore
DELETED
package/extension/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
package/extension/README.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# MCP Browser
|
|
2
|
-
|
|
3
|
-
**Lightweight MCP server-extension for in-browser web page fetching.** Used when loading web page via browser is preferred - handles login, SSO, anti-crawler restrictions. Should be used when standard fetch_webpage fails.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🚀 **One-Click Setup**: Installs npm package and configures mcp.json automatically - complete setup with a single click
|
|
8
|
-
- 🔐 **Authentication Support**: Fetches web pages in your Chrome/Edge browser - authenticate once, reuse sessions automatically
|
|
9
|
-
- 🤖 **Bypass Anti-Crawler**: Fetch sites that block automated tools, including CAPTCHA and human verification
|
|
10
|
-
|
|
11
|
-
## How It Works
|
|
12
|
-
|
|
13
|
-
When Copilot needs to fetch a web page via browser:
|
|
14
|
-
1. MCPBrowser opens the URL in your Chrome/Edge browser
|
|
15
|
-
2. If authentication is required, you log in normally in the browser
|
|
16
|
-
3. MCPBrowser waits for the web page to fully load (handles redirects automatically)
|
|
17
|
-
4. Once loaded, it extracts the content and returns it to Copilot
|
|
18
|
-
5. The browser tab stays open to reuse your session for future requests
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
### Installation Steps
|
|
23
|
-
|
|
24
|
-
1. Install this extension from VS Code marketplace
|
|
25
|
-
2. You'll see a notification: **"MCPBrowser is available! Would you like to configure it for GitHub Copilot?"**
|
|
26
|
-
3. Click **"Configure Now"**
|
|
27
|
-
4. Wait for "Installing MCPBrowser npm package..." to complete
|
|
28
|
-
5. When you see **"MCPBrowser configured successfully!"**, click **"Restart Now"**
|
|
29
|
-
6. After restart, MCPBrowser is ready to use with Copilot!
|
|
30
|
-
|
|
31
|
-
### Using with GitHub Copilot
|
|
32
|
-
|
|
33
|
-
Once configured, Copilot will automatically use MCPBrowser when it encounters auth/crawler blocks. You can also explicitly request it:
|
|
34
|
-
|
|
35
|
-
**Example prompts:**
|
|
36
|
-
```
|
|
37
|
-
Fetch https://internal.company.com/docs (I'm already logged in)
|
|
38
|
-
|
|
39
|
-
Fetch the content from https://portal.azure.com/resources - use my authenticated session
|
|
40
|
-
|
|
41
|
-
Fetch https://github.com/private-repo/issues using MCPBrowser
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Copilot will use your Chrome/Edge browser session to fetch these pages, bypassing authentication and anti-crawler restrictions.
|
|
45
|
-
|
|
46
|
-
### Manual Commands
|
|
47
|
-
|
|
48
|
-
Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`):
|
|
49
|
-
- **Configure MCPBrowser for GitHub Copilot** - Set up or update configuration
|
|
50
|
-
- **Remove MCPBrowser from GitHub Copilot** - Remove configuration
|
|
51
|
-
|
|
52
|
-
## About MCPBrowser
|
|
53
|
-
|
|
54
|
-
Alternative web fetcher for GitHub Copilot when normal URL fetch fails. Uses Chrome DevTools Protocol to fetch authenticated and crawler-protected web pages through your browser session.
|
|
55
|
-
|
|
56
|
-
**Use cases:**
|
|
57
|
-
1. **Auth-required pages**: 401/403 errors, login pages, SSO, corporate intranets
|
|
58
|
-
2. **Anti-bot/crawler blocks**: CAPTCHA, human verification, bot detection
|
|
59
|
-
3. **JavaScript-heavy sites**: SPAs, dynamic content requiring browser rendering
|
|
60
|
-
|
|
61
|
-
Learn more: [MCPBrowser on GitHub](https://github.com/cherchyk/MCPBrowser)
|
|
62
|
-
|
|
63
|
-
## License
|
|
64
|
-
|
|
65
|
-
MIT
|
package/extension/icon.png
DELETED
|
Binary file
|
package/extension/icon.svg
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<svg width="128" height="128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<!-- Modern gradient with MCP typography focus -->
|
|
3
|
-
<defs>
|
|
4
|
-
<linearGradient id="bg6" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
5
|
-
<stop offset="0%" style="stop-color:#4F46E5;stop-opacity:1" />
|
|
6
|
-
<stop offset="100%" style="stop-color:#6366F1;stop-opacity:1" />
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
|
|
10
|
-
<!-- Gradient background -->
|
|
11
|
-
<rect width="128" height="128" rx="24" fill="url(#bg6)"/>
|
|
12
|
-
|
|
13
|
-
<!-- Large white rounded square -->
|
|
14
|
-
<rect x="16" y="16" width="96" height="96" rx="16" fill="white" opacity="0.98"/>
|
|
15
|
-
|
|
16
|
-
<!-- Top section with browser chrome -->
|
|
17
|
-
<rect x="24" y="24" width="80" height="14" rx="7" fill="#F8FAFC"/>
|
|
18
|
-
|
|
19
|
-
<!-- Browser dots -->
|
|
20
|
-
<circle cx="32" cy="31" r="2" fill="#E5E7EB"/>
|
|
21
|
-
<circle cx="40" cy="31" r="2" fill="#E5E7EB"/>
|
|
22
|
-
<circle cx="48" cy="31" r="2" fill="#E5E7EB"/>
|
|
23
|
-
|
|
24
|
-
<!-- Lock with shield -->
|
|
25
|
-
<g transform="translate(72, 26)">
|
|
26
|
-
<circle cx="5" cy="5" r="5" fill="#10B981"/>
|
|
27
|
-
<path d="M 3.5 5 L 3.5 3.8 C 3.5 3 4 2.5 5 2.5 C 6 2.5 6.5 3 6.5 3.8 L 6.5 5"
|
|
28
|
-
stroke="white" stroke-width="0.8" fill="none"/>
|
|
29
|
-
<rect x="3" y="5" width="4" height="4" rx="0.5" fill="white"/>
|
|
30
|
-
</g>
|
|
31
|
-
|
|
32
|
-
<!-- Large MCP text - main focus -->
|
|
33
|
-
<text x="64" y="68" font-family="Arial, sans-serif" font-size="32" font-weight="bold" fill="#4F46E5" text-anchor="middle">MCP</text>
|
|
34
|
-
|
|
35
|
-
<!-- Subtitle -->
|
|
36
|
-
<text x="64" y="82" font-family="Arial, sans-serif" font-size="9" fill="#475569" text-anchor="middle">BROWSER</text>
|
|
37
|
-
|
|
38
|
-
<!-- Bottom decorative line -->
|
|
39
|
-
<rect x="36" y="92" width="56" height="2" rx="1" fill="#E0E7FF"/>
|
|
40
|
-
|
|
41
|
-
<!-- Connection dots -->
|
|
42
|
-
<circle cx="44" cy="100" r="2.5" fill="#10B981"/>
|
|
43
|
-
<circle cx="52" cy="100" r="2.5" fill="#10B981" opacity="0.6"/>
|
|
44
|
-
<circle cx="60" cy="100" r="2.5" fill="#10B981" opacity="0.3"/>
|
|
45
|
-
|
|
46
|
-
<!-- Security badge -->
|
|
47
|
-
<g transform="translate(66, 96)">
|
|
48
|
-
<circle cx="6" cy="4" r="6" fill="#10B981"/>
|
|
49
|
-
<path d="M 4 4 L 5.5 5.5 L 8.5 2.5"
|
|
50
|
-
stroke="white"
|
|
51
|
-
stroke-width="1.2"
|
|
52
|
-
stroke-linecap="round"
|
|
53
|
-
stroke-linejoin="round"
|
|
54
|
-
fill="none"/>
|
|
55
|
-
</g>
|
|
56
|
-
</svg>
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
}
|
package/extension/package.json
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mcpbrowser",
|
|
3
|
-
"displayName": "MCP Browser",
|
|
4
|
-
"description": "Lightweight MCP server-extension for in-browser web page fetching - handles login, SSO, and anti-crawler restrictions. Should be used when standard fetch_webpage fails",
|
|
5
|
-
"version": "0.2.32",
|
|
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
|
-
}
|
|
@@ -1,270 +0,0 @@
|
|
|
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
|
-
// 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);
|
|
57
|
-
|
|
58
|
-
vscode.window.showInformationMessage('MCPBrowser package installed successfully!');
|
|
59
|
-
return true;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error('Error installing MCPBrowser:', error);
|
|
62
|
-
vscode.window.showErrorMessage(`Failed to install MCPBrowser: ${error.message}`);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Add MCPBrowser configuration to mcp.json
|
|
69
|
-
*/
|
|
70
|
-
async function configureMcpBrowser() {
|
|
71
|
-
try {
|
|
72
|
-
const mcpPath = getMcpConfigPath();
|
|
73
|
-
let config;
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const content = await fs.readFile(mcpPath, 'utf-8');
|
|
77
|
-
config = JSON.parse(content);
|
|
78
|
-
} catch (error) {
|
|
79
|
-
// File doesn't exist, create new config
|
|
80
|
-
config = { servers: {} };
|
|
81
|
-
// Ensure directory exists
|
|
82
|
-
await fs.mkdir(path.dirname(mcpPath), { recursive: true });
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Ensure servers object exists
|
|
86
|
-
if (!config.servers) {
|
|
87
|
-
config.servers = {};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Add MCPBrowser configuration
|
|
91
|
-
config.servers.MCPBrowser = {
|
|
92
|
-
type: "stdio",
|
|
93
|
-
command: "npx",
|
|
94
|
-
args: ["-y", "mcpbrowser@latest"],
|
|
95
|
-
description: "Web page fetching via browser for sites requiring authentication, anti-bot protection, or JavaScript rendering. Use when standard HTTP requests fail for: (1) auth-required pages (401/403, SSO, corporate intranets), (2) anti-bot verification (CAPTCHA, Cloudflare), (3) JavaScript-heavy sites (SPAs, dynamic content). Opens a browser where the user can authenticate, then automatically extracts content."
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Write back to file with pretty formatting
|
|
99
|
-
await fs.writeFile(mcpPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
100
|
-
|
|
101
|
-
return true;
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error('Error configuring MCPBrowser:', error);
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Remove MCPBrowser configuration from mcp.json
|
|
110
|
-
*/
|
|
111
|
-
async function removeMcpBrowser() {
|
|
112
|
-
try {
|
|
113
|
-
const mcpPath = getMcpConfigPath();
|
|
114
|
-
const content = await fs.readFile(mcpPath, 'utf-8');
|
|
115
|
-
const config = JSON.parse(content);
|
|
116
|
-
|
|
117
|
-
if (config.servers && config.servers.MCPBrowser) {
|
|
118
|
-
delete config.servers.MCPBrowser;
|
|
119
|
-
await fs.writeFile(mcpPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return false;
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error('Error removing MCPBrowser:', error);
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Check if MCPBrowser npm package is installed
|
|
132
|
-
*/
|
|
133
|
-
async function checkMcpBrowserInstalled() {
|
|
134
|
-
try {
|
|
135
|
-
const { exec } = require('child_process');
|
|
136
|
-
return new Promise((resolve) => {
|
|
137
|
-
exec('npm list -g mcpbrowser', (error, stdout, stderr) => {
|
|
138
|
-
// If package is found globally or locally, it will be in stdout
|
|
139
|
-
resolve(stdout.includes('mcpbrowser'));
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
} catch (error) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Show notification to configure MCPBrowser
|
|
149
|
-
*/
|
|
150
|
-
async function showConfigurationPrompt(context) {
|
|
151
|
-
const configured = await isMcpBrowserConfigured();
|
|
152
|
-
|
|
153
|
-
if (!configured) {
|
|
154
|
-
const action = await vscode.window.showInformationMessage(
|
|
155
|
-
'MCPBrowser is available! Would you like to configure it for GitHub Copilot?',
|
|
156
|
-
'Configure Now',
|
|
157
|
-
'Not Now',
|
|
158
|
-
"Don't Ask Again"
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
if (action === 'Configure Now') {
|
|
162
|
-
vscode.commands.executeCommand('mcpbrowser.configure');
|
|
163
|
-
} else if (action === "Don't Ask Again") {
|
|
164
|
-
// Store in workspace state to not show again
|
|
165
|
-
context.globalState.update('mcpbrowser.dontAskAgain', true);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Extension activation
|
|
172
|
-
*/
|
|
173
|
-
async function activate(context) {
|
|
174
|
-
console.log('MCPBrowser extension is now active');
|
|
175
|
-
|
|
176
|
-
// Register configure command
|
|
177
|
-
let configureCommand = vscode.commands.registerCommand('mcpbrowser.configure', async () => {
|
|
178
|
-
try {
|
|
179
|
-
const configured = await isMcpBrowserConfigured();
|
|
180
|
-
|
|
181
|
-
if (configured) {
|
|
182
|
-
const action = await vscode.window.showWarningMessage(
|
|
183
|
-
'MCPBrowser is already configured. Do you want to update it?',
|
|
184
|
-
'Update',
|
|
185
|
-
'Cancel'
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
if (action !== 'Update') {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Step 1: Install npm package
|
|
194
|
-
const installed = await installMcpBrowser();
|
|
195
|
-
if (!installed) {
|
|
196
|
-
return; // Installation failed, abort
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Step 2: Configure mcp.json
|
|
200
|
-
await configureMcpBrowser();
|
|
201
|
-
|
|
202
|
-
const restart = await vscode.window.showInformationMessage(
|
|
203
|
-
'✓ MCPBrowser configured successfully! Restart VS Code to use it with GitHub Copilot.',
|
|
204
|
-
'Restart Now',
|
|
205
|
-
'Later'
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
if (restart === 'Restart Now') {
|
|
209
|
-
vscode.commands.executeCommand('workbench.action.reloadWindow');
|
|
210
|
-
}
|
|
211
|
-
} catch (error) {
|
|
212
|
-
vscode.window.showErrorMessage(
|
|
213
|
-
`Failed to configure MCPBrowser: ${error.message}`
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
// Register remove command
|
|
219
|
-
let removeCommand = vscode.commands.registerCommand('mcpbrowser.remove', async () => {
|
|
220
|
-
try {
|
|
221
|
-
const confirm = await vscode.window.showWarningMessage(
|
|
222
|
-
'Are you sure you want to remove MCPBrowser configuration?',
|
|
223
|
-
'Remove',
|
|
224
|
-
'Cancel'
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
if (confirm !== 'Remove') {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const removed = await removeMcpBrowser();
|
|
232
|
-
|
|
233
|
-
if (removed) {
|
|
234
|
-
vscode.window.showInformationMessage(
|
|
235
|
-
'✓ MCPBrowser configuration removed. Restart VS Code for changes to take effect.'
|
|
236
|
-
);
|
|
237
|
-
} else {
|
|
238
|
-
vscode.window.showInformationMessage(
|
|
239
|
-
'MCPBrowser was not configured.'
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
} catch (error) {
|
|
243
|
-
vscode.window.showErrorMessage(
|
|
244
|
-
`Failed to remove MCPBrowser: ${error.message}`
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
context.subscriptions.push(configureCommand);
|
|
250
|
-
context.subscriptions.push(removeCommand);
|
|
251
|
-
|
|
252
|
-
// Show configuration prompt if not already configured and user hasn't dismissed
|
|
253
|
-
const dontAskAgain = context.globalState.get('mcpbrowser.dontAskAgain', false);
|
|
254
|
-
if (!dontAskAgain) {
|
|
255
|
-
// Wait a bit after startup to not be intrusive
|
|
256
|
-
setTimeout(() => {
|
|
257
|
-
showConfigurationPrompt(context);
|
|
258
|
-
}, 5000);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Extension deactivation
|
|
264
|
-
*/
|
|
265
|
-
function deactivate() {}
|
|
266
|
-
|
|
267
|
-
module.exports = {
|
|
268
|
-
activate,
|
|
269
|
-
deactivate
|
|
270
|
-
};
|