@agent360/browser-mcp 1.13.0
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 +169 -0
- package/bin/cli.js +90 -0
- package/extension/background.js +1281 -0
- package/extension/icons/icon-128.png +0 -0
- package/extension/icons/icon-16.png +0 -0
- package/extension/icons/icon-48.png +0 -0
- package/extension/manifest.json +40 -0
- package/extension/offscreen.html +6 -0
- package/extension/offscreen.js +97 -0
- package/extension/popup.html +65 -0
- package/extension/popup.js +96 -0
- package/index.js +336 -0
- package/package.json +42 -0
- package/tools.js +319 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Browser MCP by Agent360
|
|
2
|
+
|
|
3
|
+
**Control your real Chrome from Claude Code — with your logins, cookies, and 2FA.**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
The only browser MCP with **multi-session support** (10 concurrent AI sessions), **human-in-the-loop** (2FA, CAPTCHA, credentials), and **built-in provider integrations** (Stripe, HubSpot, Slack, and 9 more).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx @agent360/browser-mcp install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This copies the Chrome extension to `~/.browser-mcp/extension/` and configures Claude Code automatically.
|
|
16
|
+
|
|
17
|
+
Then load the extension in Chrome:
|
|
18
|
+
1. Open `chrome://extensions`
|
|
19
|
+
2. Enable **Developer mode** (top right)
|
|
20
|
+
3. Click **Load unpacked** → select `~/.browser-mcp/extension/`
|
|
21
|
+
4. Restart Claude Code
|
|
22
|
+
|
|
23
|
+
That's it. 21 browser tools are now available in Claude Code.
|
|
24
|
+
|
|
25
|
+
## Why This Over Playwright MCP / BrowserMCP?
|
|
26
|
+
|
|
27
|
+
| | Browser MCP | Playwright MCP | BrowserMCP.io |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| **Browser** | Your real Chrome | Headless (new session) | Your real Chrome |
|
|
30
|
+
| **Logins/cookies** | Already authenticated | Must log in every time | Already authenticated |
|
|
31
|
+
| **Multi-session** | 10 concurrent sessions with color-coded tab groups | Single session | Single session |
|
|
32
|
+
| **Human-in-the-loop** | `browser_ask_user` — 2FA, CAPTCHA, credential input | None | None |
|
|
33
|
+
| **Provider integrations** | 12 built-in (Stripe, HubSpot, Slack...) | None | None |
|
|
34
|
+
| **CORS bypass** | `browser_fetch` from extension background | N/A | Limited |
|
|
35
|
+
| **Network monitoring** | `browser_wait_for_network` via CDP | Built-in | None |
|
|
36
|
+
| **CSP-strict sites** | Chrome Debugger API throughout | Works (headless) | Limited |
|
|
37
|
+
| **Custom dropdowns** | Angular Material, React Select support | Works (headless) | Limited |
|
|
38
|
+
| **Install** | `npx @agent360/browser-mcp install` | `npx @anthropic-ai/mcp-playwright` | Manual clone |
|
|
39
|
+
|
|
40
|
+
## 21 Tools
|
|
41
|
+
|
|
42
|
+
### Navigation & Content
|
|
43
|
+
| Tool | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `browser_navigate` | Navigate to URL (reuses tab, or `new_tab=true`) |
|
|
46
|
+
| `browser_get_page_content` | Get page text or HTML |
|
|
47
|
+
| `browser_screenshot` | Screenshot via Chrome Debugger (works even when tab isn't focused) |
|
|
48
|
+
| `browser_execute_script` | Run JavaScript in page context |
|
|
49
|
+
|
|
50
|
+
### Interaction
|
|
51
|
+
| Tool | Description |
|
|
52
|
+
|------|-------------|
|
|
53
|
+
| `browser_click` | Click via CSS or text selector (`text=Submit`, `button:text(Next)`) |
|
|
54
|
+
| `browser_fill` | Fill input fields (works on CSP-strict sites) |
|
|
55
|
+
| `browser_press_key` | Keyboard events (Enter, Tab, Escape, modifiers) |
|
|
56
|
+
| `browser_scroll` | Scroll to element or by pixels |
|
|
57
|
+
| `browser_wait` | Wait for element to appear |
|
|
58
|
+
| `browser_hover` | Hover for tooltips/dropdowns |
|
|
59
|
+
| `browser_select_option` | Native `<select>` + custom dropdowns (Angular Material, React Select) |
|
|
60
|
+
| `browser_handle_dialog` | Accept/dismiss alert/confirm/prompt dialogs |
|
|
61
|
+
|
|
62
|
+
### Tabs & Frames
|
|
63
|
+
| Tool | Description |
|
|
64
|
+
|------|-------------|
|
|
65
|
+
| `browser_list_tabs` | List session's tabs only |
|
|
66
|
+
| `browser_switch_tab` | Switch to tab by ID |
|
|
67
|
+
| `browser_close_tab` | Close tab (session-owned only) |
|
|
68
|
+
| `browser_get_new_tab` | Get most recently opened tab (OAuth popups) |
|
|
69
|
+
| `browser_list_frames` | List iframes on page |
|
|
70
|
+
| `browser_select_frame` | Execute JS in specific iframe |
|
|
71
|
+
|
|
72
|
+
### Data & Network
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `browser_get_cookies` | Get cookies for domain |
|
|
76
|
+
| `browser_get_local_storage` | Read localStorage |
|
|
77
|
+
| `browser_fetch` | HTTP request from extension (bypasses CORS) |
|
|
78
|
+
| `browser_wait_for_network` | Wait for specific API call to complete |
|
|
79
|
+
| `browser_extract_token` | Navigate to provider dashboard + extract API token |
|
|
80
|
+
|
|
81
|
+
### Human-in-the-Loop
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|------|-------------|
|
|
84
|
+
| `browser_ask_user` | Show overlay dialog for 2FA, CAPTCHA, credentials, or any user input |
|
|
85
|
+
|
|
86
|
+
## Multi-Session Support
|
|
87
|
+
|
|
88
|
+
Each Claude Code conversation gets its own MCP server on a unique port (9876-9885). The Chrome extension connects to all active servers simultaneously.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Claude Session 1 ←(stdio)→ MCP :9876 ←(WS)→
|
|
92
|
+
Claude Session 2 ←(stdio)→ MCP :9877 ←(WS)→ Chrome Extension → Browser
|
|
93
|
+
Claude Session 3 ←(stdio)→ MCP :9878 ←(WS)→
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- **Session isolation** — each session gets a color-coded Chrome Tab Group
|
|
97
|
+
- **Tab ownership** — sessions can only see and control their own tabs
|
|
98
|
+
- **Auto-cleanup** — processes exit when Claude Code closes the conversation
|
|
99
|
+
|
|
100
|
+
## Built-in Provider Integrations
|
|
101
|
+
|
|
102
|
+
`browser_extract_token` navigates to the provider's API settings page and guides token extraction:
|
|
103
|
+
|
|
104
|
+
| Provider | Token Format | Dashboard |
|
|
105
|
+
|----------|-------------|-----------|
|
|
106
|
+
| Stripe | `sk_test_...` / `sk_live_...` | stripe.com/apikeys |
|
|
107
|
+
| HubSpot | `pat-...` | app.hubspot.com |
|
|
108
|
+
| Slack | `xoxb-...` | api.slack.com/apps |
|
|
109
|
+
| Shopify | Admin API token | admin.shopify.com |
|
|
110
|
+
| Pipedrive | UUID | app.pipedrive.com |
|
|
111
|
+
| Calendly | JWT | calendly.com |
|
|
112
|
+
| Mailchimp | `...-us1` | admin.mailchimp.com |
|
|
113
|
+
| Google | OAuth Client | console.cloud.google.com |
|
|
114
|
+
| LinkedIn | Client ID/Secret | linkedin.com/developers |
|
|
115
|
+
| Facebook | `EAA...` | developers.facebook.com |
|
|
116
|
+
| Instagram | Via Facebook | developers.facebook.com |
|
|
117
|
+
|
|
118
|
+
## Architecture
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
extension/
|
|
122
|
+
manifest.json # Manifest V3
|
|
123
|
+
background.js # Service worker — Chrome API dispatcher, session tab groups
|
|
124
|
+
offscreen.js # Persistent WebSocket bridge (multi-port scanning)
|
|
125
|
+
popup.html/js # Status UI — sessions, tabs, action log
|
|
126
|
+
|
|
127
|
+
mcp-server/
|
|
128
|
+
index.js # MCP server (stdio) + WebSocket client
|
|
129
|
+
tools.js # 21 tool definitions
|
|
130
|
+
bin/cli.js # Install CLI
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### How It Works
|
|
134
|
+
1. Claude Code starts → spawns MCP server via stdio
|
|
135
|
+
2. MCP server binds to first available port (9876-9885)
|
|
136
|
+
3. Extension's offscreen document scans ports every 2s
|
|
137
|
+
4. WebSocket connection established
|
|
138
|
+
5. Commands flow: Claude Code → MCP → Extension → Chrome APIs
|
|
139
|
+
6. Process auto-exits when Claude Code closes (stdin detection)
|
|
140
|
+
|
|
141
|
+
## Auto-Updates
|
|
142
|
+
|
|
143
|
+
The MCP server runs via `npx @agent360/browser-mcp@latest` — always the latest version from npm. No manual git pulls needed.
|
|
144
|
+
|
|
145
|
+
To update the extension: `npx @agent360/browser-mcp install` (re-copies files), then reload in `chrome://extensions`.
|
|
146
|
+
|
|
147
|
+
## Troubleshooting
|
|
148
|
+
|
|
149
|
+
**"Chrome extension not connected"**
|
|
150
|
+
- Check extension is loaded in `chrome://extensions`
|
|
151
|
+
- Click the extension popup → "Reconnect"
|
|
152
|
+
- Wait 2-3 seconds for port scan
|
|
153
|
+
|
|
154
|
+
**Screenshot fails**
|
|
155
|
+
- Uses Chrome Debugger API (works even when tab isn't focused)
|
|
156
|
+
- Falls back to `captureVisibleTab` if debugger unavailable
|
|
157
|
+
|
|
158
|
+
**Click doesn't work on SPA**
|
|
159
|
+
- Try text selector: `browser_click("text=Submit")`
|
|
160
|
+
- Uses real mouse events via Chrome Debugger API automatically
|
|
161
|
+
|
|
162
|
+
**Stale processes**
|
|
163
|
+
- Processes auto-exit when Claude Code closes (stdin detection)
|
|
164
|
+
- Idle timeout: 4 hours without commands → auto-exit
|
|
165
|
+
- Manual cleanup: `lsof -i :9876-9885 | grep LISTEN`
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT — [Agent360](https://agent360.dk)
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Browser MCP CLI — install extension + configure Claude Code
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npx @agent360/browser-mcp install — copy extension + setup mcp.json
|
|
8
|
+
* npx @agent360/browser-mcp — start MCP server (Claude Code calls this)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync } from 'fs';
|
|
12
|
+
import { dirname, join, resolve } from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { homedir } from 'os';
|
|
15
|
+
|
|
16
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const pkgRoot = dirname(__dirname); // mcp-server/
|
|
18
|
+
const command = process.argv[2];
|
|
19
|
+
|
|
20
|
+
if (command === 'install') {
|
|
21
|
+
install();
|
|
22
|
+
} else if (!command) {
|
|
23
|
+
// No subcommand = start MCP server (Claude Code calls this)
|
|
24
|
+
await import('../index.js');
|
|
25
|
+
} else {
|
|
26
|
+
console.log(`
|
|
27
|
+
Browser MCP by Agent360 — control your real Chrome from Claude Code
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
npx @agent360/browser-mcp install Install extension + configure Claude Code
|
|
31
|
+
npx @agent360/browser-mcp Start MCP server (called by Claude Code)
|
|
32
|
+
|
|
33
|
+
Docs: https://github.com/Agent360dk/browser-mcp
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function install() {
|
|
38
|
+
const home = homedir();
|
|
39
|
+
const extensionDir = join(home, '.browser-mcp', 'extension');
|
|
40
|
+
const sourceExtension = join(pkgRoot, 'extension');
|
|
41
|
+
|
|
42
|
+
// 1. Copy extension files
|
|
43
|
+
console.log('\n🔧 Browser MCP by Agent360\n');
|
|
44
|
+
|
|
45
|
+
if (!existsSync(sourceExtension)) {
|
|
46
|
+
console.error('❌ Extension files not found in package. Please report this issue.');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
mkdirSync(extensionDir, { recursive: true });
|
|
51
|
+
cpSync(sourceExtension, extensionDir, { recursive: true });
|
|
52
|
+
console.log(`✅ Extension installed to ${extensionDir}`);
|
|
53
|
+
|
|
54
|
+
// 2. Configure Claude Code mcp.json
|
|
55
|
+
const claudeDir = join(home, '.claude');
|
|
56
|
+
const mcpJsonPath = join(claudeDir, 'mcp.json');
|
|
57
|
+
let mcpConfig = {};
|
|
58
|
+
|
|
59
|
+
if (existsSync(mcpJsonPath)) {
|
|
60
|
+
try {
|
|
61
|
+
mcpConfig = JSON.parse(readFileSync(mcpJsonPath, 'utf8'));
|
|
62
|
+
} catch {}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
66
|
+
|
|
67
|
+
mcpConfig.mcpServers['browser-mcp'] = {
|
|
68
|
+
command: 'npx',
|
|
69
|
+
args: ['@agent360/browser-mcp@latest'],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
mkdirSync(claudeDir, { recursive: true });
|
|
73
|
+
writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
74
|
+
console.log(`✅ Claude Code configured (${mcpJsonPath})`);
|
|
75
|
+
|
|
76
|
+
// 3. Print next steps
|
|
77
|
+
console.log(`
|
|
78
|
+
📋 Next steps:
|
|
79
|
+
1. Open Chrome → chrome://extensions
|
|
80
|
+
2. Enable "Developer mode" (top right toggle)
|
|
81
|
+
3. Click "Load unpacked"
|
|
82
|
+
4. Select: ${extensionDir}
|
|
83
|
+
5. Restart Claude Code — browser tools are now available
|
|
84
|
+
|
|
85
|
+
🔄 Auto-updates: The MCP server always uses the latest npm version.
|
|
86
|
+
Extension updates: re-run "npx @agent360/browser-mcp install"
|
|
87
|
+
|
|
88
|
+
📖 Docs: https://github.com/Agent360dk/browser-mcp
|
|
89
|
+
`);
|
|
90
|
+
}
|