@agent360/browser-mcp 1.25.0 → 1.28.1
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 +95 -21
- package/bin/cli.js +102 -44
- package/extension/background.js +934 -109
- package/extension/icons/icon-128.png +0 -0
- package/extension/icons/icon-48.png +0 -0
- package/extension/manifest.json +2 -2
- package/extension/offscreen.js +142 -10
- package/extension/popup.html +36 -2
- package/extension/popup.js +37 -21
- package/index.js +686 -54
- package/package.json +17 -3
- package/tools.js +95 -8
- package/vagt.js +57 -0
package/README.md
CHANGED
|
@@ -17,17 +17,47 @@ Browser MCP gives Claude Code (and any MCP client — Cursor, VS Code agent mode
|
|
|
17
17
|
|
|
18
18
|
The killer move: it hits a login wall, reads the verification code from your own Gmail tab, and continues the sign-in. No API can do that. Operate platforms with no API, QA your own web app end-to-end, or work dashboards, LinkedIn and Reddit at human pace — with you approving the sensitive steps.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
40 tools. Auto-clicks the reCAPTCHA v2 checkbox, with a human fallback for the rest. Multi-session color-coded tab groups. **MIT, free, and 100% local — nothing leaves your machine.**
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## The whole thing, in four steps
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**1 — Install the Chrome extension.** One click from the [Chrome Web Store](https://chromewebstore.google.com/detail/agent360-browser-mcp/jdehgalffmffhfhmmhaokfbfnafnmgcl); Chrome keeps it updated. No store? See the unpacked install below.
|
|
25
|
+
|
|
26
|
+
**2 — Add the MCP server.** Paste this in a terminal. Required — the extension does nothing on its own:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**3 — Restart Claude Code.** That is what starts the server. The extension icon turns green.
|
|
33
|
+
|
|
34
|
+
**4 — Say this, to check it worked.** Paste it to Claude Code:
|
|
35
|
+
|
|
36
|
+
> Take a screenshot of my current Chrome tab.
|
|
37
|
+
|
|
38
|
+
You get an image back instead of *"I don't have browser access"*. **That's it — you're running.** → [What else to say](#youre-in-now-what)
|
|
39
|
+
|
|
40
|
+
Using Cursor, VS Code, Codex or Windsurf? Same server, that client's own config — see [browsermcp.dev/docs](https://browsermcp.dev/docs/install-cursor/). Everything below is the long version.
|
|
41
|
+
|
|
42
|
+
## The long version — install, step by step
|
|
43
|
+
|
|
44
|
+
> **Browser MCP is two halves and you need both:** a **Chrome extension** (drives the browser) and a **local MCP server** (what your agent actually talks to). Installing only the extension — e.g. straight from the Chrome Web Store — leaves it stuck on *"Not connected"*, because there is no server for it to reach. Chrome cannot install the server, and npm cannot install the extension. Hence two steps.
|
|
45
|
+
|
|
46
|
+
### Step 1: Register the MCP server with Claude Code
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
That is Claude Code's own MCP command, so the entry lands in the config Claude Code actually reads. `--scope user` makes it available in every project.
|
|
53
|
+
|
|
54
|
+
Want the extension files on disk for the unpacked install in Step 2? Also run:
|
|
25
55
|
|
|
26
56
|
```bash
|
|
27
57
|
npx @agent360/browser-mcp install
|
|
28
58
|
```
|
|
29
59
|
|
|
30
|
-
|
|
60
|
+
It copies the extension to `~/.browser-mcp/extension/` and **prints that path in the terminal — copy it.** (Use it for the extension files only; register the server with `claude mcp add` above.)
|
|
31
61
|
|
|
32
62
|
### Step 2: Load the extension in Chrome
|
|
33
63
|
|
|
@@ -42,49 +72,84 @@ This copies the Chrome extension files to `~/.browser-mcp/extension/` and adds t
|
|
|
42
72
|
- On Linux: Type `~/.browser-mcp/extension/` in the path field
|
|
43
73
|
5. **Restart Claude Code** so it picks up the new MCP server
|
|
44
74
|
|
|
45
|
-
That's it. The Browser MCP icon will appear in your toolbar, and
|
|
75
|
+
That's it. The Browser MCP icon will appear in your toolbar, and 40 browser tools are now available in Claude Code.
|
|
46
76
|
|
|
47
77
|
### Alternative: Manual zip download (no npm)
|
|
48
78
|
|
|
49
79
|
If you don't want to use npm, download the extension directly:
|
|
50
80
|
|
|
51
|
-
1. [Download
|
|
81
|
+
1. [Download the extension zip](https://github.com/Agent360dk/browser-mcp/releases/latest) (`agent360-browser-mcp-<version>.zip`) from the latest GitHub release
|
|
52
82
|
2. Unzip the file (anywhere — e.g. `~/Downloads/browser-mcp-extension/`)
|
|
53
83
|
3. Follow Step 2 above, but select the unzipped folder instead of `~/.browser-mcp/extension/`
|
|
54
|
-
4.
|
|
84
|
+
4. Register the server — run `claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest`, or add this to `~/.claude.json` by hand:
|
|
55
85
|
```json
|
|
56
86
|
{
|
|
57
87
|
"mcpServers": {
|
|
58
88
|
"browser-mcp": {
|
|
59
89
|
"command": "npx",
|
|
60
|
-
"args": ["@agent360/browser-mcp"]
|
|
90
|
+
"args": ["@agent360/browser-mcp@latest"]
|
|
61
91
|
}
|
|
62
92
|
}
|
|
63
93
|
}
|
|
64
94
|
```
|
|
65
95
|
|
|
66
|
-
### Chrome Web Store (
|
|
96
|
+
### Chrome Web Store (no Developer mode, auto-updating extension)
|
|
97
|
+
|
|
98
|
+
**This replaces Step 2 only — you still need Step 1.**
|
|
99
|
+
|
|
100
|
+
1. [**Install the extension from the Chrome Web Store →**](https://chromewebstore.google.com/detail/agent360-browser-mcp/jdehgalffmffhfhmmhaokfbfnafnmgcl) — no Developer mode toggle, and Chrome keeps it updated for you.
|
|
101
|
+
2. Register the MCP server:
|
|
102
|
+
```bash
|
|
103
|
+
claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest
|
|
104
|
+
```
|
|
105
|
+
(For Cursor / VS Code / Codex, use that client's own MCP config instead — see [browsermcp.dev/docs](https://browsermcp.dev/docs/install-claude-code/).)
|
|
106
|
+
3. Restart Claude Code.
|
|
107
|
+
|
|
108
|
+
Skip step 2 and the extension icon will sit on **"Not connected"** forever — that is the symptom of a missing MCP server, not a broken extension.
|
|
109
|
+
|
|
110
|
+
## You're in. Now what?
|
|
111
|
+
|
|
112
|
+
Nothing happens until you ask, and the hardest part of a new tool is knowing what to ask for. Paste one of these to your agent:
|
|
67
113
|
|
|
68
|
-
|
|
114
|
+
| Say this | What it shows |
|
|
115
|
+
|---|---|
|
|
116
|
+
| *"Take a screenshot of my current Chrome tab."* | **Start here.** An image back instead of *"I don't have browser access"* means both halves are talking. That is the whole install test. |
|
|
117
|
+
| *"Open my Gmail tab and tell me who sent my last 3 emails."* | The one that shows the difference — it works because it is *your* browser, already signed in. A headless tool hits a login wall here. |
|
|
118
|
+
| *"Go to my analytics dashboard, pull this month's numbers, and put them in a table."* | Any dashboard you are already logged into. No API key, no export, no integration to build first. |
|
|
119
|
+
| *"Fill in this signup form with my details. Stop and ask me before anything sensitive."* | You stay in the loop — it hands control back for passwords, payment details, or anything it should not decide alone. |
|
|
120
|
+
| *"Log me in here. If it emails a code, read it from my Gmail tab and continue."* | The move no API can make: it reads the one-time code out of your own inbox and finishes the sign-in. |
|
|
121
|
+
| *"Walk through my app's signup flow as a real user and tell me where it breaks."* | End-to-end QA of your own product, in the same browser your users have. |
|
|
69
122
|
|
|
70
|
-
|
|
123
|
+
The pattern: **anything you would do yourself in a browser, on a site you are already signed into.** It is strongest where there is no API — internal dashboards, admin panels, portals, LinkedIn. Built something good? [Add it to the gallery](USE_CASES.md).
|
|
71
124
|
|
|
72
125
|
## Why This Over Playwright MCP / BrowserMCP?
|
|
73
126
|
|
|
74
127
|
| | Browser MCP | Playwright MCP | BrowserMCP.io |
|
|
75
128
|
|---|---|---|---|
|
|
76
129
|
| **Browser** | Your real Chrome | Headless (new session) | Your real Chrome |
|
|
130
|
+
| **Maintained** | Actively — latest release v1.25.0 (2026-07-24) | Actively (Microsoft) | Last commit Apr 2025 |
|
|
77
131
|
| **Logins/cookies** | Already authenticated | Must log in every time | Already authenticated |
|
|
78
|
-
| **Multi-session** |
|
|
132
|
+
| **Multi-session** | 20 concurrent sessions with color-coded tab groups | Single session | Single session |
|
|
79
133
|
| **Human-in-the-loop** | `browser_ask_user` — 2FA, CAPTCHA, credential input | None | None |
|
|
80
134
|
| **Provider integrations** | 9 built-in (Stripe, HubSpot, Slack...) | None | None |
|
|
81
135
|
| **CORS bypass** | `browser_fetch` from extension background | N/A | Limited |
|
|
82
136
|
| **Network monitoring** | `browser_wait_for_network` via CDP | Built-in | None |
|
|
83
137
|
| **CSP-strict sites** | Chrome Debugger API throughout | Works (headless) | Limited |
|
|
84
138
|
| **Custom dropdowns** | Angular Material, React Select support | Works (headless) | Limited |
|
|
85
|
-
| **Install** | `
|
|
139
|
+
| **Install** | `claude mcp add` + extension from the Chrome Web Store | `npx @playwright/mcp` | Manual clone |
|
|
86
140
|
|
|
87
|
-
|
|
141
|
+
> **On the name:** the similarly-named `browsermcp.io` (`@browsermcp/mcp`) is a different, unaffiliated project with no commits since April 2025. This is Browser MCP by Agent360 (`@agent360/browser-mcp`) — actively maintained. [Full side-by-side →](https://browsermcp.dev/compare/browsermcp-io/)
|
|
142
|
+
|
|
143
|
+
### Environment variables
|
|
144
|
+
|
|
145
|
+
Both are optional. Neither is needed for normal use.
|
|
146
|
+
|
|
147
|
+
| Variable | Effect |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `BROWSER_MCP_CHECK_NPM=1` | Makes `browser_provide_feedback` also compare this server against the latest version published on npm. Off by default, so the call stays fast and works offline. |
|
|
150
|
+
| `BROWSER_MCP_EXTENSION_ID=<32-char id>` | Pins the server to one specific Chrome extension. Use it when more than one copy of Browser MCP is loaded and you want a given session to always talk to the same one. |
|
|
151
|
+
|
|
152
|
+
## 40 Tools
|
|
88
153
|
|
|
89
154
|
### Navigation & Content
|
|
90
155
|
| Tool | Description |
|
|
@@ -93,6 +158,7 @@ No Developer mode needed. Then run `npx @agent360/browser-mcp install --skip-ext
|
|
|
93
158
|
| `browser_get_page_content` | Get page text or HTML |
|
|
94
159
|
| `browser_screenshot` | Screenshot via Chrome Debugger (works even when tab isn't focused) |
|
|
95
160
|
| `browser_execute_script` | Run JavaScript in page context |
|
|
161
|
+
| `browser_extract_list` | Read every row of a long/virtualised list by scrolling its container until no new rows appear |
|
|
96
162
|
|
|
97
163
|
### Interaction
|
|
98
164
|
| Tool | Description |
|
|
@@ -108,6 +174,10 @@ No Developer mode needed. Then run `npx @agent360/browser-mcp install --skip-ext
|
|
|
108
174
|
| `browser_set_date` | Robust date inputs: tries native value-set → masked typing → calendar-picker navigation (MUI/AntD/react-datepicker/Lexical). Use when `browser_fill` fails on date fields |
|
|
109
175
|
| `browser_dismiss_overlays` | Bulk-dismiss popups/modals/tooltips/banners via aria-label/text/×-char heuristics. `non_critical` mode preserves dialogs with form data |
|
|
110
176
|
| `browser_handle_dialog` | Accept/dismiss native alert/confirm/prompt dialogs |
|
|
177
|
+
| `browser_double_click` | True double-click (two trusted press/release pairs) |
|
|
178
|
+
| `browser_right_click` | Right-click to open page-level context menus |
|
|
179
|
+
| `browser_click_xy` | Escape hatch: click at raw viewport coordinates (CSS pixels) with trusted mouse events |
|
|
180
|
+
| `browser_reattach_debugger` | Recovery: force-detach and re-attach the Chrome debugger on the current tab |
|
|
111
181
|
|
|
112
182
|
### Tabs & Frames
|
|
113
183
|
| Tool | Description |
|
|
@@ -122,8 +192,6 @@ No Developer mode needed. Then run `npx @agent360/browser-mcp install --skip-ext
|
|
|
122
192
|
### Data & Network
|
|
123
193
|
| Tool | Description |
|
|
124
194
|
|------|-------------|
|
|
125
|
-
| `browser_get_cookies` | Get cookies for domain |
|
|
126
|
-
| `browser_get_local_storage` | Read localStorage |
|
|
127
195
|
| `browser_fetch` | HTTP request from extension (bypasses CORS) |
|
|
128
196
|
| `browser_wait_for_network` | Wait for specific API call to complete |
|
|
129
197
|
| `browser_extract_token` | Navigate to provider dashboard + extract API token |
|
|
@@ -149,9 +217,15 @@ No Developer mode needed. Then run `npx @agent360/browser-mcp install --skip-ext
|
|
|
149
217
|
| `browser_upload_file` | Upload files to `<input type="file">` via Chrome Debugger API (no dialog) |
|
|
150
218
|
| `browser_drop_file` | Upload via drop-zones: finds hidden `<input type="file">` in target subtree/parent (up to 2 levels). Use when `browser_upload_file` fails because the zone has no visible input |
|
|
151
219
|
|
|
220
|
+
### Diagnostics & feedback
|
|
221
|
+
| Tool | Description |
|
|
222
|
+
|------|-------------|
|
|
223
|
+
| `browser_provide_feedback` | Self-check + report in one call. Compares this server against the latest on npm, the connected extension against this server, and detects **more than one Browser MCP extension connected at once** — the three things that explain most "it just stopped working" moments. Returns a verdict (`current` / `outdated` / `conflict` / `disconnected`), concrete fix steps, and a pre-filled issue link for whatever is genuinely missing. Your agent calls it on its own whenever a tool blocks it |
|
|
224
|
+
| `browser_about` | Project info + pre-filled links to submit a wish, use-case, or bug |
|
|
225
|
+
|
|
152
226
|
## Multi-Session Support
|
|
153
227
|
|
|
154
|
-
Each Claude Code conversation gets its own MCP server on a unique port (9876-
|
|
228
|
+
Each Claude Code conversation gets its own MCP server on a unique port (9876-9895). The Chrome extension connects to all active servers simultaneously.
|
|
155
229
|
|
|
156
230
|
```
|
|
157
231
|
Claude Session 1 ←(stdio)→ MCP :9876 ←(WS)→
|
|
@@ -190,13 +264,13 @@ extension/
|
|
|
190
264
|
|
|
191
265
|
mcp-server/
|
|
192
266
|
index.js # MCP server (stdio) + WebSocket client
|
|
193
|
-
tools.js #
|
|
267
|
+
tools.js # 40 tool definitions
|
|
194
268
|
bin/cli.js # Install CLI
|
|
195
269
|
```
|
|
196
270
|
|
|
197
271
|
### How It Works
|
|
198
272
|
1. Claude Code starts → spawns MCP server via stdio
|
|
199
|
-
2. MCP server binds to first available port (9876-
|
|
273
|
+
2. MCP server binds to first available port (9876-9895)
|
|
200
274
|
3. Extension's offscreen document scans ports every 2s
|
|
201
275
|
4. WebSocket connection established
|
|
202
276
|
5. Commands flow: Claude Code → MCP → Extension → Chrome APIs
|
|
@@ -214,7 +288,7 @@ Browser MCP has two parts, and they update independently — how the **extension
|
|
|
214
288
|
|
|
215
289
|
**Not sure which you have?** Open `chrome://extensions` and find Browser MCP. If it shows a **"Loaded from /path/…"** line, it's unpacked (manual updates). If there's no such line, it came from the Chrome Web Store (auto-updates).
|
|
216
290
|
|
|
217
|
-
**Want zero-maintenance updates?** Install the extension from the [Chrome Web Store](https://chromewebstore.google.com/detail/agent360-browser-mcp/jdehgalffmffhfhmmhaokfbfnafnmgcl), then run `npx @agent360/browser-mcp
|
|
291
|
+
**Want zero-maintenance updates?** Install the extension from the [Chrome Web Store](https://chromewebstore.google.com/detail/agent360-browser-mcp/jdehgalffmffhfhmmhaokfbfnafnmgcl), then run `claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest` to register the server. After that, both parts stay current on their own — as long as your config uses `@agent360/browser-mcp@latest`.
|
|
218
292
|
|
|
219
293
|
## Troubleshooting
|
|
220
294
|
|
|
@@ -234,7 +308,7 @@ Browser MCP has two parts, and they update independently — how the **extension
|
|
|
234
308
|
**Stale processes**
|
|
235
309
|
- Processes auto-exit when Claude Code closes (stdin detection)
|
|
236
310
|
- Idle timeout: 4 hours without commands → auto-exit
|
|
237
|
-
- Manual cleanup: `lsof -i :9876-
|
|
311
|
+
- Manual cleanup: `lsof -i :9876-9895 | grep LISTEN`
|
|
238
312
|
|
|
239
313
|
## 💡 Help Shape Browser MCP
|
|
240
314
|
|
package/bin/cli.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Browser MCP CLI —
|
|
4
|
+
* Browser MCP CLI — put the extension on disk + register the MCP server
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
* npx @agent360/browser-mcp install
|
|
8
|
-
* npx @agent360/browser-mcp
|
|
7
|
+
* npx @agent360/browser-mcp install — extension files + register server
|
|
8
|
+
* npx @agent360/browser-mcp install --skip-extension — register the server only
|
|
9
|
+
* npx @agent360/browser-mcp — start MCP server (the client calls this)
|
|
10
|
+
*
|
|
11
|
+
* Registration goes through `claude mcp add`, i.e. Claude Code's own command. An earlier
|
|
12
|
+
* version wrote ~/.claude/mcp.json directly — Claude Code does not read that path, so the
|
|
13
|
+
* install silently did nothing while printing success.
|
|
9
14
|
*/
|
|
10
15
|
|
|
11
16
|
import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync } from 'fs';
|
|
17
|
+
import { execFileSync } from 'child_process';
|
|
12
18
|
import { dirname, join, resolve } from 'path';
|
|
13
19
|
import { fileURLToPath } from 'url';
|
|
14
20
|
import { homedir } from 'os';
|
|
@@ -16,9 +22,10 @@ import { homedir } from 'os';
|
|
|
16
22
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
23
|
const pkgRoot = dirname(__dirname); // mcp-server/
|
|
18
24
|
const command = process.argv[2];
|
|
25
|
+
const skipExtension = process.argv.includes('--skip-extension');
|
|
19
26
|
|
|
20
27
|
if (command === 'install') {
|
|
21
|
-
install();
|
|
28
|
+
install({ skipExtension });
|
|
22
29
|
} else if (!command) {
|
|
23
30
|
// No subcommand = start MCP server (Claude Code calls this)
|
|
24
31
|
// Auto-update extension files if installed via npx
|
|
@@ -29,55 +36,80 @@ if (command === 'install') {
|
|
|
29
36
|
Browser MCP by Agent360 — control your real Chrome from Claude Code
|
|
30
37
|
|
|
31
38
|
Usage:
|
|
32
|
-
npx @agent360/browser-mcp install
|
|
33
|
-
npx @agent360/browser-mcp
|
|
39
|
+
npx @agent360/browser-mcp install Extension files + register the server
|
|
40
|
+
npx @agent360/browser-mcp install --skip-extension Register the server only
|
|
41
|
+
(use this if you installed the
|
|
42
|
+
extension from the Chrome Web Store)
|
|
43
|
+
npx @agent360/browser-mcp Start MCP server (called by your client)
|
|
34
44
|
|
|
35
45
|
Docs: https://github.com/Agent360dk/browser-mcp
|
|
36
46
|
`);
|
|
37
47
|
}
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
// Register the server with Claude Code using Claude Code's own CLI. Writing a config file
|
|
50
|
+
// ourselves is what broke before: ~/.claude/mcp.json is not a path Claude Code reads, so the
|
|
51
|
+
// entry never took effect. `claude mcp add` writes wherever the installed version keeps it.
|
|
52
|
+
function registerWithClaudeCode() {
|
|
53
|
+
try {
|
|
54
|
+
execFileSync('claude', ['mcp', 'add', '--scope', 'user', 'browser-mcp',
|
|
55
|
+
'--', 'npx', '@agent360/browser-mcp@latest'],
|
|
56
|
+
{ stdio: 'pipe' });
|
|
57
|
+
console.log('✅ Registered with Claude Code (claude mcp add --scope user)');
|
|
58
|
+
return true;
|
|
59
|
+
} catch (err) {
|
|
60
|
+
const msg = String(err && (err.stderr || err.message) || '');
|
|
61
|
+
if (/already exists/i.test(msg)) {
|
|
62
|
+
console.log('✅ Already registered with Claude Code — nothing to do');
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
// `claude` not on PATH, or a different client entirely. Do not pretend it worked.
|
|
66
|
+
console.log('⚠️ Could not register automatically (the `claude` command was not found).');
|
|
67
|
+
console.log(' Register the server yourself — Claude Code:');
|
|
68
|
+
console.log(' claude mcp add --scope user browser-mcp -- npx @agent360/browser-mcp@latest');
|
|
69
|
+
console.log(' Codex:');
|
|
70
|
+
console.log(' codex mcp add browser-mcp -- npx @agent360/browser-mcp@latest');
|
|
71
|
+
console.log(' Cursor / VS Code / other — add to that client\'s MCP config:');
|
|
72
|
+
console.log(' {"mcpServers": {"browser-mcp": {"command": "npx", "args": ["@agent360/browser-mcp@latest"]}}}');
|
|
73
|
+
console.log(' Guides: https://browsermcp.dev/docs/install-claude-code/');
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function install({ skipExtension = false } = {}) {
|
|
40
79
|
const home = homedir();
|
|
41
80
|
const extensionDir = join(home, '.browser-mcp', 'extension');
|
|
42
81
|
const sourceExtension = join(pkgRoot, 'extension');
|
|
43
82
|
|
|
44
|
-
// 1. Copy extension files
|
|
45
83
|
console.log('\n🔧 Browser MCP by Agent360\n');
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (existsSync(mcpJsonPath)) {
|
|
62
|
-
try {
|
|
63
|
-
mcpConfig = JSON.parse(readFileSync(mcpJsonPath, 'utf8'));
|
|
64
|
-
} catch {}
|
|
84
|
+
console.log('Browser MCP is two halves and needs both: a Chrome extension, and this MCP');
|
|
85
|
+
console.log('server registered with your AI client.\n');
|
|
86
|
+
|
|
87
|
+
// 1. Extension files (skipped when the user already has it from the Chrome Web Store)
|
|
88
|
+
if (skipExtension) {
|
|
89
|
+
console.log('⏭ Skipping extension files (--skip-extension)');
|
|
90
|
+
} else {
|
|
91
|
+
if (!existsSync(sourceExtension)) {
|
|
92
|
+
console.error('❌ Extension files not found in package. Please report this issue.');
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
mkdirSync(extensionDir, { recursive: true });
|
|
96
|
+
cpSync(sourceExtension, extensionDir, { recursive: true });
|
|
97
|
+
console.log(`✅ Extension files copied to ${extensionDir}`);
|
|
65
98
|
}
|
|
66
99
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
📋 First-time setup (one time only):
|
|
100
|
+
// 2. Register the server
|
|
101
|
+
registerWithClaudeCode();
|
|
102
|
+
|
|
103
|
+
// 3. Print next steps — only the ones that still apply
|
|
104
|
+
if (skipExtension) {
|
|
105
|
+
console.log(`
|
|
106
|
+
📋 Last step:
|
|
107
|
+
1. Make sure the Agent360 Browser MCP extension is enabled at chrome://extensions
|
|
108
|
+
2. Restart your AI client so it picks up the server
|
|
109
|
+
3. Click the extension icon — it should turn green`);
|
|
110
|
+
} else {
|
|
111
|
+
console.log(`
|
|
112
|
+
📋 Load the extension in Chrome (one time only):
|
|
81
113
|
1. Open Chrome
|
|
82
114
|
2. Go to chrome://extensions (type it in the address bar)
|
|
83
115
|
3. Enable "Developer mode" (toggle in top right corner)
|
|
@@ -85,13 +117,19 @@ function install() {
|
|
|
85
117
|
5. Navigate to and select this folder:
|
|
86
118
|
${extensionDir}
|
|
87
119
|
6. The extension "Agent360 Browser MCP" appears with a puzzle icon
|
|
88
|
-
7. Restart
|
|
120
|
+
7. Restart your AI client — the browser tools are now available
|
|
89
121
|
|
|
122
|
+
Prefer a one-click, auto-updating extension instead of loading unpacked?
|
|
123
|
+
https://chromewebstore.google.com/detail/agent360-browser-mcp/jdehgalffmffhfhmmhaokfbfnafnmgcl
|
|
124
|
+
(then re-run this command with --skip-extension)`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
console.log(`
|
|
90
128
|
🔄 Auto-updates (fully automatic):
|
|
91
129
|
- MCP server: always fetches latest from npm (npx @latest)
|
|
92
130
|
- Extension files: auto-copied when npm version is newer
|
|
93
131
|
- Extension reload: auto-triggered via WebSocket
|
|
94
|
-
- You don't need to do anything — updates happen on every
|
|
132
|
+
- You don't need to do anything — updates happen on every session start
|
|
95
133
|
|
|
96
134
|
💡 Help shape Browser MCP:
|
|
97
135
|
- Public wishlist: https://github.com/Agent360dk/browser-mcp/blob/main/WISHLIST.md
|
|
@@ -102,6 +140,17 @@ function install() {
|
|
|
102
140
|
`);
|
|
103
141
|
}
|
|
104
142
|
|
|
143
|
+
// Tal, ikke tekst: en ren tekstsammenligning ville sige at 1.9.0 er nyere end 1.10.0.
|
|
144
|
+
function cmpSemver(a, b) {
|
|
145
|
+
const pa = String(a || '0.0.0').split('.').map(n => parseInt(n, 10) || 0);
|
|
146
|
+
const pb = String(b || '0.0.0').split('.').map(n => parseInt(n, 10) || 0);
|
|
147
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
148
|
+
const d = (pa[i] || 0) - (pb[i] || 0);
|
|
149
|
+
if (d) return d > 0 ? 1 : -1;
|
|
150
|
+
}
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
105
154
|
function autoUpdateExtension() {
|
|
106
155
|
const home = homedir();
|
|
107
156
|
const extensionDir = join(home, '.browser-mcp', 'extension');
|
|
@@ -118,12 +167,21 @@ function autoUpdateExtension() {
|
|
|
118
167
|
const installed = JSON.parse(readFileSync(installedManifest, 'utf8'));
|
|
119
168
|
const source = JSON.parse(readFileSync(sourceManifest, 'utf8'));
|
|
120
169
|
|
|
121
|
-
if (installed.version !== source.version)
|
|
170
|
+
// MAALT 21/8: her stod `if (installed.version !== source.version)`. Den kopierede
|
|
171
|
+
// naar versionerne var FORSKELLIGE — ikke naar pakkens var NYERE. En installation
|
|
172
|
+
// paa 1.27.1 blev derfor overskrevet af npm-pakkens 1.25.0, og linjen nedenfor
|
|
173
|
+
// meldte det som "auto-updated: 1.27.1 → 1.25.0". Det skete ved hver eneste
|
|
174
|
+
// serveropstart, saa en lokal nyere udgave kunne ikke blive liggende. Det er
|
|
175
|
+
// ogsaa forklaringen paa at ~/.browser-mcp/extension stod paa juli-kode i ugevis.
|
|
176
|
+
if (cmpSemver(source.version, installed.version) > 0) {
|
|
122
177
|
cpSync(sourceExtension, extensionDir, { recursive: true });
|
|
123
178
|
process.stderr.write(`[MCP] Extension auto-updated: ${installed.version} → ${source.version}\n`);
|
|
124
179
|
process.stderr.write('[MCP] Extension will auto-reload when connected\n');
|
|
125
180
|
// Signal to index.js that extension needs reload
|
|
126
181
|
process.env.BROWSER_MCP_EXTENSION_UPDATED = '1';
|
|
182
|
+
} else if (installed.version !== source.version) {
|
|
183
|
+
// Den lokale er nyere end pakkens — typisk under udvikling. Sig det, men roer den ikke.
|
|
184
|
+
process.stderr.write(`[MCP] Extension paa disken (${installed.version}) er nyere end pakkens (${source.version}) — lader den vaere\n`);
|
|
127
185
|
}
|
|
128
186
|
} catch {}
|
|
129
187
|
}
|