brave-real-browser-mcp-server 2.1.0 → 2.1.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 +515 -40
- package/dist/browser-manager.js +24 -20
- package/dist/constants.js +127 -0
- package/dist/errors/index.js +385 -0
- package/dist/errors/workflow-wrapper.js +57 -0
- package/dist/handlers/browser-handlers.js +2 -30
- package/dist/handlers/browser-handlers.test.js +28 -10
- package/dist/handlers/file-handlers.test.js +9 -5
- package/dist/handlers/interaction-handlers-temp.js +294 -0
- package/dist/handlers/interaction-handlers.js +57 -0
- package/dist/handlers/navigation-handlers.test.js +3 -2
- package/dist/index.js +70 -88
- package/dist/tool-definitions.js +20 -1
- package/dist/utils/logger.js +116 -0
- package/package.json +14 -16
package/README.md
CHANGED
|
@@ -13,20 +13,24 @@ 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. [Installation](#installation)
|
|
17
|
-
|
|
16
|
+
5. [Platform-Specific Installation](#platform-specific-installation)
|
|
17
|
+
- [Windows Installation](#windows-installation)
|
|
18
|
+
- [macOS Installation](#macos-installation)
|
|
19
|
+
- [Linux Installation](#linux-installation)
|
|
20
|
+
6. [Installation](#installation)
|
|
21
|
+
7. [Usage](#usage)
|
|
18
22
|
- [With Claude Desktop](#with-claude-desktop)
|
|
19
23
|
- [With Claude Code CLI](#with-claude-code-cli)
|
|
20
24
|
- [With Cursor IDE](#with-cursor-ide)
|
|
21
25
|
- [With Other AI Assistants](#with-other-ai-assistants)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
8. [Available Tools](#available-tools)
|
|
27
|
+
9. [Advanced Features](#advanced-features)
|
|
28
|
+
10. [Configuration](#configuration)
|
|
29
|
+
11. [Troubleshooting](#troubleshooting)
|
|
30
|
+
12. [Development](#development)
|
|
31
|
+
13. [Testing](#testing)
|
|
32
|
+
14. [Contributing](#contributing)
|
|
33
|
+
15. [License](#license)
|
|
30
34
|
|
|
31
35
|
## Quick Start for Beginners
|
|
32
36
|
|
|
@@ -104,17 +108,22 @@ Once set up, you can ask Claude to:
|
|
|
104
108
|
## Introduction
|
|
105
109
|
|
|
106
110
|
The Brave Real Browser MCP Server acts as a bridge between AI assistants
|
|
107
|
-
and browser automation. It leverages brave-real-browser to provide
|
|
108
|
-
browsing capabilities that can bypass common bot detection mechanisms.
|
|
111
|
+
and browser automation. It leverages the **brave-real-browser** package to provide
|
|
112
|
+
advanced stealth browsing capabilities that can bypass common bot detection mechanisms.
|
|
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.
|
|
109
117
|
|
|
110
118
|
This server implements the Model Context Protocol (MCP), allowing AI
|
|
111
|
-
assistants to control a real browser, extract content, and
|
|
119
|
+
assistants to control a real browser, extract content, solve CAPTCHAs, and perform
|
|
120
|
+
complex web automation tasks with human-like behavior.
|
|
112
121
|
|
|
113
122
|
## Features
|
|
114
123
|
|
|
115
124
|
- **Stealth by default**: All browser instances use anti-detection features
|
|
116
|
-
- **Enhanced Windows support**: Comprehensive Chrome detection and ECONNREFUSED error fixes
|
|
117
|
-
- **Smart
|
|
125
|
+
- **Enhanced Windows support**: Comprehensive Brave/Chrome detection and ECONNREFUSED error fixes
|
|
126
|
+
- **Smart browser detection**: Registry-based detection + 15+ installation paths for Brave and Chrome (Windows)
|
|
118
127
|
- **Connection resilience**: Automatic localhost/127.0.0.1 fallback with port management
|
|
119
128
|
- **Multiple retry strategies**: 5 different connection approaches with progressive fallback
|
|
120
129
|
- **Advanced configuration**: Full support for all brave-real-browser options
|
|
@@ -132,27 +141,451 @@ assistants to control a real browser, extract content, and more.
|
|
|
132
141
|
|
|
133
142
|
- Node.js >= 18.0.0
|
|
134
143
|
- npm or yarn
|
|
135
|
-
-
|
|
144
|
+
- **Brave Browser** (recommended) or Google Chrome/Chromium browser installed
|
|
136
145
|
- Basic understanding of TypeScript/JavaScript (for development)
|
|
137
146
|
|
|
138
147
|
### Platform-Specific Requirements
|
|
139
148
|
|
|
140
149
|
**Windows:**
|
|
141
|
-
- Google Chrome installation (automatic detection
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
- **Brave Browser** (recommended) or Google Chrome installation (automatic detection includes):
|
|
151
|
+
- **Brave Browser paths:**
|
|
152
|
+
- Standard: `C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe`
|
|
153
|
+
- 32-bit: `C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe`
|
|
154
|
+
- User: `%LOCALAPPDATA%\BraveSoftware\Brave-Browser\Application\brave.exe`
|
|
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`
|
|
146
161
|
- Portable installations and Registry-detected paths
|
|
147
|
-
- Manual path specification: Use `CHROME_PATH` environment variable
|
|
162
|
+
- Manual path specification: Use `CHROME_PATH` or `BRAVE_PATH` environment variable
|
|
148
163
|
|
|
149
164
|
**macOS:**
|
|
150
|
-
-
|
|
165
|
+
- **Brave Browser** (recommended): Install from [brave.com](https://brave.com) or App Store
|
|
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`
|
|
151
170
|
|
|
152
171
|
**Linux:**
|
|
153
|
-
-
|
|
172
|
+
- **Brave Browser** (recommended):
|
|
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
|
+
```
|
|
154
185
|
- Install xvfb for headless operation: `sudo apt-get install -y xvfb`
|
|
155
186
|
|
|
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
|
+
|
|
156
589
|
## Installation for Developers
|
|
157
590
|
|
|
158
591
|
> **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.
|
|
@@ -230,9 +663,16 @@ This command:
|
|
|
230
663
|
|
|
231
664
|
#### Method 2: Add with Environment Variables
|
|
232
665
|
|
|
233
|
-
If you need to configure proxy settings or custom
|
|
666
|
+
If you need to configure proxy settings or custom browser paths:
|
|
234
667
|
|
|
235
668
|
```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)
|
|
236
676
|
claude mcp add brave-real-browser \
|
|
237
677
|
-e CHROME_PATH="/path/to/chrome" \
|
|
238
678
|
-e PROXY_URL="http://proxy:8080" \
|
|
@@ -256,6 +696,18 @@ claude mcp add brave-real-browser -s project -- npx brave-real-browser-mcp-serve
|
|
|
256
696
|
For advanced users who want precise control:
|
|
257
697
|
|
|
258
698
|
```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)
|
|
259
711
|
claude mcp add-json brave-real-browser '{
|
|
260
712
|
"type": "stdio",
|
|
261
713
|
"command": "npx",
|
|
@@ -298,7 +750,7 @@ After adding the server:
|
|
|
298
750
|
|
|
299
751
|
- **Automatic Updates**: Using `@latest` ensures you get bug fixes and improvements
|
|
300
752
|
- **No Installation**: npx handles downloading and running automatically
|
|
301
|
-
- **Environment Variables**: Easy configuration of proxies, Chrome paths, etc.
|
|
753
|
+
- **Environment Variables**: Easy configuration of proxies, Brave/Chrome paths, etc.
|
|
302
754
|
- **Scope Control**: Choose where the server is available (local/project/user)
|
|
303
755
|
- **Team Sharing**: Project scope allows sharing configurations with teammates
|
|
304
756
|
- **Status Monitoring**: Built-in `/mcp` command for server health checks
|
|
@@ -336,7 +788,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
336
788
|
|
|
337
789
|
> **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!
|
|
338
790
|
|
|
339
|
-
**Windows-Specific Configuration (
|
|
791
|
+
**Windows-Specific Configuration (Brave Browser Recommended):**
|
|
340
792
|
```json
|
|
341
793
|
{
|
|
342
794
|
"mcpServers": {
|
|
@@ -344,16 +796,14 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
344
796
|
"command": "npx",
|
|
345
797
|
"args": ["brave-real-browser-mcp-server@latest"],
|
|
346
798
|
"env": {
|
|
347
|
-
"
|
|
799
|
+
"BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
|
|
348
800
|
}
|
|
349
801
|
}
|
|
350
802
|
}
|
|
351
803
|
}
|
|
352
804
|
```
|
|
353
805
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
**Advanced Configuration with Custom Chrome Path:**
|
|
806
|
+
**Alternative Chrome Configuration (if Brave not available):**
|
|
357
807
|
```json
|
|
358
808
|
{
|
|
359
809
|
"mcpServers": {
|
|
@@ -368,36 +818,60 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
|
|
|
368
818
|
}
|
|
369
819
|
```
|
|
370
820
|
|
|
821
|
+
> **Note**: Browser options like headless mode should be configured when initializing the browser through the `browser_init` tool, not via environment variables.
|
|
822
|
+
|
|
371
823
|
> **Note**: Proxy settings and browser options should be configured when asking Claude to initialize the browser using the `browser_init` tool.
|
|
372
824
|
|
|
373
|
-
#### Platform-Specific
|
|
825
|
+
#### Platform-Specific Browser Paths for Cursor IDE
|
|
374
826
|
|
|
375
|
-
If
|
|
827
|
+
If browser auto-detection fails, you can specify the browser path using environment variables:
|
|
376
828
|
|
|
377
|
-
**Windows:**
|
|
829
|
+
**Windows (Brave Browser Recommended):**
|
|
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"`
|
|
838
|
+
|
|
839
|
+
**Windows (Chrome Alternative - if Brave not available):**
|
|
378
840
|
```json
|
|
379
841
|
"env": {
|
|
380
842
|
"CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
|
|
381
843
|
}
|
|
382
844
|
```
|
|
383
|
-
Alternative
|
|
845
|
+
Alternative Chrome paths (use only if Brave is not installed):
|
|
384
846
|
- `"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"`
|
|
385
847
|
- `"%LOCALAPPDATA%/Google/Chrome/Application/chrome.exe"`
|
|
386
848
|
|
|
387
|
-
**macOS:**
|
|
849
|
+
**macOS (Brave Browser Recommended):**
|
|
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):**
|
|
388
856
|
```json
|
|
389
857
|
"env": {
|
|
390
858
|
"CHROME_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
391
859
|
}
|
|
392
860
|
```
|
|
393
861
|
|
|
394
|
-
**Linux:**
|
|
862
|
+
**Linux (Brave Browser Recommended):**
|
|
863
|
+
```json
|
|
864
|
+
"env": {
|
|
865
|
+
"BRAVE_PATH": "/usr/bin/brave-browser"
|
|
866
|
+
}
|
|
867
|
+
```
|
|
868
|
+
**Linux (Chrome Alternative - if Brave not available):**
|
|
395
869
|
```json
|
|
396
870
|
"env": {
|
|
397
871
|
"CHROME_PATH": "/usr/bin/google-chrome"
|
|
398
872
|
}
|
|
399
873
|
```
|
|
400
|
-
Alternative
|
|
874
|
+
Alternative Chrome paths (use only if Brave is not installed): `/usr/bin/chromium-browser`, `/snap/bin/chromium`
|
|
401
875
|
|
|
402
876
|
|
|
403
877
|
#### Testing Cursor IDE Setup
|
|
@@ -422,9 +896,10 @@ If successful, you should see:
|
|
|
422
896
|
- Ensure Node.js 18+ is installed
|
|
423
897
|
|
|
424
898
|
2. **"Browser failed to launch" on Windows**
|
|
425
|
-
- Add explicit
|
|
899
|
+
- Add explicit Brave browser path: `"BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"`
|
|
900
|
+
- Alternative (if Brave not available): Add Chrome path: `"CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"`
|
|
426
901
|
- Try running Cursor IDE as Administrator
|
|
427
|
-
- Check Windows Defender isn't blocking
|
|
902
|
+
- Check Windows Defender isn't blocking browser
|
|
428
903
|
|
|
429
904
|
3. **"Permission denied"**
|
|
430
905
|
- Use `sudo npm install -g brave-real-browser-mcp-server` on Linux/Mac
|