mcpbrowser 0.2.1 → 0.2.2
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/.mcpregistry_github_token +1 -0
- package/.mcpregistry_registry_token +1 -0
- package/README.md +50 -52
- 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/mcpbrowser-0.1.1.vsix +0 -0
- package/extension/mcpbrowser-0.1.2.vsix +0 -0
- package/extension/mcpbrowser-0.1.3.vsix +0 -0
- package/extension/mcpbrowser-0.1.4.vsix +0 -0
- package/extension/mcpbrowser-config-0.1.0.vsix +0 -0
- package/extension/node_modules/.package-lock.json +32 -0
- package/extension/node_modules/@types/node/LICENSE +21 -0
- package/extension/node_modules/@types/node/README.md +15 -0
- package/extension/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/extension/node_modules/@types/node/assert.d.ts +1062 -0
- package/extension/node_modules/@types/node/async_hooks.d.ts +605 -0
- package/extension/node_modules/@types/node/buffer.buffer.d.ts +471 -0
- package/extension/node_modules/@types/node/buffer.d.ts +1936 -0
- package/extension/node_modules/@types/node/child_process.d.ts +1475 -0
- package/extension/node_modules/@types/node/cluster.d.ts +577 -0
- package/extension/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/extension/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/extension/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/extension/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/extension/node_modules/@types/node/console.d.ts +452 -0
- package/extension/node_modules/@types/node/constants.d.ts +21 -0
- package/extension/node_modules/@types/node/crypto.d.ts +4590 -0
- package/extension/node_modules/@types/node/dgram.d.ts +597 -0
- package/extension/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/extension/node_modules/@types/node/dns/promises.d.ts +479 -0
- package/extension/node_modules/@types/node/dns.d.ts +871 -0
- package/extension/node_modules/@types/node/domain.d.ts +170 -0
- package/extension/node_modules/@types/node/events.d.ts +977 -0
- package/extension/node_modules/@types/node/fs/promises.d.ts +1270 -0
- package/extension/node_modules/@types/node/fs.d.ts +4375 -0
- package/extension/node_modules/@types/node/globals.d.ts +172 -0
- package/extension/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/extension/node_modules/@types/node/http.d.ts +2049 -0
- package/extension/node_modules/@types/node/http2.d.ts +2631 -0
- package/extension/node_modules/@types/node/https.d.ts +578 -0
- package/extension/node_modules/@types/node/index.d.ts +93 -0
- package/extension/node_modules/@types/node/inspector.generated.d.ts +3966 -0
- package/extension/node_modules/@types/node/module.d.ts +539 -0
- package/extension/node_modules/@types/node/net.d.ts +1012 -0
- package/extension/node_modules/@types/node/os.d.ts +506 -0
- package/extension/node_modules/@types/node/package.json +140 -0
- package/extension/node_modules/@types/node/path.d.ts +200 -0
- package/extension/node_modules/@types/node/perf_hooks.d.ts +961 -0
- package/extension/node_modules/@types/node/process.d.ts +1957 -0
- package/extension/node_modules/@types/node/punycode.d.ts +117 -0
- package/extension/node_modules/@types/node/querystring.d.ts +152 -0
- package/extension/node_modules/@types/node/readline/promises.d.ts +162 -0
- package/extension/node_modules/@types/node/readline.d.ts +589 -0
- package/extension/node_modules/@types/node/repl.d.ts +430 -0
- package/extension/node_modules/@types/node/sea.d.ts +153 -0
- package/extension/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/extension/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/extension/node_modules/@types/node/stream/web.d.ts +533 -0
- package/extension/node_modules/@types/node/stream.d.ts +1675 -0
- package/extension/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/extension/node_modules/@types/node/test.d.ts +1787 -0
- package/extension/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/extension/node_modules/@types/node/timers.d.ts +286 -0
- package/extension/node_modules/@types/node/tls.d.ts +1255 -0
- package/extension/node_modules/@types/node/trace_events.d.ts +197 -0
- package/extension/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/extension/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/extension/node_modules/@types/node/ts5.6/index.d.ts +93 -0
- package/extension/node_modules/@types/node/tty.d.ts +208 -0
- package/extension/node_modules/@types/node/url.d.ts +964 -0
- package/extension/node_modules/@types/node/util.d.ts +2331 -0
- package/extension/node_modules/@types/node/v8.d.ts +809 -0
- package/extension/node_modules/@types/node/vm.d.ts +1001 -0
- package/extension/node_modules/@types/node/wasi.d.ts +181 -0
- package/extension/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/extension/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/extension/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/extension/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
- package/extension/node_modules/@types/node/worker_threads.d.ts +715 -0
- package/extension/node_modules/@types/node/zlib.d.ts +540 -0
- package/extension/node_modules/@types/vscode/LICENSE +21 -0
- package/extension/node_modules/@types/vscode/README.md +15 -0
- package/extension/node_modules/@types/vscode/index.d.ts +21153 -0
- package/extension/node_modules/@types/vscode/package.json +26 -0
- package/extension/node_modules/undici-types/LICENSE +21 -0
- package/extension/node_modules/undici-types/README.md +6 -0
- package/extension/node_modules/undici-types/agent.d.ts +31 -0
- package/extension/node_modules/undici-types/api.d.ts +43 -0
- package/extension/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/extension/node_modules/undici-types/cache.d.ts +36 -0
- package/extension/node_modules/undici-types/client.d.ts +108 -0
- package/extension/node_modules/undici-types/connector.d.ts +34 -0
- package/extension/node_modules/undici-types/content-type.d.ts +21 -0
- package/extension/node_modules/undici-types/cookies.d.ts +28 -0
- package/extension/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/extension/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/extension/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/extension/node_modules/undici-types/errors.d.ts +149 -0
- package/extension/node_modules/undici-types/eventsource.d.ts +61 -0
- package/extension/node_modules/undici-types/fetch.d.ts +209 -0
- package/extension/node_modules/undici-types/file.d.ts +39 -0
- package/extension/node_modules/undici-types/filereader.d.ts +54 -0
- package/extension/node_modules/undici-types/formdata.d.ts +108 -0
- package/extension/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/extension/node_modules/undici-types/global-origin.d.ts +7 -0
- package/extension/node_modules/undici-types/handlers.d.ts +15 -0
- package/extension/node_modules/undici-types/header.d.ts +4 -0
- package/extension/node_modules/undici-types/index.d.ts +71 -0
- package/extension/node_modules/undici-types/interceptors.d.ts +17 -0
- package/extension/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/extension/node_modules/undici-types/mock-client.d.ts +25 -0
- package/extension/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/extension/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/extension/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/extension/node_modules/undici-types/package.json +55 -0
- package/extension/node_modules/undici-types/patch.d.ts +33 -0
- package/extension/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/extension/node_modules/undici-types/pool.d.ts +39 -0
- package/extension/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/extension/node_modules/undici-types/readable.d.ts +65 -0
- package/extension/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/extension/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/extension/node_modules/undici-types/util.d.ts +18 -0
- package/extension/node_modules/undici-types/webidl.d.ts +228 -0
- package/extension/node_modules/undici-types/websocket.d.ts +150 -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
|
@@ -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.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "mcpbrowser",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.1",
|
|
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: {
|