brave-real-browser-mcp-server 2.1.6 → 2.2.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 +40 -515
- package/dist/browser-manager.js +20 -24
- package/dist/browser-manager.test.js +395 -0
- package/dist/content-strategy.test.js +525 -0
- package/dist/handlers/browser-handlers.js +30 -2
- package/dist/handlers/browser-handlers.test.js +319 -0
- package/dist/handlers/content-handlers.test.js +457 -0
- package/dist/handlers/file-handlers.js +5 -7
- package/dist/handlers/file-handlers.test.js +285 -0
- package/dist/handlers/interaction-handlers.js +0 -57
- package/dist/handlers/interaction-handlers.test.js +440 -0
- package/dist/handlers/navigation-handlers.js +1 -1
- package/dist/handlers/navigation-handlers.test.js +382 -0
- package/dist/index.js +91 -73
- package/dist/token-management.test.js +428 -0
- package/dist/tool-definitions.js +1 -20
- package/dist/workflow-validation.test.js +236 -0
- package/package.json +28 -19
- package/dist/constants.js +0 -127
- package/dist/errors/index.js +0 -388
- package/dist/errors/workflow-wrapper.js +0 -62
- package/dist/handlers/interaction-handlers-temp.js +0 -294
- package/dist/utils/logger.js +0 -116
package/README.md
CHANGED
|
@@ -13,24 +13,20 @@ Provides AI assistants with powerful, detection-resistant browser automation cap
|
|
|
13
13
|
2. [Introduction](#introduction)
|
|
14
14
|
3. [Features](#features)
|
|
15
15
|
4. [Prerequisites](#prerequisites)
|
|
16
|
-
5. [
|
|
17
|
-
|
|
18
|
-
- [macOS Installation](#macos-installation)
|
|
19
|
-
- [Linux Installation](#linux-installation)
|
|
20
|
-
6. [Installation](#installation)
|
|
21
|
-
7. [Usage](#usage)
|
|
16
|
+
5. [Installation](#installation)
|
|
17
|
+
6. [Usage](#usage)
|
|
22
18
|
- [With Claude Desktop](#with-claude-desktop)
|
|
23
19
|
- [With Claude Code CLI](#with-claude-code-cli)
|
|
24
20
|
- [With Cursor IDE](#with-cursor-ide)
|
|
25
21
|
- [With Other AI Assistants](#with-other-ai-assistants)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
7. [Available Tools](#available-tools)
|
|
23
|
+
8. [Advanced Features](#advanced-features)
|
|
24
|
+
9. [Configuration](#configuration)
|
|
25
|
+
10. [Troubleshooting](#troubleshooting)
|
|
26
|
+
11. [Development](#development)
|
|
27
|
+
12. [Testing](#testing)
|
|
28
|
+
13. [Contributing](#contributing)
|
|
29
|
+
14. [License](#license)
|
|
34
30
|
|
|
35
31
|
## Quick Start for Beginners
|
|
36
32
|
|
|
@@ -108,22 +104,17 @@ Once set up, you can ask Claude to:
|
|
|
108
104
|
## Introduction
|
|
109
105
|
|
|
110
106
|
The Brave Real Browser MCP Server acts as a bridge between AI assistants
|
|
111
|
-
and browser automation. It leverages
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
**🎯 Optimized for Brave Browser**: While compatible with Chrome and Chromium,
|
|
115
|
-
this server is specifically optimized for Brave Browser, providing enhanced
|
|
116
|
-
privacy, ad-blocking, and anti-fingerprinting capabilities out-of-the-box.
|
|
107
|
+
and browser automation. It leverages brave-real-browser to provide stealth
|
|
108
|
+
browsing capabilities that can bypass common bot detection mechanisms.
|
|
117
109
|
|
|
118
110
|
This server implements the Model Context Protocol (MCP), allowing AI
|
|
119
|
-
assistants to control a real browser, extract content,
|
|
120
|
-
complex web automation tasks with human-like behavior.
|
|
111
|
+
assistants to control a real browser, extract content, and more.
|
|
121
112
|
|
|
122
113
|
## Features
|
|
123
114
|
|
|
124
115
|
- **Stealth by default**: All browser instances use anti-detection features
|
|
125
|
-
- **Enhanced Windows support**: Comprehensive
|
|
126
|
-
- **Smart
|
|
116
|
+
- **Enhanced Windows support**: Comprehensive Chrome detection and ECONNREFUSED error fixes (v1.3.0)
|
|
117
|
+
- **Smart Chrome detection**: Registry-based detection + 15+ installation paths (Windows)
|
|
127
118
|
- **Connection resilience**: Automatic localhost/127.0.0.1 fallback with port management
|
|
128
119
|
- **Multiple retry strategies**: 5 different connection approaches with progressive fallback
|
|
129
120
|
- **Advanced configuration**: Full support for all brave-real-browser options
|
|
@@ -141,451 +132,27 @@ complex web automation tasks with human-like behavior.
|
|
|
141
132
|
|
|
142
133
|
- Node.js >= 18.0.0
|
|
143
134
|
- npm or yarn
|
|
144
|
-
-
|
|
135
|
+
- Google Chrome or Chromium browser installed
|
|
145
136
|
- Basic understanding of TypeScript/JavaScript (for development)
|
|
146
137
|
|
|
147
138
|
### Platform-Specific Requirements
|
|
148
139
|
|
|
149
140
|
**Windows:**
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- Nightly: `%LOCALAPPDATA%\BraveSoftware\Brave-Browser-Nightly\Application\brave.exe`
|
|
156
|
-
- **Google Chrome paths:**
|
|
157
|
-
- Standard: `C:\Program Files\Google\Chrome\Application\chrome.exe`
|
|
158
|
-
- 32-bit: `C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
|
|
159
|
-
- User: `%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe`
|
|
160
|
-
- Canary: `%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe`
|
|
141
|
+
- Google Chrome installation (automatic detection in v1.3.0+ includes):
|
|
142
|
+
- Standard installations: `C:\Program Files\Google\Chrome\Application\chrome.exe`
|
|
143
|
+
- 32-bit installations: `C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
|
|
144
|
+
- User installations: `%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe`
|
|
145
|
+
- Chrome Canary: `%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe`
|
|
161
146
|
- Portable installations and Registry-detected paths
|
|
162
|
-
- Manual path specification: Use `CHROME_PATH`
|
|
147
|
+
- Manual path specification: Use `CHROME_PATH` environment variable
|
|
163
148
|
|
|
164
149
|
**macOS:**
|
|
165
|
-
-
|
|
166
|
-
- Alternative: Google Chrome or Chromium in `/Applications/`
|
|
167
|
-
- **Brave paths:**
|
|
168
|
-
- `/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`
|
|
169
|
-
- `/Applications/Brave Browser Nightly.app/Contents/MacOS/Brave Browser Nightly`
|
|
150
|
+
- Google Chrome or Chromium must be installed in `/Applications/`
|
|
170
151
|
|
|
171
152
|
**Linux:**
|
|
172
|
-
-
|
|
173
|
-
```bash
|
|
174
|
-
# Install Brave Browser
|
|
175
|
-
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
|
|
176
|
-
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
|
|
177
|
-
sudo apt update && sudo apt install brave-browser
|
|
178
|
-
```
|
|
179
|
-
- **Alternative Chrome/Chromium:**
|
|
180
|
-
```bash
|
|
181
|
-
sudo apt-get install -y google-chrome-stable
|
|
182
|
-
# or
|
|
183
|
-
sudo apt-get install -y chromium-browser
|
|
184
|
-
```
|
|
153
|
+
- Install Chrome/Chromium: `sudo apt-get install -y google-chrome-stable` or `sudo apt-get install -y chromium-browser`
|
|
185
154
|
- Install xvfb for headless operation: `sudo apt-get install -y xvfb`
|
|
186
155
|
|
|
187
|
-
## 🚀 Auto-Update Feature
|
|
188
|
-
|
|
189
|
-
This package **automatically updates all dependencies to their latest versions** whenever you run `npm install` during development. This ensures you always have the most recent bug fixes, security patches, and feature improvements from the underlying Brave browser packages.
|
|
190
|
-
|
|
191
|
-
### How it works:
|
|
192
|
-
- ✅ Automatically checks for outdated dependencies on every `npm install`
|
|
193
|
-
- ✅ Updates core Brave packages (`brave-real-browser`, `brave-real-launcher`, `brave-real-puppeteer-core`) with `--force`
|
|
194
|
-
- ✅ Updates other dependencies (`@modelcontextprotocol/sdk`, `turndown`) separately
|
|
195
|
-
- ✅ Works in CI/CD environments (GitHub Actions workflow)
|
|
196
|
-
- ✅ Can be disabled if needed via environment variable
|
|
197
|
-
- ✅ Smart recursion prevention to avoid loops
|
|
198
|
-
|
|
199
|
-
### For End Users (Using NPX):
|
|
200
|
-
If you're using this package via `npx` (as recommended in Claude Desktop config), you don't need to worry about updates - `npx` with `@latest` always fetches the newest version automatically. This auto-update feature is primarily for developers.
|
|
201
|
-
|
|
202
|
-
### For Developers:
|
|
203
|
-
|
|
204
|
-
**Auto-update is enabled by default:**
|
|
205
|
-
```bash
|
|
206
|
-
npm install
|
|
207
|
-
```
|
|
208
|
-
This will automatically update all dependencies to their latest versions.
|
|
209
|
-
|
|
210
|
-
**To disable auto-update temporarily:**
|
|
211
|
-
```bash
|
|
212
|
-
# On Windows (PowerShell)
|
|
213
|
-
$env:SKIP_AUTO_UPDATE="true"; npm install
|
|
214
|
-
|
|
215
|
-
# On Windows (CMD)
|
|
216
|
-
set SKIP_AUTO_UPDATE=true && npm install
|
|
217
|
-
|
|
218
|
-
# On macOS/Linux
|
|
219
|
-
SKIP_AUTO_UPDATE=true npm install
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
**Manual update commands:**
|
|
223
|
-
```bash
|
|
224
|
-
# Check for outdated dependencies
|
|
225
|
-
npm run check-updates
|
|
226
|
-
|
|
227
|
-
# Update all core Brave packages
|
|
228
|
-
npm run update-brave-packages
|
|
229
|
-
|
|
230
|
-
# Update using ensure-latest script (with verification)
|
|
231
|
-
npm run ensure-latest-packages
|
|
232
|
-
|
|
233
|
-
# Run auto-update script manually
|
|
234
|
-
npm run upgrade-all
|
|
235
|
-
|
|
236
|
-
# Complete fresh install with latest packages
|
|
237
|
-
npm run fresh-install
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**In CI/CD:**
|
|
241
|
-
The GitHub Actions workflow automatically updates dependencies during the build process using the `ensure-latest-packages` script.
|
|
242
|
-
|
|
243
|
-
### Why Auto-Update?
|
|
244
|
-
|
|
245
|
-
The underlying `brave-real-browser` ecosystem is actively maintained with frequent updates for:
|
|
246
|
-
- 🐛 Bug fixes
|
|
247
|
-
- 🔒 Security patches
|
|
248
|
-
- 🎯 Anti-detection improvements
|
|
249
|
-
- 🚀 New features
|
|
250
|
-
- 🌐 Browser compatibility updates
|
|
251
|
-
|
|
252
|
-
Auto-updates ensure you're always running the most stable and secure version.
|
|
253
|
-
|
|
254
|
-
## Platform-Specific Installation
|
|
255
|
-
|
|
256
|
-
> **🎯 Choose Your Platform:** Select the installation method that matches your operating system. Each section includes complete setup commands for both Brave Browser and MCP server configuration.
|
|
257
|
-
|
|
258
|
-
### Windows Installation
|
|
259
|
-
|
|
260
|
-
#### Method 1: Complete Windows Setup (Recommended)
|
|
261
|
-
|
|
262
|
-
**Step 1: Install Node.js**
|
|
263
|
-
```powershell
|
|
264
|
-
# Download and install from nodejs.org, or use winget
|
|
265
|
-
winget install OpenJS.NodeJS
|
|
266
|
-
|
|
267
|
-
# Verify installation
|
|
268
|
-
node --version
|
|
269
|
-
npm --version
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
**Step 2: Install Brave Browser (Recommended)**
|
|
273
|
-
```powershell
|
|
274
|
-
# Option 1: Download from brave.com
|
|
275
|
-
# Visit: https://brave.com/download/
|
|
276
|
-
|
|
277
|
-
# Option 2: Use winget
|
|
278
|
-
winget install BraveSoftware.BraveBrowser
|
|
279
|
-
|
|
280
|
-
# Option 3: Use Chocolatey
|
|
281
|
-
choco install brave
|
|
282
|
-
|
|
283
|
-
# Verify installation
|
|
284
|
-
& "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" --version
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**Step 3: Setup Claude Desktop MCP Configuration**
|
|
288
|
-
```powershell
|
|
289
|
-
# Create Claude config directory
|
|
290
|
-
$configPath = "$env:APPDATA\Claude"
|
|
291
|
-
if (!(Test-Path $configPath)) { New-Item -ItemType Directory -Path $configPath }
|
|
292
|
-
|
|
293
|
-
# Create MCP configuration file
|
|
294
|
-
@"
|
|
295
|
-
{
|
|
296
|
-
"mcpServers": {
|
|
297
|
-
"brave-real-browser": {
|
|
298
|
-
"command": "npx",
|
|
299
|
-
"args": ["brave-real-browser-mcp-server@latest"]
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
"@ | Out-File -FilePath "$configPath\claude_desktop_config.json" -Encoding UTF8
|
|
304
|
-
|
|
305
|
-
echo "✅ Claude Desktop MCP configuration created successfully!"
|
|
306
|
-
echo "📁 Config file location: $configPath\claude_desktop_config.json"
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
**Step 4: Setup Environment Variables (Optional)**
|
|
310
|
-
```powershell
|
|
311
|
-
# Set Brave Browser path (if not auto-detected)
|
|
312
|
-
[Environment]::SetEnvironmentVariable("BRAVE_PATH", "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe", "User")
|
|
313
|
-
|
|
314
|
-
# Alternative: Set Chrome path (if Brave not available)
|
|
315
|
-
# [Environment]::SetEnvironmentVariable("CHROME_PATH", "C:\Program Files\Google\Chrome\Application\chrome.exe", "User")
|
|
316
|
-
|
|
317
|
-
echo "✅ Environment variables set successfully!"
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Step 5: Test MCP Server**
|
|
321
|
-
```powershell
|
|
322
|
-
# Test the MCP server directly
|
|
323
|
-
npx brave-real-browser-mcp-server@latest --help
|
|
324
|
-
|
|
325
|
-
# Test with Claude Desktop (restart Claude first)
|
|
326
|
-
echo "🔄 Restart Claude Desktop and test with: 'Initialize a browser and navigate to google.com'"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
#### Method 2: Quick Setup (One-liner)
|
|
330
|
-
```powershell
|
|
331
|
-
# Complete Windows setup in one command
|
|
332
|
-
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/codeiva4u/Brave-Real-Browser-Mcp-Server/main/scripts/install-windows.ps1'))
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### macOS Installation
|
|
336
|
-
|
|
337
|
-
#### Method 1: Complete macOS Setup (Recommended)
|
|
338
|
-
|
|
339
|
-
**Step 1: Install Node.js**
|
|
340
|
-
```bash
|
|
341
|
-
# Option 1: Download from nodejs.org
|
|
342
|
-
# Visit: https://nodejs.org/
|
|
343
|
-
|
|
344
|
-
# Option 2: Use Homebrew
|
|
345
|
-
brew install node
|
|
346
|
-
|
|
347
|
-
# Option 3: Use nvm (Node Version Manager)
|
|
348
|
-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
349
|
-
source ~/.bashrc
|
|
350
|
-
nvm install node
|
|
351
|
-
|
|
352
|
-
# Verify installation
|
|
353
|
-
node --version
|
|
354
|
-
npm --version
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Step 2: Install Brave Browser (Recommended)**
|
|
358
|
-
```bash
|
|
359
|
-
# Option 1: Download from brave.com
|
|
360
|
-
# Visit: https://brave.com/download/
|
|
361
|
-
|
|
362
|
-
# Option 2: Use Homebrew
|
|
363
|
-
brew install --cask brave-browser
|
|
364
|
-
|
|
365
|
-
# Option 3: Use Mac App Store
|
|
366
|
-
# Search for "Brave Browser" in App Store
|
|
367
|
-
|
|
368
|
-
# Verify installation
|
|
369
|
-
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" --version
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
**Step 3: Setup Claude Desktop MCP Configuration**
|
|
373
|
-
```bash
|
|
374
|
-
# Create Claude config directory
|
|
375
|
-
mkdir -p ~/"Library/Application Support/Claude"
|
|
376
|
-
|
|
377
|
-
# Create MCP configuration file
|
|
378
|
-
cat << 'EOF' > ~/"Library/Application Support/Claude/claude_desktop_config.json"
|
|
379
|
-
{
|
|
380
|
-
"mcpServers": {
|
|
381
|
-
"brave-real-browser": {
|
|
382
|
-
"command": "npx",
|
|
383
|
-
"args": ["brave-real-browser-mcp-server@latest"]
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
EOF
|
|
388
|
-
|
|
389
|
-
echo "✅ Claude Desktop MCP configuration created successfully!"
|
|
390
|
-
echo "📁 Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json"
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**Step 4: Setup Environment Variables (Optional)**
|
|
394
|
-
```bash
|
|
395
|
-
# Add to your shell profile (.bashrc, .zshrc, etc.)
|
|
396
|
-
echo 'export BRAVE_PATH="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"' >> ~/.zshrc
|
|
397
|
-
|
|
398
|
-
# Alternative: Set Chrome path (if Brave not available)
|
|
399
|
-
# echo 'export CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"' >> ~/.zshrc
|
|
400
|
-
|
|
401
|
-
# Reload shell configuration
|
|
402
|
-
source ~/.zshrc
|
|
403
|
-
|
|
404
|
-
echo "✅ Environment variables set successfully!"
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
**Step 5: Test MCP Server**
|
|
408
|
-
```bash
|
|
409
|
-
# Test the MCP server directly
|
|
410
|
-
npx brave-real-browser-mcp-server@latest --help
|
|
411
|
-
|
|
412
|
-
# Test browser launch
|
|
413
|
-
node -e "console.log('Testing browser paths:'); console.log('Brave:', process.env.BRAVE_PATH);"
|
|
414
|
-
|
|
415
|
-
echo "🔄 Restart Claude Desktop and test with: 'Initialize a browser and navigate to google.com'"
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
#### Method 2: Quick Setup (One-liner)
|
|
419
|
-
```bash
|
|
420
|
-
# Complete macOS setup in one command
|
|
421
|
-
curl -fsSL https://raw.githubusercontent.com/codeiva4u/Brave-Real-Browser-Mcp-Server/main/scripts/install-macos.sh | bash
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Linux Installation
|
|
425
|
-
|
|
426
|
-
#### Method 1: Complete Linux Setup (Ubuntu/Debian)
|
|
427
|
-
|
|
428
|
-
**Step 1: Install Node.js**
|
|
429
|
-
```bash
|
|
430
|
-
# Option 1: Using NodeSource repository (recommended)
|
|
431
|
-
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
|
432
|
-
sudo apt-get install -y nodejs
|
|
433
|
-
|
|
434
|
-
# Option 2: Using snap
|
|
435
|
-
sudo snap install node --classic
|
|
436
|
-
|
|
437
|
-
# Option 3: Using package manager
|
|
438
|
-
sudo apt update
|
|
439
|
-
sudo apt install -y nodejs npm
|
|
440
|
-
|
|
441
|
-
# Verify installation
|
|
442
|
-
node --version
|
|
443
|
-
npm --version
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
**Step 2: Install Brave Browser (Recommended)**
|
|
447
|
-
```bash
|
|
448
|
-
# Install Brave Browser
|
|
449
|
-
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
|
|
450
|
-
|
|
451
|
-
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
|
|
452
|
-
|
|
453
|
-
sudo apt update
|
|
454
|
-
sudo apt install -y brave-browser
|
|
455
|
-
|
|
456
|
-
# Install dependencies for headless operation
|
|
457
|
-
sudo apt-get install -y xvfb
|
|
458
|
-
|
|
459
|
-
# Verify installation
|
|
460
|
-
brave-browser --version
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
**Step 3: Setup Claude Desktop MCP Configuration**
|
|
464
|
-
```bash
|
|
465
|
-
# Create Claude config directory
|
|
466
|
-
mkdir -p ~/.config/Claude
|
|
467
|
-
|
|
468
|
-
# Create MCP configuration file
|
|
469
|
-
cat << 'EOF' > ~/.config/Claude/claude_desktop_config.json
|
|
470
|
-
{
|
|
471
|
-
"mcpServers": {
|
|
472
|
-
"brave-real-browser": {
|
|
473
|
-
"command": "npx",
|
|
474
|
-
"args": ["brave-real-browser-mcp-server@latest"]
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
EOF
|
|
479
|
-
|
|
480
|
-
echo "✅ Claude Desktop MCP configuration created successfully!"
|
|
481
|
-
echo "📁 Config file location: ~/.config/Claude/claude_desktop_config.json"
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
**Step 4: Setup Environment Variables**
|
|
485
|
-
```bash
|
|
486
|
-
# Add to your shell profile
|
|
487
|
-
echo 'export BRAVE_PATH="/usr/bin/brave-browser"' >> ~/.bashrc
|
|
488
|
-
echo 'export DISPLAY=:99' >> ~/.bashrc # For headless operation
|
|
489
|
-
|
|
490
|
-
# Alternative browser paths
|
|
491
|
-
# echo 'export CHROME_PATH="/usr/bin/google-chrome"' >> ~/.bashrc
|
|
492
|
-
# echo 'export CHROME_PATH="/usr/bin/chromium-browser"' >> ~/.bashrc
|
|
493
|
-
|
|
494
|
-
# Reload shell configuration
|
|
495
|
-
source ~/.bashrc
|
|
496
|
-
|
|
497
|
-
echo "✅ Environment variables set successfully!"
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
**Step 5: Setup Headless Display (For Server Usage)**
|
|
501
|
-
```bash
|
|
502
|
-
# Start virtual display for headless operation
|
|
503
|
-
sudo apt-get install -y xvfb
|
|
504
|
-
|
|
505
|
-
# Create xvfb service (optional)
|
|
506
|
-
sudo tee /etc/systemd/system/xvfb.service << 'EOF'
|
|
507
|
-
[Unit]
|
|
508
|
-
Description=X Virtual Frame Buffer Service
|
|
509
|
-
After=network.target
|
|
510
|
-
|
|
511
|
-
[Service]
|
|
512
|
-
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24
|
|
513
|
-
Restart=on-failure
|
|
514
|
-
RestartSec=2
|
|
515
|
-
User=nobody
|
|
516
|
-
Group=nogroup
|
|
517
|
-
|
|
518
|
-
[Install]
|
|
519
|
-
WantedBy=multi-user.target
|
|
520
|
-
EOF
|
|
521
|
-
|
|
522
|
-
# Enable and start xvfb service
|
|
523
|
-
sudo systemctl enable xvfb
|
|
524
|
-
sudo systemctl start xvfb
|
|
525
|
-
|
|
526
|
-
echo "✅ Headless display configured successfully!"
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
**Step 6: Test MCP Server**
|
|
530
|
-
```bash
|
|
531
|
-
# Test the MCP server directly
|
|
532
|
-
npx brave-real-browser-mcp-server@latest --help
|
|
533
|
-
|
|
534
|
-
# Test headless operation
|
|
535
|
-
export DISPLAY=:99
|
|
536
|
-
node -e "console.log('Testing browser paths:'); console.log('Brave:', process.env.BRAVE_PATH); console.log('Display:', process.env.DISPLAY);"
|
|
537
|
-
|
|
538
|
-
# Test browser launch
|
|
539
|
-
echo "🔄 Testing browser launch..."
|
|
540
|
-
timeout 10s brave-browser --headless --dump-dom --disable-gpu https://google.com > /dev/null && echo "✅ Browser test successful!" || echo "❌ Browser test failed"
|
|
541
|
-
|
|
542
|
-
echo "🔄 Restart Claude Desktop and test with: 'Initialize a browser and navigate to google.com'"
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
#### Method 2: CentOS/RHEL/Fedora Setup
|
|
546
|
-
```bash
|
|
547
|
-
# Install Node.js
|
|
548
|
-
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
|
|
549
|
-
sudo yum install -y nodejs
|
|
550
|
-
|
|
551
|
-
# Install Brave Browser
|
|
552
|
-
sudo dnf install dnf-plugins-core
|
|
553
|
-
sudo dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/x86_64/
|
|
554
|
-
sudo rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
|
|
555
|
-
sudo dnf install brave-browser
|
|
556
|
-
|
|
557
|
-
# Continue with steps 3-6 from Ubuntu setup above
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
#### Method 3: Quick Setup (One-liner for Ubuntu/Debian)
|
|
561
|
-
```bash
|
|
562
|
-
# Complete Linux setup in one command
|
|
563
|
-
curl -fsSL https://raw.githubusercontent.com/codeiva4u/Brave-Real-Browser-Mcp-Server/main/scripts/install-linux.sh | bash
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
### Post-Installation Verification
|
|
567
|
-
|
|
568
|
-
**Test MCP Server on All Platforms:**
|
|
569
|
-
```bash
|
|
570
|
-
# 1. Test Node.js and npm
|
|
571
|
-
node --version && npm --version
|
|
572
|
-
|
|
573
|
-
# 2. Test MCP server installation
|
|
574
|
-
npx brave-real-browser-mcp-server@latest --version
|
|
575
|
-
|
|
576
|
-
# 3. Test browser availability
|
|
577
|
-
# Windows: & "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" --version
|
|
578
|
-
# macOS: "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" --version
|
|
579
|
-
# Linux: brave-browser --version
|
|
580
|
-
|
|
581
|
-
# 4. Verify MCP configuration
|
|
582
|
-
# Check if claude_desktop_config.json exists and contains brave-real-browser server
|
|
583
|
-
|
|
584
|
-
# 5. Test with Claude Desktop
|
|
585
|
-
# Restart Claude Desktop completely
|
|
586
|
-
# Try: "Initialize a browser and navigate to example.com, then get the page title"
|
|
587
|
-
```
|
|
588
|
-
|
|
589
156
|
## Installation for Developers
|
|
590
157
|
|
|
591
158
|
> **Note for Claude Desktop Users:** You don't need to install anything! The npx command in your configuration automatically handles everything. Skip to the [Usage](#usage) section.
|
|
@@ -663,16 +230,9 @@ This command:
|
|
|
663
230
|
|
|
664
231
|
#### Method 2: Add with Environment Variables
|
|
665
232
|
|
|
666
|
-
If you need to configure proxy settings or custom
|
|
233
|
+
If you need to configure proxy settings or custom Chrome paths:
|
|
667
234
|
|
|
668
235
|
```bash
|
|
669
|
-
# For Brave Browser (recommended)
|
|
670
|
-
claude mcp add brave-real-browser \
|
|
671
|
-
-e BRAVE_PATH="/path/to/brave" \
|
|
672
|
-
-e PROXY_URL="http://proxy:8080" \
|
|
673
|
-
-- npx brave-real-browser-mcp-server@latest
|
|
674
|
-
|
|
675
|
-
# Alternative for Chrome (if Brave not available)
|
|
676
236
|
claude mcp add brave-real-browser \
|
|
677
237
|
-e CHROME_PATH="/path/to/chrome" \
|
|
678
238
|
-e PROXY_URL="http://proxy:8080" \
|
|
@@ -696,18 +256,6 @@ claude mcp add brave-real-browser -s project -- npx brave-real-browser-mcp-serve
|
|
|
696
256
|
For advanced users who want precise control:
|
|
697
257
|
|
|
698
258
|
```bash
|
|
699
|
-
# For Brave Browser (recommended)
|
|
700
|
-
claude mcp add-json brave-real-browser '{
|
|
701
|
-
"type": "stdio",
|
|
702
|
-
"command": "npx",
|
|
703
|
-
"args": ["brave-real-browser-mcp-server@latest"],
|
|
704
|
-
"env": {
|
|
705
|
-
"BRAVE_PATH": "/path/to/brave",
|
|
706
|
-
"PROXY_URL": "http://proxy:8080"
|
|
707
|
-
}
|
|
708
|
-
}'
|
|
709
|
-
|
|
710
|
-
# Alternative for Chrome (if Brave not available)
|
|
711
259
|
claude mcp add-json brave-real-browser '{
|
|
712
260
|
"type": "stdio",
|
|
713
261
|
"command": "npx",
|
|
@@ -750,7 +298,7 @@ After adding the server:
|
|
|
750
298
|
|
|
751
299
|
- **Automatic Updates**: Using `@latest` ensures you get bug fixes and improvements
|
|
752
300
|
- **No Installation**: npx handles downloading and running automatically
|
|
753
|
-
- **Environment Variables**: Easy configuration of proxies,
|
|
301
|
+
- **Environment Variables**: Easy configuration of proxies, Chrome paths, etc.
|
|
754
302
|
- **Scope Control**: Choose where the server is available (local/project/user)
|
|
755
303
|
- **Team Sharing**: Project scope allows sharing configurations with teammates
|
|
756
304
|
- **Status Monitoring**: Built-in `/mcp` command for server health checks
|
|
@@ -788,7 +336,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
788
336
|
|
|
789
337
|
> **Important:** Just like Claude Desktop, Cursor will use `npx` to automatically download and run the server. You don't need to install anything with npm!
|
|
790
338
|
|
|
791
|
-
**Windows-Specific Configuration (
|
|
339
|
+
**Windows-Specific Configuration (if experiencing Chrome path issues):**
|
|
792
340
|
```json
|
|
793
341
|
{
|
|
794
342
|
"mcpServers": {
|
|
@@ -796,14 +344,16 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
796
344
|
"command": "npx",
|
|
797
345
|
"args": ["brave-real-browser-mcp-server@latest"],
|
|
798
346
|
"env": {
|
|
799
|
-
"
|
|
347
|
+
"CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
|
|
800
348
|
}
|
|
801
349
|
}
|
|
802
350
|
}
|
|
803
351
|
}
|
|
804
352
|
```
|
|
805
353
|
|
|
806
|
-
**
|
|
354
|
+
> **Note**: Browser options like headless mode should be configured when initializing the browser through the `browser_init` tool, not via environment variables.
|
|
355
|
+
|
|
356
|
+
**Advanced Configuration with Custom Chrome Path:**
|
|
807
357
|
```json
|
|
808
358
|
{
|
|
809
359
|
"mcpServers": {
|
|
@@ -818,60 +368,36 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
818
368
|
}
|
|
819
369
|
```
|
|
820
370
|
|
|
821
|
-
> **Note**: Browser options like headless mode should be configured when initializing the browser through the `browser_init` tool, not via environment variables.
|
|
822
|
-
|
|
823
371
|
> **Note**: Proxy settings and browser options should be configured when asking Claude to initialize the browser using the `browser_init` tool.
|
|
824
372
|
|
|
825
|
-
#### Platform-Specific
|
|
826
|
-
|
|
827
|
-
If browser auto-detection fails, you can specify the browser path using environment variables:
|
|
373
|
+
#### Platform-Specific Chrome Paths for Cursor IDE
|
|
828
374
|
|
|
829
|
-
|
|
830
|
-
```json
|
|
831
|
-
"env": {
|
|
832
|
-
"BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
|
|
833
|
-
}
|
|
834
|
-
```
|
|
835
|
-
Alternative Brave paths:
|
|
836
|
-
- `"C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"`
|
|
837
|
-
- `"%LOCALAPPDATA%/BraveSoftware/Brave-Browser/Application/brave.exe"`
|
|
375
|
+
If Chrome auto-detection fails, you can specify the Chrome path using the `CHROME_PATH` environment variable:
|
|
838
376
|
|
|
839
|
-
**Windows
|
|
377
|
+
**Windows:**
|
|
840
378
|
```json
|
|
841
379
|
"env": {
|
|
842
380
|
"CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
|
|
843
381
|
}
|
|
844
382
|
```
|
|
845
|
-
Alternative
|
|
383
|
+
Alternative Windows paths:
|
|
846
384
|
- `"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"`
|
|
847
385
|
- `"%LOCALAPPDATA%/Google/Chrome/Application/chrome.exe"`
|
|
848
386
|
|
|
849
|
-
**macOS
|
|
850
|
-
```json
|
|
851
|
-
"env": {
|
|
852
|
-
"BRAVE_PATH": "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
|
|
853
|
-
}
|
|
854
|
-
```
|
|
855
|
-
**macOS (Chrome Alternative - if Brave not available):**
|
|
387
|
+
**macOS:**
|
|
856
388
|
```json
|
|
857
389
|
"env": {
|
|
858
390
|
"CHROME_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
859
391
|
}
|
|
860
392
|
```
|
|
861
393
|
|
|
862
|
-
**Linux
|
|
863
|
-
```json
|
|
864
|
-
"env": {
|
|
865
|
-
"BRAVE_PATH": "/usr/bin/brave-browser"
|
|
866
|
-
}
|
|
867
|
-
```
|
|
868
|
-
**Linux (Chrome Alternative - if Brave not available):**
|
|
394
|
+
**Linux:**
|
|
869
395
|
```json
|
|
870
396
|
"env": {
|
|
871
397
|
"CHROME_PATH": "/usr/bin/google-chrome"
|
|
872
398
|
}
|
|
873
399
|
```
|
|
874
|
-
Alternative
|
|
400
|
+
Alternative Linux paths: `/usr/bin/chromium-browser`, `/snap/bin/chromium`
|
|
875
401
|
|
|
876
402
|
|
|
877
403
|
#### Testing Cursor IDE Setup
|
|
@@ -896,10 +422,9 @@ If successful, you should see:
|
|
|
896
422
|
- Ensure Node.js 18+ is installed
|
|
897
423
|
|
|
898
424
|
2. **"Browser failed to launch" on Windows**
|
|
899
|
-
- Add explicit
|
|
900
|
-
- Alternative (if Brave not available): Add Chrome path: `"CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"`
|
|
425
|
+
- Add explicit Chrome path in `executablePath`
|
|
901
426
|
- Try running Cursor IDE as Administrator
|
|
902
|
-
- Check Windows Defender isn't blocking
|
|
427
|
+
- Check Windows Defender isn't blocking Chrome
|
|
903
428
|
|
|
904
429
|
3. **"Permission denied"**
|
|
905
430
|
- Use `sudo npm install -g brave-real-browser-mcp-server` on Linux/Mac
|