mcpbrowser 0.2.0 → 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.
Files changed (134) hide show
  1. package/.mcpregistry_github_token +1 -0
  2. package/.mcpregistry_registry_token +1 -0
  3. package/README.md +68 -35
  4. package/extension/.vscodeignore +6 -0
  5. package/extension/LICENSE +21 -0
  6. package/extension/README.md +61 -0
  7. package/extension/icon.png +0 -0
  8. package/extension/icon.svg +35 -0
  9. package/extension/mcpbrowser-0.1.1.vsix +0 -0
  10. package/extension/mcpbrowser-0.1.2.vsix +0 -0
  11. package/extension/mcpbrowser-0.1.3.vsix +0 -0
  12. package/extension/mcpbrowser-0.1.4.vsix +0 -0
  13. package/extension/mcpbrowser-config-0.1.0.vsix +0 -0
  14. package/extension/node_modules/.package-lock.json +32 -0
  15. package/extension/node_modules/@types/node/LICENSE +21 -0
  16. package/extension/node_modules/@types/node/README.md +15 -0
  17. package/extension/node_modules/@types/node/assert/strict.d.ts +8 -0
  18. package/extension/node_modules/@types/node/assert.d.ts +1062 -0
  19. package/extension/node_modules/@types/node/async_hooks.d.ts +605 -0
  20. package/extension/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  21. package/extension/node_modules/@types/node/buffer.d.ts +1936 -0
  22. package/extension/node_modules/@types/node/child_process.d.ts +1475 -0
  23. package/extension/node_modules/@types/node/cluster.d.ts +577 -0
  24. package/extension/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  25. package/extension/node_modules/@types/node/compatibility/index.d.ts +9 -0
  26. package/extension/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  27. package/extension/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  28. package/extension/node_modules/@types/node/console.d.ts +452 -0
  29. package/extension/node_modules/@types/node/constants.d.ts +21 -0
  30. package/extension/node_modules/@types/node/crypto.d.ts +4590 -0
  31. package/extension/node_modules/@types/node/dgram.d.ts +597 -0
  32. package/extension/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  33. package/extension/node_modules/@types/node/dns/promises.d.ts +479 -0
  34. package/extension/node_modules/@types/node/dns.d.ts +871 -0
  35. package/extension/node_modules/@types/node/domain.d.ts +170 -0
  36. package/extension/node_modules/@types/node/events.d.ts +977 -0
  37. package/extension/node_modules/@types/node/fs/promises.d.ts +1270 -0
  38. package/extension/node_modules/@types/node/fs.d.ts +4375 -0
  39. package/extension/node_modules/@types/node/globals.d.ts +172 -0
  40. package/extension/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  41. package/extension/node_modules/@types/node/http.d.ts +2049 -0
  42. package/extension/node_modules/@types/node/http2.d.ts +2631 -0
  43. package/extension/node_modules/@types/node/https.d.ts +578 -0
  44. package/extension/node_modules/@types/node/index.d.ts +93 -0
  45. package/extension/node_modules/@types/node/inspector.generated.d.ts +3966 -0
  46. package/extension/node_modules/@types/node/module.d.ts +539 -0
  47. package/extension/node_modules/@types/node/net.d.ts +1012 -0
  48. package/extension/node_modules/@types/node/os.d.ts +506 -0
  49. package/extension/node_modules/@types/node/package.json +140 -0
  50. package/extension/node_modules/@types/node/path.d.ts +200 -0
  51. package/extension/node_modules/@types/node/perf_hooks.d.ts +961 -0
  52. package/extension/node_modules/@types/node/process.d.ts +1957 -0
  53. package/extension/node_modules/@types/node/punycode.d.ts +117 -0
  54. package/extension/node_modules/@types/node/querystring.d.ts +152 -0
  55. package/extension/node_modules/@types/node/readline/promises.d.ts +162 -0
  56. package/extension/node_modules/@types/node/readline.d.ts +589 -0
  57. package/extension/node_modules/@types/node/repl.d.ts +430 -0
  58. package/extension/node_modules/@types/node/sea.d.ts +153 -0
  59. package/extension/node_modules/@types/node/stream/consumers.d.ts +38 -0
  60. package/extension/node_modules/@types/node/stream/promises.d.ts +90 -0
  61. package/extension/node_modules/@types/node/stream/web.d.ts +533 -0
  62. package/extension/node_modules/@types/node/stream.d.ts +1675 -0
  63. package/extension/node_modules/@types/node/string_decoder.d.ts +67 -0
  64. package/extension/node_modules/@types/node/test.d.ts +1787 -0
  65. package/extension/node_modules/@types/node/timers/promises.d.ts +108 -0
  66. package/extension/node_modules/@types/node/timers.d.ts +286 -0
  67. package/extension/node_modules/@types/node/tls.d.ts +1255 -0
  68. package/extension/node_modules/@types/node/trace_events.d.ts +197 -0
  69. package/extension/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  70. package/extension/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  71. package/extension/node_modules/@types/node/ts5.6/index.d.ts +93 -0
  72. package/extension/node_modules/@types/node/tty.d.ts +208 -0
  73. package/extension/node_modules/@types/node/url.d.ts +964 -0
  74. package/extension/node_modules/@types/node/util.d.ts +2331 -0
  75. package/extension/node_modules/@types/node/v8.d.ts +809 -0
  76. package/extension/node_modules/@types/node/vm.d.ts +1001 -0
  77. package/extension/node_modules/@types/node/wasi.d.ts +181 -0
  78. package/extension/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  79. package/extension/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  80. package/extension/node_modules/@types/node/web-globals/events.d.ts +97 -0
  81. package/extension/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
  82. package/extension/node_modules/@types/node/worker_threads.d.ts +715 -0
  83. package/extension/node_modules/@types/node/zlib.d.ts +540 -0
  84. package/extension/node_modules/@types/vscode/LICENSE +21 -0
  85. package/extension/node_modules/@types/vscode/README.md +15 -0
  86. package/extension/node_modules/@types/vscode/index.d.ts +21153 -0
  87. package/extension/node_modules/@types/vscode/package.json +26 -0
  88. package/extension/node_modules/undici-types/LICENSE +21 -0
  89. package/extension/node_modules/undici-types/README.md +6 -0
  90. package/extension/node_modules/undici-types/agent.d.ts +31 -0
  91. package/extension/node_modules/undici-types/api.d.ts +43 -0
  92. package/extension/node_modules/undici-types/balanced-pool.d.ts +29 -0
  93. package/extension/node_modules/undici-types/cache.d.ts +36 -0
  94. package/extension/node_modules/undici-types/client.d.ts +108 -0
  95. package/extension/node_modules/undici-types/connector.d.ts +34 -0
  96. package/extension/node_modules/undici-types/content-type.d.ts +21 -0
  97. package/extension/node_modules/undici-types/cookies.d.ts +28 -0
  98. package/extension/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  99. package/extension/node_modules/undici-types/dispatcher.d.ts +256 -0
  100. package/extension/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  101. package/extension/node_modules/undici-types/errors.d.ts +149 -0
  102. package/extension/node_modules/undici-types/eventsource.d.ts +61 -0
  103. package/extension/node_modules/undici-types/fetch.d.ts +209 -0
  104. package/extension/node_modules/undici-types/file.d.ts +39 -0
  105. package/extension/node_modules/undici-types/filereader.d.ts +54 -0
  106. package/extension/node_modules/undici-types/formdata.d.ts +108 -0
  107. package/extension/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  108. package/extension/node_modules/undici-types/global-origin.d.ts +7 -0
  109. package/extension/node_modules/undici-types/handlers.d.ts +15 -0
  110. package/extension/node_modules/undici-types/header.d.ts +4 -0
  111. package/extension/node_modules/undici-types/index.d.ts +71 -0
  112. package/extension/node_modules/undici-types/interceptors.d.ts +17 -0
  113. package/extension/node_modules/undici-types/mock-agent.d.ts +50 -0
  114. package/extension/node_modules/undici-types/mock-client.d.ts +25 -0
  115. package/extension/node_modules/undici-types/mock-errors.d.ts +12 -0
  116. package/extension/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  117. package/extension/node_modules/undici-types/mock-pool.d.ts +25 -0
  118. package/extension/node_modules/undici-types/package.json +55 -0
  119. package/extension/node_modules/undici-types/patch.d.ts +33 -0
  120. package/extension/node_modules/undici-types/pool-stats.d.ts +19 -0
  121. package/extension/node_modules/undici-types/pool.d.ts +39 -0
  122. package/extension/node_modules/undici-types/proxy-agent.d.ts +28 -0
  123. package/extension/node_modules/undici-types/readable.d.ts +65 -0
  124. package/extension/node_modules/undici-types/retry-agent.d.ts +8 -0
  125. package/extension/node_modules/undici-types/retry-handler.d.ts +116 -0
  126. package/extension/node_modules/undici-types/util.d.ts +18 -0
  127. package/extension/node_modules/undici-types/webidl.d.ts +228 -0
  128. package/extension/node_modules/undici-types/websocket.d.ts +150 -0
  129. package/extension/package-lock.json +44 -0
  130. package/extension/package.json +55 -0
  131. package/extension/src/extension.js +257 -0
  132. package/package.json +2 -1
  133. package/server.json +20 -0
  134. 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
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "mcpbrowser",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
+ "mcpName": "io.github.cherchyk/browser",
4
5
  "type": "module",
5
6
  "description": "MCP server that loads authenticated web pages using Chrome DevTools Protocol",
6
7
  "main": "src/mcp-browser.js",
package/server.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.cherchyk/browser",
4
+ "description": "Alternative web fetcher for authenticated and crawler-protected pages. Bypasses login requirements and anti-bot restrictions using Chrome DevTools Protocol",
5
+ "repository": {
6
+ "url": "https://github.com/cherchyk/MCPBrowser",
7
+ "source": "github"
8
+ },
9
+ "version": "0.2.1",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "mcpbrowser",
14
+ "version": "0.2.1",
15
+ "transport": {
16
+ "type": "stdio"
17
+ }
18
+ }
19
+ ]
20
+ }
@@ -191,7 +191,7 @@ async function main() {
191
191
  const tools = [
192
192
  {
193
193
  name: "load_and_extract",
194
- description: "Fetch and extract content from authenticated web pages using a local Chrome/Edge browser via DevTools Protocol. Automatically detects auth redirects by waiting for network idle. Supports smart tab reuse within the same domain to preserve authentication sessions. Returns both plain text and HTML content.",
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: {