brave-real-browser-mcp-server 2.9.5 → 2.9.7

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 CHANGED
@@ -61,6 +61,20 @@ If you're just using this MCP server (not developing it), you don't need to run
61
61
  }
62
62
  ```
63
63
 
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "brave-real-browser": {
68
+ "command": "npx",
69
+ "args": ["brave-real-browser-mcp-server@latest"],
70
+ "env": {
71
+ "BRAVE_PATH": "C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
64
78
  **For Mac:**
65
79
  1. Open Finder and press `Cmd+Shift+G`
66
80
  2. Go to: `~/Library/Application Support/Claude/`
@@ -113,16 +127,23 @@ assistants to control a real browser, extract content, and more.
113
127
  ## Features
114
128
 
115
129
  - **🔄 Auto-Update System**: Automatically updates all dependencies to latest versions on every `npm install`
116
- - **🦁 Brave Browser Priority**: Automatically detects and uses Brave Browser first, Chrome as fallback
117
- - **Stealth by default**: All browser instances use anti-detection features
118
- - **Enhanced cross-platform support**: Comprehensive browser detection (Brave + Chrome) on Windows/Mac/Linux
119
- - **Smart browser detection**: Registry-based + file system detection for both Brave and Chrome
130
+ - **🦁 Brave Browser Exclusive**: Specially designed for Brave Browser with exclusive optimizations
131
+ - Advanced Brave path detection (Registry + File System + Environment Variables)
132
+ - Brave-specific launch arguments and configurations
133
+ - Full compatibility with Brave Browser's privacy features
134
+ - Automatic detection across all Brave versions (Stable, Beta, Dev, Nightly)
135
+ - **Stealth by default**: All browser instances use anti-detection features powered by `brave-real-browser`
136
+ - **Enhanced cross-platform support**: Comprehensive Brave browser detection on Windows/Mac/Linux
137
+ - **Windows**: Registry-based detection + 15+ installation paths
138
+ - **macOS**: Application bundle detection for all Brave variants
139
+ - **Linux**: Package manager and manual installation detection
140
+ - **Smart browser detection**: Multi-layer detection system with automatic fallbacks
120
141
  - **Connection resilience**: Automatic localhost/127.0.0.1 fallback with port management
121
142
  - **Multiple retry strategies**: 5 different connection approaches with progressive fallback
122
143
  - **Advanced configuration**: Full support for all brave-real-browser options
123
144
  - **Dynamic selector discovery**: Intelligent element finding without hardcoded selectors
124
145
  - **Random scrolling**: Tools for natural scrolling to avoid detection
125
- - **Comprehensive toolset**: 11 tools covering all browser automation needs
146
+ - **Comprehensive toolset**: 62+ professional tools covering all browser automation needs
126
147
  - **Proxy support**: Built-in proxy configuration for enhanced privacy
127
148
  - **Captcha handling**: Support for solving reCAPTCHA, hCaptcha, and Turnstile
128
149
  - **Robust error handling**: Advanced error recovery with circuit breaker pattern
@@ -134,54 +155,56 @@ assistants to control a real browser, extract content, and more.
134
155
 
135
156
  - Node.js >= 18.0.0
136
157
  - npm or yarn
137
- - **Brave Browser (RECOMMENDED)** or Google Chrome/Chromium browser installed
158
+ - **Brave Browser (REQUIRED)** - This project exclusively uses Brave Browser
138
159
  - Basic understanding of TypeScript/JavaScript (for development)
139
160
 
140
161
  ### Browser Requirements
141
162
 
142
- #### 🦁 Brave Browser (Recommended)
163
+ #### 🦁 Brave Browser (Required)
143
164
 
144
- This project **automatically detects and prioritizes Brave Browser** as it's specifically designed for the brave-real-browser package. Brave is detected first, then Chrome as fallback.
165
+ This project **exclusively uses Brave Browser** and is specifically optimized for the `brave-real-browser` package with advanced integration features.
145
166
 
146
- **Why Brave?**
147
- - 🎯 Perfect compatibility with brave-real-browser
148
- - 🔒 Better privacy and security by default
149
- - 🚀 Faster performance
150
- - Automatic detection after installation
167
+ **Why Brave Browser Exclusively?**
168
+ - **🎯 Perfect Compatibility**: Designed specifically for `brave-real-browser` package
169
+ - **🔒 Enhanced Privacy**: Built-in ad-blocking and tracking protection
170
+ - **🚀 Superior Performance**: Faster page loads and reduced memory usage
171
+ - **🛡️ Anti-Detection**: Better stealth capabilities compared to regular browsers
172
+ - **✅ Advanced Auto-Detection**: Multi-layer detection system across all platforms
173
+ - **🎯 Reliability**: Simplified codebase focused on single browser for better stability
174
+ - **🦁 Native Integration**: Custom launch arguments and configurations optimized for Brave
151
175
 
152
176
  **Install Brave:**
153
177
  - **All Platforms**: Download from [brave.com/download](https://brave.com/download/)
154
178
  - Brave is automatically detected in all standard installation locations
155
179
  - Use `BRAVE_PATH` environment variable for custom installations
156
180
 
157
- #### 🌐 Chrome/Chromium (Fallback)
158
-
159
- Chrome/Chromium works as a fallback if Brave is not installed.
160
-
161
- **Windows:**
162
- - Automatic detection includes (in order of priority):
163
- 1. **Brave Browser** paths (Registry + standard locations)
164
- 2. Chrome paths (Registry + 15+ standard locations)
165
- - Standard: `C:\Program Files\Google\Chrome\Application\chrome.exe`
166
- - 32-bit: `C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
167
- - User: `%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe`
168
- - Chrome Canary, Portable installations
169
- - Manual path: Use `BRAVE_PATH` or `CHROME_PATH` environment variable
181
+ **Windows (Advanced Detection):**
182
+ - **Registry-Based Detection**: Queries Windows Registry for all Brave installations
183
+ - **File System Scanning**: Searches 15+ common installation paths
184
+ - **Standard Paths Detected**:
185
+ - System-wide: `C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe`
186
+ - 32-bit: `C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe`
187
+ - User-specific: `%LOCALAPPDATA%\BraveSoftware\Brave-Browser\Application\brave.exe`
188
+ - Portable installations in common directories
189
+ - **All Brave Variants Supported**:
190
+ - Brave Browser (Stable)
191
+ - Brave Browser Beta
192
+ - Brave Browser Dev
193
+ - Brave Browser Nightly
194
+ - **Environment Variable Support**: `BRAVE_PATH` for custom locations
195
+ - **Automatic Fallback**: Progressive detection with multiple strategies
170
196
 
171
197
  **macOS:**
172
- - **Brave Browser** (priority):
198
+ - **Brave Browser** paths:
173
199
  - `/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`
174
- - Beta/Nightly/Dev versions also detected
175
- - Chrome/Chromium (fallback):
176
- - `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`
177
- - Chromium and Chrome Canary also supported
200
+ - `/Applications/Brave Browser Beta.app/Contents/MacOS/Brave Browser Beta`
201
+ - `/Applications/Brave Browser Nightly.app/Contents/MacOS/Brave Browser Nightly`
202
+ - `/Applications/Brave Browser Dev.app/Contents/MacOS/Brave Browser Dev`
178
203
 
179
204
  **Linux:**
180
- - **Brave Browser** (priority):
205
+ - **Brave Browser** installation:
181
206
  - Install: `sudo apt install brave-browser` or from [brave.com](https://brave.com/)
182
- - Detected paths: `/usr/bin/brave-browser`, `/snap/bin/brave`, etc.
183
- - Chrome/Chromium (fallback):
184
- - Install: `sudo apt-get install -y google-chrome-stable` or `chromium-browser`
207
+ - Detected paths: `/usr/bin/brave-browser`, `/snap/bin/brave`, `/usr/bin/brave`, `/opt/brave.com/brave/brave-browser`
185
208
  - Install xvfb for headless operation: `sudo apt-get install -y xvfb`
186
209
 
187
210
  ## Installation for Developers
@@ -261,11 +284,11 @@ This command:
261
284
 
262
285
  #### Method 2: Add with Environment Variables
263
286
 
264
- If you need to configure proxy settings or custom Chrome paths:
287
+ If you need to configure proxy settings or custom Brave paths:
265
288
 
266
289
  ```bash
267
290
  claude mcp add brave-real-browser \
268
- -e CHROME_PATH="/path/to/chrome" \
291
+ -e BRAVE_PATH="/path/to/brave" \
269
292
  -e PROXY_URL="http://proxy:8080" \
270
293
  -- npx brave-real-browser-mcp-server@latest
271
294
  ```
@@ -292,7 +315,7 @@ claude mcp add-json brave-real-browser '{
292
315
  "command": "npx",
293
316
  "args": ["brave-real-browser-mcp-server@latest"],
294
317
  "env": {
295
- "CHROME_PATH": "/path/to/chrome",
318
+ "BRAVE_PATH": "/path/to/brave",
296
319
  "PROXY_URL": "http://proxy:8080"
297
320
  }
298
321
  }'
@@ -329,7 +352,7 @@ After adding the server:
329
352
 
330
353
  - **Automatic Updates**: Using `@latest` ensures you get bug fixes and improvements
331
354
  - **No Installation**: npx handles downloading and running automatically
332
- - **Environment Variables**: Easy configuration of proxies, Chrome paths, etc.
355
+ - **Environment Variables**: Easy configuration of proxies, Brave paths, etc.
333
356
  - **Scope Control**: Choose where the server is available (local/project/user)
334
357
  - **Team Sharing**: Project scope allows sharing configurations with teammates
335
358
  - **Status Monitoring**: Built-in `/mcp` command for server health checks
@@ -367,7 +390,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
367
390
 
368
391
  > **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!
369
392
 
370
- **Windows-Specific Configuration (if experiencing Chrome path issues):**
393
+ **Windows-Specific Configuration (if experiencing Brave path issues):**
371
394
  ```json
372
395
  {
373
396
  "mcpServers": {
@@ -375,7 +398,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
375
398
  "command": "npx",
376
399
  "args": ["brave-real-browser-mcp-server@latest"],
377
400
  "env": {
378
- "CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
401
+ "BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
379
402
  }
380
403
  }
381
404
  }
@@ -384,7 +407,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
384
407
 
385
408
  > **Note**: Browser options like headless mode should be configured when initializing the browser through the `browser_init` tool, not via environment variables.
386
409
 
387
- **Advanced Configuration with Custom Chrome Path:**
410
+ **Advanced Configuration with Custom Brave Path:**
388
411
  ```json
389
412
  {
390
413
  "mcpServers": {
@@ -392,7 +415,7 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
392
415
  "command": "npx",
393
416
  "args": ["brave-real-browser-mcp-server@latest"],
394
417
  "env": {
395
- "CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
418
+ "BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
396
419
  }
397
420
  }
398
421
  }
@@ -401,34 +424,34 @@ Cursor IDE uses the same npx approach - no installation needed! Here are the set
401
424
 
402
425
  > **Note**: Proxy settings and browser options should be configured when asking Claude to initialize the browser using the `browser_init` tool.
403
426
 
404
- #### Platform-Specific Chrome Paths for Cursor IDE
427
+ #### Platform-Specific Brave Paths for Cursor IDE
405
428
 
406
- If Chrome auto-detection fails, you can specify the Chrome path using the `CHROME_PATH` environment variable:
429
+ If Brave auto-detection fails, you can specify the Brave path using the `BRAVE_PATH` environment variable:
407
430
 
408
431
  **Windows:**
409
432
  ```json
410
433
  "env": {
411
- "CHROME_PATH": "C:/Program Files/Google/Chrome/Application/chrome.exe"
434
+ "BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
412
435
  }
413
436
  ```
414
437
  Alternative Windows paths:
415
- - `"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"`
416
- - `"%LOCALAPPDATA%/Google/Chrome/Application/chrome.exe"`
438
+ - `"C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"`
439
+ - `"%LOCALAPPDATA%/BraveSoftware/Brave-Browser/Application/brave.exe"`
417
440
 
418
441
  **macOS:**
419
442
  ```json
420
443
  "env": {
421
- "CHROME_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
444
+ "BRAVE_PATH": "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
422
445
  }
423
446
  ```
424
447
 
425
448
  **Linux:**
426
449
  ```json
427
450
  "env": {
428
- "CHROME_PATH": "/usr/bin/google-chrome"
451
+ "BRAVE_PATH": "/usr/bin/brave-browser"
429
452
  }
430
453
  ```
431
- Alternative Linux paths: `/usr/bin/chromium-browser`, `/snap/bin/chromium`
454
+ Alternative Linux paths: `/snap/bin/brave`, `/usr/bin/brave`, `/opt/brave.com/brave/brave-browser`
432
455
 
433
456
 
434
457
  #### Testing Cursor IDE Setup
@@ -453,9 +476,9 @@ If successful, you should see:
453
476
  - Ensure Node.js 18+ is installed
454
477
 
455
478
  2. **"Browser failed to launch" on Windows**
456
- - Add explicit Chrome path in `executablePath`
479
+ - Add explicit Brave path in `BRAVE_PATH` environment variable
457
480
  - Try running Cursor IDE as Administrator
458
- - Check Windows Defender isn't blocking Chrome
481
+ - Check Windows Defender isn't blocking Brave Browser
459
482
 
460
483
  3. **"Permission denied"**
461
484
  - Use `sudo npm install -g brave-real-browser-mcp-server` on Linux/Mac
@@ -528,48 +551,106 @@ AI: I'll set up the browser with your proxy configuration.
528
551
 
529
552
  ## Available Tools
530
553
 
531
- ### Core Browser Tools
532
-
533
- | Tool Name | Description | Required Parameters | Optional Parameters |
534
- |-----------|-------------|---------------------|-------------------|
535
- | `browser_init` | Initialize stealth browser with advanced options | None | `headless`, `disableXvfb`, `ignoreAllFlags`, `proxy`, `plugins`, `connectOption` |
536
- | `navigate` | Navigate to a URL | `url` | `waitUntil` |
537
- | `get_content` | Get page content (HTML or text) | None | `type`, `selector` |
538
- | `browser_close` | Close the browser instance | None | None |
539
-
540
- ### Interaction Tools
541
-
542
- | Tool Name | Description | Required Parameters | Optional Parameters |
543
- |-----------|-------------|---------------------|-------------------|
544
- | `click` | Standard click on element | `selector` | `waitForNavigation` |
545
- | `type` | Type text into input field | `selector`, `text` | `delay` |
546
- | `wait` | Wait for various conditions | `type`, `value` | `timeout` |
547
- | `find_selector` | Find CSS selector for element containing specific text | `text` | `elementType`, `exact` |
548
-
549
-
550
- ### Behavior Tools
551
-
552
- | Tool Name | Description | Required Parameters | Optional Parameters |
553
- |-----------|-------------|---------------------|-------------------|
554
- | `random_scroll` | Perform random scrolling with natural timing | None | None |
555
-
556
- ### Element Discovery Tools
557
-
558
- | Tool Name | Description | Required Parameters | Optional Parameters |
559
- |-----------|-------------|---------------------|-------------------|
560
- | `find_selector` | Find CSS selector for element containing specific text | `text` | `elementType`, `exact` |
561
-
562
- ### Content Tools
563
-
564
- | Tool Name | Description | Required Parameters | Optional Parameters |
565
- |-----------|-------------|---------------------|-------------------|
566
- | `save_content_as_markdown` | Extract page content and save it as a formatted markdown file | `filePath` | `contentType`, `selector`, `formatOptions` |
567
-
568
- ### Anti-Detection Tools
569
-
570
- | Tool Name | Description | Required Parameters | Optional Parameters |
571
- |-----------|-------------|---------------------|-------------------|
572
- | `solve_captcha` | Attempt to solve captchas | `type` | None |
554
+ ### 🎯 **Complete Professional Toolset - 62 Tools**
555
+
556
+ This MCP server provides **62 professional-grade tools** organized into 11 major categories:
557
+
558
+ ### 🔥 **Core Browser Management (11 Tools)**
559
+ 1. `browser_init` - Initialize stealth browser with advanced options
560
+ 2. `navigate` - Navigate to a URL
561
+ 3. `get_content` - Get page content (HTML or text)
562
+ 4. `click` - Click on elements
563
+ 5. `type` - Type text into input fields
564
+ 6. `wait` - Wait for various conditions
565
+ 7. `browser_close` - Close browser instance
566
+ 8. `solve_captcha` - Solve captchas (reCAPTCHA, hCaptcha, Turnstile)
567
+ 9. `random_scroll` - Natural scrolling behavior
568
+ 10. `find_selector` - Find CSS selectors by text content
569
+ 11. `save_content_as_markdown` - Save page content as markdown
570
+
571
+ ### 📊 **Smart Data Extractors (5 Tools)**
572
+ 12. `scrape_table` - Extract structured data from HTML tables
573
+ 13. `extract_list` - Extract data from bullet and numbered lists
574
+ 14. `extract_json` - Extract embedded JSON/API data
575
+ 15. `scrape_meta_tags` - Extract SEO meta tags and Open Graph data
576
+ 16. `extract_schema` - Extract Schema.org structured data
577
+
578
+ ### 🔄 **Multi-Element Extractors (7 Tools)**
579
+ 17. `batch_element_scraper` - Scrape multiple similar elements in batch
580
+ 18. `nested_data_extraction` - Extract data maintaining parent-child relationships
581
+ 19. `attribute_harvester` - Collect element attributes (href, src, data-*)
582
+ 20. `image_scraper` - Extract image URLs, alt text, dimensions
583
+ 21. `link_harvester` - Collect internal/external links with classification
584
+ 22. `media_extractor` - Extract video, audio, iframe URLs and metadata
585
+ 23. `pdf_link_finder` - Find downloadable files (PDF, DOC, etc.)
586
+
587
+ ### 📄 **Pagination Tools (5 Tools)**
588
+ 24. `auto_pagination` - Automatically detect and navigate through pages
589
+ 25. `infinite_scroll` - Handle lazy-loading pages with auto-scroll
590
+ 26. `multi_page_scraper` - Collect data from multiple pages
591
+ 27. `sitemap_parser` - Extract URLs from sitemap.xml
592
+ 28. `breadcrumb_navigator` - Navigate site structure using breadcrumbs
593
+
594
+ ### 🧹 **Data Processing Tools (8 Tools)**
595
+ 29. `smart_text_cleaner` - Clean and normalize text data
596
+ 30. `html_to_text` - Convert HTML to clean text
597
+ 31. `price_parser` - Extract numbers from currency strings
598
+ 32. `date_normalizer` - Convert various date formats to standard format
599
+ 33. `contact_extractor` - Detect phone numbers and email addresses
600
+ 34. `schema_validator` - Validate data against JSON schema
601
+ 35. `required_fields_checker` - Check for missing required fields
602
+ 36. `duplicate_remover` - Remove duplicate items from arrays
603
+
604
+ ### 🤖 **AI-Powered Features (5 Tools)**
605
+ 37. `smart_selector_generator` - AI-based CSS selector generation
606
+ 38. `content_classification` - Classify webpage content into categories
607
+ 39. `sentiment_analysis` - Analyze sentiment of page content
608
+ 40. `summary_generator` - Generate page content summaries using TF-IDF
609
+ 41. `translation_support` - Detect language and provide translation info
610
+
611
+ ### 🔍 **Search & Filter Tools (5 Tools)**
612
+ 42. `keyword_search` - Advanced keyword search with context
613
+ 43. `regex_pattern_matcher` - Search using regular expressions
614
+ 44. `xpath_support` - Query elements using XPath expressions
615
+ 45. `advanced_css_selectors` - Support for complex CSS selectors
616
+ 46. `visual_element_finder` - Find elements by visual properties
617
+
618
+ ### 🔧 **Data Quality & Validation (5 Tools)**
619
+ 47. `data_deduplication` - Advanced duplicate removal with fuzzy matching
620
+ 48. `missing_data_handler` - Detect and handle missing data
621
+ 49. `data_type_validator` - Validate data types against JSON schema
622
+ 50. `outlier_detection` - Detect outliers in numerical data
623
+ 51. `consistency_checker` - Check data consistency across fields
624
+
625
+ ### 🛡️ **Advanced Captcha Handling (3 Tools)**
626
+ 52. `ocr_engine` - Extract text from images using OCR
627
+ 53. `audio_captcha_solver` - Handle audio captchas
628
+ 54. `puzzle_captcha_handler` - Handle slider and puzzle captchas
629
+
630
+ ### 📸 **Screenshot & Visual Tools (5 Tools)**
631
+ 55. `full_page_screenshot` - Capture complete page screenshots
632
+ 56. `element_screenshot` - Capture screenshots of specific elements
633
+ 57. `pdf_generation` - Convert pages to PDF
634
+ 58. `video_recording` - Record browser sessions
635
+ 59. `visual_comparison` - Compare two screenshots for differences
636
+
637
+ ### 🌐 **Website API Integration (3 Tools)**
638
+ 60. `rest_api_endpoint_finder` - Discover REST API endpoints
639
+ 61. `webhook_support` - Set up and test webhooks
640
+ 62. `all_website_api_finder` - Comprehensive API discovery
641
+
642
+ ---
643
+
644
+ ### 📝 **Usage Examples**
645
+
646
+ | Category | Example Usage |
647
+ |----------|---------------|
648
+ | **Basic Browsing** | `browser_init` → `navigate` → `get_content` |
649
+ | **Data Extraction** | `scrape_table` → `smart_text_cleaner` → `duplicate_remover` |
650
+ | **Form Automation** | `find_selector` → `type` → `click` → `wait` |
651
+ | **Content Analysis** | `get_content` → `sentiment_analysis` → `summary_generator` |
652
+ | **Visual Capture** | `full_page_screenshot` → `element_screenshot` |
653
+ | **Quality Control** | `data_type_validator` → `consistency_checker` |
573
654
 
574
655
  ## Advanced Features
575
656
 
@@ -578,7 +659,7 @@ AI: I'll set up the browser with your proxy configuration.
578
659
  The server includes intelligent element discovery capabilities through the `find_selector` tool:
579
660
 
580
661
  - **Text-based element finding**: Automatically locates elements containing specific text
581
- - **Smart CSS selector generation**: Creates unique, robust CSS selectors similar to Chrome DevTools
662
+ - **Smart CSS selector generation**: Creates unique, robust CSS selectors similar to Brave DevTools
582
663
  - **Element type filtering**: Optionally restrict search to specific HTML elements (e.g., buttons, links)
583
664
  - **Exact or partial text matching**: Choose between precise text matching or substring searches
584
665
  - **Universal compatibility**: Works across any website without hardcoded selectors
@@ -616,27 +697,27 @@ brave-real-browser implementation.
616
697
 
617
698
  ## Configuration
618
699
 
619
- ### Automatic Chrome Path Detection (Enhanced in v1.3.0)
700
+ ### Automatic Brave Path Detection (Enhanced in v2.9.5)
620
701
 
621
- The server automatically detects Chrome installation paths across different operating systems with significantly improved Windows support:
702
+ The server automatically detects Brave Browser installation paths across different operating systems with advanced multi-layer detection:
622
703
 
623
- - **Windows (v1.3.0+)**:
624
- - Registry-based detection for installed Chrome versions
704
+ - **Windows (v2.9.5+)**:
705
+ - Registry-based detection for all installed Brave versions
625
706
  - Searches 15+ common installation directories including Program Files, user-specific locations, and portable installations
626
- - Support for Chrome Canary fallback
627
- - Environment variable detection (`CHROME_PATH`, `PUPPETEER_EXECUTABLE_PATH`)
628
- - Detailed troubleshooting guidance when Chrome is not found
707
+ - Support for all Brave variants (Stable, Beta, Dev, Nightly)
708
+ - Environment variable detection (`BRAVE_PATH`, `CHROME_PATH` for fallback)
709
+ - Detailed troubleshooting guidance when Brave is not found
629
710
 
630
- - **macOS**: Looks for Chrome in `/Applications/Google Chrome.app/` and Chrome Canary locations
711
+ - **macOS**: Detects Brave in all Application bundle locations for all variants
631
712
 
632
- - **Linux**: Checks multiple locations including `/usr/bin/google-chrome`, `/usr/bin/chromium-browser`, and snap installations
713
+ - **Linux**: Checks multiple locations including package manager installations and manual installs
633
714
 
634
- **Windows Registry Detection** (NEW in v1.3.0):
635
- The server now queries Windows Registry to find Chrome installations, making detection more reliable across different installation types.
715
+ **Advanced Brave Detection** (Enhanced in v2.9.5):
716
+ The server now uses sophisticated multi-layer detection combining Windows Registry queries, file system scanning, and environment variables for maximum compatibility.
636
717
 
637
- If Chrome is not found automatically, you can specify a custom path using:
638
- 1. Environment variable: `set CHROME_PATH="C:\Your\Chrome\Path\chrome.exe"`
639
- 2. Browser init option: `customConfig.chromePath` when initializing the browser
718
+ If Brave is not found automatically, you can specify a custom path using:
719
+ 1. Environment variable: `set BRAVE_PATH="C:\Your\Brave\Path\brave.exe"`
720
+ 2. Browser init option: `customConfig.chromePath` when initializing the browser (legacy Chrome path support)
640
721
 
641
722
  ### Configuring Custom Options (like headless mode)
642
723
  Custom options like headless mode are **not configured in the MCP config file**. Instead, they're passed when initializing the browser using the `browser_init` tool:
@@ -663,7 +744,7 @@ When initializing with `browser_init`, you can configure:
663
744
 
664
745
  - `headless`: true/false (Set to true for headless operation)
665
746
  - `disableXvfb`: true/false (Disable X Virtual Framebuffer)
666
- - `ignoreAllFlags`: true/false (Ignore all Chrome flags)
747
+ - `ignoreAllFlags`: true/false (Ignore all Brave browser flags)
667
748
  - `proxy`: "https://proxy:8080" (Proxy server URL)
668
749
  - `plugins`: ["plugin1", "plugin2"] (Array of plugins to load)
669
750
  - `connectOption`: Additional connection options like:
@@ -692,11 +773,11 @@ When initializing the browser with `browser_init`, you can configure:
692
773
 
693
774
  ### Advanced Configuration Examples
694
775
 
695
- #### Specifying Custom Chrome Path
776
+ #### Specifying Custom Brave Path
696
777
  ```json
697
778
  {
698
779
  "customConfig": {
699
- "chromePath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
780
+ "chromePath": "C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"
700
781
  }
701
782
  }
702
783
  ```
@@ -739,14 +820,14 @@ For advanced users, you can modify the server behavior by editing the source cod
739
820
 
740
821
  Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0.1:60725` error commonly experienced on Windows systems:
741
822
 
742
- **Enhanced Chrome Path Detection:**
743
- - Added Windows Registry-based Chrome detection
823
+ **Enhanced Brave Path Detection:**
824
+ - Added Windows Registry-based Brave detection for all variants
744
825
  - Expanded search to 15+ Windows installation locations including portable installations
745
- - Added support for Chrome Canary fallback
746
- - Environment variable support (`CHROME_PATH`, `PUPPETEER_EXECUTABLE_PATH`)
826
+ - Added support for all Brave versions (Stable, Beta, Dev, Nightly)
827
+ - Environment variable support (`BRAVE_PATH`, `CHROME_PATH` for legacy fallback)
747
828
 
748
829
  **Windows-Specific Launch Optimizations:**
749
- - 20+ Windows-specific Chrome flags for better compatibility
830
+ - 20+ Windows-specific Brave browser flags for better compatibility
750
831
  - Multiple fallback strategies (5 different connection approaches)
751
832
  - Progressive retry logic with exponential backoff
752
833
  - Enhanced timeout handling (120s for Windows vs 90s for other platforms)
@@ -761,12 +842,12 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
761
842
 
762
843
  1. **Environment Variables (Recommended):**
763
844
  ```bash
764
- set CHROME_PATH="C:\Program Files\Google\Chrome\Application\chrome.exe"
845
+ set BRAVE_PATH="C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"
765
846
  ```
766
847
 
767
- 2. **Manual Chrome Path Configuration:**
848
+ 2. **Manual Brave Path Configuration:**
768
849
  ```text
769
- Ask Claude: "Initialize browser with custom Chrome path at C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
850
+ Ask Claude: "Initialize browser with custom Brave path at C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"
770
851
  ```
771
852
 
772
853
  3. **Network Troubleshooting:**
@@ -780,10 +861,10 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
780
861
  # Ensure: 127.0.0.1 localhost
781
862
  ```
782
863
 
783
- 4. **Chrome Process Management:**
864
+ 4. **Brave Process Management:**
784
865
  ```bash
785
- # Kill existing Chrome processes
786
- taskkill /f /im chrome.exe
866
+ # Kill existing Brave processes
867
+ taskkill /f /im brave.exe
787
868
  ```
788
869
 
789
870
  ### Common Issues
@@ -842,20 +923,20 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
842
923
  - Check your PATH includes npm global binaries: `npm config get prefix`
843
924
 
844
925
  3. **Browser won't start**
845
- - Check if Chrome/Chromium is installed in standard locations
926
+ - Check if Brave Browser is installed in standard locations
846
927
  - **Windows specific troubleshooting**:
847
928
 
848
- **Step 1: Verify Chrome Installation Paths**
929
+ **Step 1: Verify Brave Installation Paths**
849
930
  Check these locations in order:
850
- - `C:\Program Files\Google\Chrome\Application\chrome.exe`
851
- - `C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
852
- - `%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe`
853
- - `%PROGRAMFILES%\Google\Chrome\Application\chrome.exe`
931
+ - `C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe`
932
+ - `C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe`
933
+ - `%LOCALAPPDATA%\BraveSoftware\Brave-Browser\Application\brave.exe`
934
+ - `%PROGRAMFILES%\BraveSoftware\Brave-Browser\Application\brave.exe`
854
935
 
855
936
  **Step 2: Manual Path Configuration**
856
- If Chrome is in a different location, specify it manually:
937
+ If Brave is in a different location, specify it manually:
857
938
  ```
858
- Ask Claude: "Initialize browser with custom Chrome path at C:\Your\Chrome\Path\chrome.exe"
939
+ Ask Claude: "Initialize browser with custom Brave path at C:\Your\Brave\Path\brave.exe"
859
940
  ```
860
941
 
861
942
  **Step 3: Windows Launch Arguments**
@@ -866,15 +947,15 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
866
947
 
867
948
  **Step 4: Windows-Specific Solutions**
868
949
  - **Run as Administrator**: Try running your IDE/terminal as Administrator
869
- - **Windows Defender**: Add Chrome and Node.js to Windows Defender exclusions
870
- - **Antivirus Software**: Temporarily disable antivirus to test if it's blocking Chrome
950
+ - **Windows Defender**: Add Brave Browser and Node.js to Windows Defender exclusions
951
+ - **Antivirus Software**: Temporarily disable antivirus to test if it's blocking Brave
871
952
  - **User Account Control**: Lower UAC settings temporarily for testing
872
- - **Chrome Processes**: Kill any existing Chrome processes in Task Manager
953
+ - **Brave Processes**: Kill any existing Brave processes in Task Manager
873
954
 
874
- **Step 5: Alternative Chrome Installation**
875
- If Chrome detection still fails:
876
- - Download Chrome directly from [google.com/chrome](https://www.google.com/chrome/)
877
- - Install to default location (`C:\Program Files\Google\Chrome\`)
955
+ **Step 5: Alternative Brave Installation**
956
+ If Brave detection still fails:
957
+ - Download Brave directly from [brave.com/download](https://brave.com/download/)
958
+ - Install to default location (`C:\Program Files\BraveSoftware\Brave-Browser\`)
878
959
  - Restart your IDE after installation
879
960
 
880
961
  **Step 6: PowerShell vs Command Prompt**
@@ -887,10 +968,10 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
887
968
  - Clear npm cache: `npm cache clean --force`
888
969
  - Reinstall global packages: `npm install -g brave-real-browser-mcp-server@latest`
889
970
 
890
- - **Linux**: Install dependencies: `sudo apt-get install -y google-chrome-stable`
891
- - **macOS**: Ensure Chrome is in `/Applications/`
971
+ - **Linux**: Install Brave: `sudo apt install brave-browser` or from [brave.com](https://brave.com/)
972
+ - **macOS**: Ensure Brave is in `/Applications/Brave Browser.app/`
892
973
  - Try with `headless: true` first
893
- - Check console output for Chrome path detection messages
974
+ - Check console output for Brave path detection messages
894
975
 
895
976
  4. **Claude doesn't see the MCP server**
896
977
  - Verify `claude_desktop_config.json` is in the correct location
@@ -916,7 +997,7 @@ Version 1.3.0 includes comprehensive fixes for the `connect ECONNREFUSED 127.0.0
916
997
  - Check if server status shows "connected" or error messages
917
998
 
918
999
  - **Environment Variables**:
919
- - If using custom environment variables (Chrome path, proxy), verify they're correctly set
1000
+ - If using custom environment variables (Brave path, proxy), verify they're correctly set
920
1001
  - Test without environment variables first: `claude mcp add brave-real-browser -- npx brave-real-browser-mcp-server@latest`
921
1002
 
922
1003
  - **Node.js and npx Issues**:
@@ -1039,11 +1120,11 @@ A: Supports reCAPTCHA, hCaptcha, and Cloudflare Turnstile through brave-real-bro
1039
1120
  **Q: Is this detectable by websites?**
1040
1121
  A: brave-real-browser includes anti-detection features, but no solution is 100% undetectable.
1041
1122
 
1042
- **Q: Can I use custom Chrome extensions?**
1043
- A: Yes, through the `plugins` option in browser_init.
1123
+ **Q: Can I use custom Brave extensions?**
1124
+ A: Yes, through the `plugins` option in browser_init. Brave extensions and Chrome extensions are compatible.
1044
1125
 
1045
1126
  **Q: Does it work on all operating systems?**
1046
- A: Yes, tested on Windows, macOS, and Linux. The server automatically detects Chrome installations on all platforms.
1127
+ A: Yes, tested on Windows, macOS, and Linux. The server automatically detects Brave Browser installations on all platforms with advanced multi-layer detection.
1047
1128
 
1048
1129
  **Q: What's the difference between Claude Desktop, Claude Code CLI, and Cursor IDE configurations?**
1049
1130
  A: Here's a comparison:
@@ -1064,30 +1145,30 @@ A: Here's a comparison:
1064
1145
  - **Claude Code CLI**: `claude mcp add brave-real-browser -- npx brave-real-browser-mcp-server@latest`
1065
1146
  - **Cursor IDE**: One-click install or manual JSON config
1066
1147
 
1067
- **Q: What if Chrome is installed in a non-standard location?**
1068
- A: Version 1.3.0 dramatically improves Chrome detection. The server now searches 15+ locations including portable installations and uses Windows Registry detection. If Chrome is still not found automatically, you can:
1069
- 1. Set environment variable: `set CHROME_PATH="C:\Your\Chrome\Path\chrome.exe"`
1070
- 2. Use the `customConfig.chromePath` option: `{"customConfig": {"chromePath": "C:\\Custom\\Chrome\\chrome.exe"}}`
1071
-
1072
- **Q: Why am I getting "Chrome not found" or ECONNREFUSED errors on Windows?**
1073
- A: Version 1.3.0 includes comprehensive fixes for Windows Chrome detection and connection issues. The server now automatically searches these locations and more:
1074
- - `C:\Program Files\Google\Chrome\Application\chrome.exe`
1075
- - `C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
1076
- - `%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe`
1077
- - `%USERPROFILE%\AppData\Local\Google\Chrome\Application\chrome.exe`
1078
- - Chrome Canary installations
1079
- - Portable Chrome installations
1148
+ **Q: What if Brave is installed in a non-standard location?**
1149
+ A: Version 2.9.5 dramatically improves Brave detection with multi-layer scanning. The server now searches 15+ locations including portable installations and uses Windows Registry detection for all Brave variants. If Brave is still not found automatically, you can:
1150
+ 1. Set environment variable: `set BRAVE_PATH="C:\Your\Brave\Path\brave.exe"`
1151
+ 2. Use the `customConfig.chromePath` option: `{"customConfig": {"chromePath": "C:\\Custom\\Brave\\brave.exe"}}`
1152
+
1153
+ **Q: Why am I getting "Brave not found" or ECONNREFUSED errors on Windows?**
1154
+ A: Version 2.9.5 includes comprehensive fixes for Windows Brave detection and connection issues. The server now automatically searches these locations and more:
1155
+ - `C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe`
1156
+ - `C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe`
1157
+ - `%LOCALAPPDATA%\BraveSoftware\Brave-Browser\Application\brave.exe`
1158
+ - `%USERPROFILE%\AppData\Local\BraveSoftware\Brave-Browser\Application\brave.exe`
1159
+ - All Brave variants (Stable, Beta, Dev, Nightly) installations
1160
+ - Portable Brave installations
1080
1161
  - Registry-detected installations
1081
1162
 
1082
- The server also implements multiple connection strategies with automatic fallback between localhost and 127.0.0.1, plus enhanced Windows-specific Chrome flags for better compatibility.
1163
+ The server also implements multiple connection strategies with automatic fallback between localhost and 127.0.0.1, plus enhanced Windows-specific Brave flags for better compatibility.
1083
1164
 
1084
- **Q: I'm still getting ECONNREFUSED errors after upgrading to v1.3.0. What should I do?**
1165
+ **Q: I'm still getting ECONNREFUSED errors after upgrading to v2.9.5. What should I do?**
1085
1166
  A: Try these steps in order:
1086
- 1. Set the `CHROME_PATH` environment variable to your Chrome location
1087
- 2. Kill all existing Chrome processes: `taskkill /f /im chrome.exe`
1167
+ 1. Set the `BRAVE_PATH` environment variable to your Brave location
1168
+ 2. Kill all existing Brave processes: `taskkill /f /im brave.exe`
1088
1169
  3. Check your Windows hosts file contains: `127.0.0.1 localhost`
1089
1170
  4. Try running your IDE as Administrator
1090
- 5. Add Chrome to Windows Defender exclusions
1171
+ 5. Add Brave Browser to Windows Defender exclusions
1091
1172
  6. If using a VPN/proxy, try disabling it temporarily
1092
1173
 
1093
1174
  ### Debug Mode
@@ -1186,7 +1267,7 @@ npm run test:debug # Environment diagnostics and troubleshooting
1186
1267
 
1187
1268
  Debug tools provide:
1188
1269
  - Environment validation (Node.js version, platform, memory)
1189
- - Chrome installation detection with specific paths
1270
+ - Brave Browser installation detection with specific paths
1190
1271
  - Quick server health check with startup timing
1191
1272
  - Network connectivity validation
1192
1273
  - Build status verification
@@ -1228,9 +1309,22 @@ This project is licensed under the MIT License - see the LICENSE file for detail
1228
1309
 
1229
1310
  ## Acknowledgments
1230
1311
 
1231
- This MCP server is based on the excellent [brave-real-browser](https://github.com/ZFC-Digital/brave-real-browser) library by ZFC-Digital.
1312
+ ### 🦁 **Powered by brave-real-browser**
1313
+
1314
+ This MCP server is built upon the excellent **[brave-real-browser](https://github.com/ZFC-Digital/brave-real-browser)** library by **ZFC-Digital**, which provides the core automation capabilities.
1315
+
1316
+ **Why brave-real-browser is Amazing:**
1317
+ - **🛡️ Advanced Anti-Detection**: Sophisticated techniques to bypass bot detection
1318
+ - **🦁 Brave Browser Optimized**: Specifically designed for Brave Browser
1319
+ - **🔒 Privacy-First**: Built with privacy and security in mind
1320
+ - **🎨 Stealth Capabilities**: Natural human-like interactions
1321
+ - **⚡ High Performance**: Optimized for speed and reliability
1322
+ - **🔧 Professional Grade**: Enterprise-level automation features
1232
1323
 
1233
1324
  **Thank you** to the brave-real-browser team for creating such a powerful and detection-resistant browser automation solution!
1234
1325
 
1235
- - GitHub: [https://github.com/ZFC-Digital/brave-real-browser](https://github.com/ZFC-Digital/brave-real-browser)
1236
- - npm: [https://www.npmjs.com/package/brave-real-browser](https://www.npmjs.com/package/brave-real-browser)
1326
+ **Resources:**
1327
+ - **GitHub**: [https://github.com/ZFC-Digital/brave-real-browser](https://github.com/ZFC-Digital/brave-real-browser)
1328
+ - **npm Package**: [https://www.npmjs.com/package/brave-real-browser](https://www.npmjs.com/package/brave-real-browser)
1329
+ - **Documentation**: Comprehensive guides and examples
1330
+ - **Community**: Active development and support
@@ -109,33 +109,48 @@ export function categorizeError(error) {
109
109
  // Timeout wrapper for operations that may hang
110
110
  export async function withTimeout(operation, timeoutMs, context = 'unknown') {
111
111
  return new Promise((resolve, reject) => {
112
+ let isResolved = false;
112
113
  const timer = setTimeout(() => {
113
- reject(new Error(`Operation timed out after ${timeoutMs}ms in context: ${context}`));
114
+ if (!isResolved) {
115
+ isResolved = true;
116
+ reject(new Error(`Operation timed out after ${timeoutMs}ms in context: ${context}`));
117
+ }
114
118
  }, timeoutMs);
115
119
  operation()
116
120
  .then((result) => {
117
- clearTimeout(timer);
118
- resolve(result);
121
+ if (!isResolved) {
122
+ isResolved = true;
123
+ clearTimeout(timer);
124
+ resolve(result);
125
+ }
119
126
  })
120
127
  .catch((error) => {
121
- clearTimeout(timer);
122
- reject(error);
128
+ if (!isResolved) {
129
+ isResolved = true;
130
+ clearTimeout(timer);
131
+ reject(error);
132
+ }
123
133
  });
124
134
  });
125
135
  }
126
136
  // Port availability and connection utilities for enhanced resilience
127
137
  export async function isPortAvailable(port, host = '127.0.0.1') {
128
138
  return new Promise((resolve) => {
129
- const server = net.createServer();
130
- server.listen(port, host, () => {
131
- server.once('close', () => {
132
- resolve(true);
139
+ try {
140
+ const server = net.createServer();
141
+ server.listen(port, host, () => {
142
+ server.once('close', () => {
143
+ resolve(true);
144
+ });
145
+ server.close();
133
146
  });
134
- server.close();
135
- });
136
- server.on('error', () => {
147
+ server.on('error', () => {
148
+ resolve(false);
149
+ });
150
+ }
151
+ catch (error) {
137
152
  resolve(false);
138
- });
153
+ }
139
154
  });
140
155
  }
141
156
  // Test localhost resolution and connectivity
@@ -247,57 +262,8 @@ function getWindowsBraveFromRegistry() {
247
262
  }
248
263
  return null;
249
264
  }
250
- // Windows Registry Chrome detection
251
- function getWindowsChromeFromRegistry() {
252
- if (process.platform !== 'win32')
253
- return null;
254
- try {
255
- const { execSync } = require('child_process');
256
- const registryQueries = [
257
- 'reg query "HKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon" /v version 2>nul',
258
- 'reg query "HKEY_LOCAL_MACHINE\\Software\\Google\\Chrome\\BLBeacon" /v version 2>nul',
259
- 'reg query "HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Google\\Chrome\\BLBeacon" /v version 2>nul',
260
- ];
261
- for (const query of registryQueries) {
262
- try {
263
- const result = execSync(query, { encoding: 'utf8', timeout: 5000 });
264
- if (result) {
265
- const standardPaths = [
266
- 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
267
- 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
268
- ];
269
- for (const standardPath of standardPaths) {
270
- if (fs.existsSync(standardPath)) {
271
- console.error(`✓ Found Chrome via Registry detection: ${standardPath}`);
272
- return standardPath;
273
- }
274
- }
275
- }
276
- }
277
- catch (error) {
278
- // Continue to next registry query
279
- }
280
- }
281
- try {
282
- const installDirQuery = 'reg query "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe" /ve 2>nul';
283
- const result = execSync(installDirQuery, { encoding: 'utf8', timeout: 5000 });
284
- const match = result.match(/REG_SZ\s+(.+\.exe)/);
285
- if (match && match[1] && fs.existsSync(match[1])) {
286
- console.error(`✓ Found Chrome via App Paths registry: ${match[1]}`);
287
- return match[1];
288
- }
289
- }
290
- catch (error) {
291
- // Registry detection failed, will fall back to file system search
292
- }
293
- }
294
- catch (error) {
295
- console.error('Windows Registry Chrome detection failed:', error instanceof Error ? error.message : String(error));
296
- }
297
- return null;
298
- }
299
265
  // Brave Browser path detection (cross-platform support)
300
- // Purely Brave-focused - no Chrome fallback needed since system works perfectly without Chrome
266
+ // Pure Brave-only detection - This project is designed specifically for Brave Browser
301
267
  export function detectBravePath() {
302
268
  const platform = process.platform;
303
269
  // PRIORITY -1: Use brave-real-launcher's professional detection (BEST METHOD)
@@ -327,20 +293,14 @@ export function detectBravePath() {
327
293
  catch (error) {
328
294
  // Config file not found or invalid, continue with other methods
329
295
  }
330
- // PRIORITY 1: Check environment variables first (BRAVE_PATH has priority)
296
+ // PRIORITY 1: Check environment variables first (BRAVE_PATH only)
331
297
  const envBravePath = process.env.BRAVE_PATH;
332
298
  if (envBravePath && fs.existsSync(envBravePath)) {
333
299
  console.error(`✓ Found Brave via BRAVE_PATH environment variable: ${envBravePath}`);
334
300
  return envBravePath;
335
301
  }
336
- const envChromePath = process.env.CHROME_PATH || process.env.PUPPETEER_EXECUTABLE_PATH;
337
- if (envChromePath && fs.existsSync(envChromePath)) {
338
- console.error(`✓ Found Chrome via environment variable: ${envChromePath}`);
339
- return envChromePath;
340
- }
341
- // PRIORITY 2: Try Brave paths FIRST (this is Brave-Real-Browser project!)
302
+ // PRIORITY 2: Brave paths detection (Brave-only project!)
342
303
  let bravePaths = [];
343
- let chromePaths = [];
344
304
  switch (platform) {
345
305
  case 'win32':
346
306
  // BRAVE PATHS (PRIORITY - Try these first!)
@@ -352,23 +312,7 @@ export function detectBravePath() {
352
312
  path.join(process.env.PROGRAMFILES || '', 'BraveSoftware\\Brave-Browser\\Application\\brave.exe'),
353
313
  path.join(process.env['PROGRAMFILES(X86)'] || '', 'BraveSoftware\\Brave-Browser\\Application\\brave.exe'),
354
314
  ];
355
- // Chrome paths (fallback)
356
- chromePaths = [
357
- 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
358
- 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
359
- path.join(process.env.LOCALAPPDATA || '', 'Google\\Chrome\\Application\\chrome.exe'),
360
- path.join(process.env.USERPROFILE || '', 'AppData\\Local\\Google\\Chrome\\Application\\chrome.exe'),
361
- path.join(process.env.PROGRAMFILES || '', 'Google\\Chrome\\Application\\chrome.exe'),
362
- path.join(process.env['PROGRAMFILES(X86)'] || '', 'Google\\Chrome\\Application\\chrome.exe'),
363
- path.join(process.env.LOCALAPPDATA || '', 'Google\\Chrome SxS\\Application\\chrome.exe'),
364
- 'C:\\Program Files\\Google\\Chrome SxS\\Application\\chrome.exe',
365
- 'C:\\Users\\Public\\Desktop\\Google Chrome.exe',
366
- path.join(process.env.APPDATA || '', 'Google\\Chrome\\Application\\chrome.exe'),
367
- 'C:\\Chrome\\chrome.exe',
368
- 'C:\\google\\chrome\\chrome.exe',
369
- 'C:\\PortableApps\\GoogleChromePortable\\App\\Chrome-bin\\chrome.exe',
370
- ];
371
- // Try Brave registry first
315
+ // Try Brave registry detection
372
316
  try {
373
317
  const braveRegistryPath = getWindowsBraveFromRegistry();
374
318
  if (braveRegistryPath) {
@@ -378,16 +322,6 @@ export function detectBravePath() {
378
322
  catch (error) {
379
323
  console.error('Brave registry detection failed, continuing with file system search...');
380
324
  }
381
- // Try Chrome registry as fallback
382
- try {
383
- const chromeRegistryPath = getWindowsChromeFromRegistry();
384
- if (chromeRegistryPath) {
385
- chromePaths.unshift(chromeRegistryPath);
386
- }
387
- }
388
- catch (error) {
389
- console.error('Chrome registry detection failed, continuing with file system search...');
390
- }
391
325
  break;
392
326
  case 'darwin':
393
327
  // BRAVE PATHS (PRIORITY)
@@ -397,12 +331,6 @@ export function detectBravePath() {
397
331
  '/Applications/Brave Browser Beta.app/Contents/MacOS/Brave Browser Beta',
398
332
  '/Applications/Brave Browser Dev.app/Contents/MacOS/Brave Browser Dev',
399
333
  ];
400
- // Chrome paths (fallback)
401
- chromePaths = [
402
- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
403
- '/Applications/Chromium.app/Contents/MacOS/Chromium',
404
- '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
405
- ];
406
334
  break;
407
335
  case 'linux':
408
336
  // BRAVE PATHS (PRIORITY)
@@ -415,16 +343,6 @@ export function detectBravePath() {
415
343
  '/opt/brave/brave-browser',
416
344
  '/usr/local/bin/brave-browser',
417
345
  ];
418
- // Chrome paths (fallback)
419
- chromePaths = [
420
- '/usr/bin/google-chrome',
421
- '/usr/bin/google-chrome-stable',
422
- '/usr/bin/chromium-browser',
423
- '/usr/bin/chromium',
424
- '/snap/bin/chromium',
425
- '/usr/bin/chrome',
426
- '/opt/google/chrome/chrome'
427
- ];
428
346
  break;
429
347
  default:
430
348
  console.error(`Platform ${platform} not explicitly supported for browser path detection`);
@@ -476,26 +394,20 @@ export function detectBravePath() {
476
394
  console.error(` - Set BRAVE_PATH environment variable if needed`);
477
395
  console.error(`\n 2. Environment Variables:`);
478
396
  console.error(` - Set BRAVE_PATH for Brave: set BRAVE_PATH="C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"`);
479
- console.error(` - Or set CHROME_PATH for Chrome: set CHROME_PATH="C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"`);
480
- console.error(` - For Cursor IDE: Add env vars to MCP configuration`);
481
- console.error(`\n 3. Alternative: Install Chrome:`);
482
- console.error(` - Download Chrome: https://www.google.com/chrome/`);
483
- console.error(` - Chrome works as fallback when Brave is not available`);
484
- console.error(`\n 4. Permissions & Security:`);
397
+ console.error(` - For Cursor IDE: Add BRAVE_PATH env var to MCP configuration`);
398
+ console.error(`\n 3. Permissions & Security:`);
485
399
  console.error(` - Run IDE/terminal as Administrator`);
486
- console.error(` - Add browser to Windows Defender exclusions`);
487
- console.error(`\n 5. Custom Configuration:`);
488
- console.error(` - Use customConfig.chromePath parameter in browser_init`);
489
- console.error(` - Works with both Brave and Chrome`);
400
+ console.error(` - Add Brave browser to Windows Defender exclusions`);
401
+ console.error(`\n 4. Custom Configuration:`);
402
+ console.error(` - Use customConfig.chromePath parameter in browser_init (with Brave path)`);
403
+ console.error(` - This project is optimized specifically for Brave Browser`);
490
404
  }
491
405
  else {
492
- console.error(`❌ Neither Brave nor Chrome found at any expected paths for platform: ${platform}`);
406
+ console.error(`❌ Brave Browser not found at any expected paths for platform: ${platform}`);
493
407
  console.error(`\n 🦁 Brave paths checked:`);
494
408
  bravePaths.forEach(p => console.error(` - ${p}`));
495
- console.error(`\n 🌐 Chrome paths checked:`);
496
- chromePaths.forEach(p => console.error(` - ${p}`));
497
- console.error(`\n 💡 Install Brave Browser (recommended): https://brave.com/download/`);
498
- console.error(` 💡 Or install Chrome as fallback: https://www.google.com/chrome/`);
409
+ console.error(`\n 💡 Install Brave Browser: https://brave.com/download/`);
410
+ console.error(` 💡 This project is specifically designed for Brave Browser`);
499
411
  }
500
412
  return null;
501
413
  }
@@ -813,7 +725,7 @@ export async function initializeBrowser(options) {
813
725
  }
814
726
  throw connectionError;
815
727
  }
816
- }, platform === 'win32' ? 180000 : 150000, `browser-connection-${strategyName.toLowerCase().replace(/\s+/g, '-')}`);
728
+ }, platform === 'win32' ? 30000 : 25000, `browser-connection-${strategyName.toLowerCase().replace(/\s+/g, '-')}`);
817
729
  const { browser, page } = result;
818
730
  browserInstance = browser;
819
731
  pageInstance = page;
@@ -954,31 +866,25 @@ export async function closeBrowser() {
954
866
  }
955
867
  }
956
868
  }
957
- // Force kill all Brave and Chrome browser processes system-wide
869
+ // Force kill all Brave browser processes system-wide
958
870
  export async function forceKillBraveProcesses() {
959
871
  try {
960
872
  const { spawn } = await import('child_process');
961
873
  if (process.platform !== 'win32') {
962
- // Kill Brave processes (priority)
874
+ // Kill Brave processes on Unix-like systems
963
875
  spawn('pkill', ['-f', 'Brave Browser'], { stdio: 'ignore' });
964
876
  spawn('pkill', ['-f', 'brave'], { stdio: 'ignore' });
965
- // Kill Chrome processes (fallback)
966
- spawn('pkill', ['-f', 'Google Chrome'], { stdio: 'ignore' });
967
- spawn('pkill', ['-f', 'chrome'], { stdio: 'ignore' });
968
877
  }
969
878
  else {
970
- // Windows: Kill Brave processes (priority)
879
+ // Windows: Kill Brave processes
971
880
  spawn('taskkill', ['/F', '/IM', 'brave.exe'], { stdio: 'ignore' });
972
- // Windows: Kill Chrome processes (fallback)
973
- spawn('taskkill', ['/F', '/IM', 'chrome.exe'], { stdio: 'ignore' });
974
- spawn('taskkill', ['/F', '/IM', 'GoogleChrome.exe'], { stdio: 'ignore' });
975
881
  }
976
882
  }
977
883
  catch (error) {
978
- console.error('Error force-killing browser processes:', error);
884
+ console.error('Error force-killing Brave browser processes:', error);
979
885
  }
980
886
  }
981
- // Alias for backward compatibility
887
+ // Aliases for backward compatibility (now all point to Brave-only function)
982
888
  export const forceKillChromeProcesses = forceKillBraveProcesses;
983
889
  export const forceKillAllChromeProcesses = forceKillBraveProcesses;
984
890
  // Getters for browser instances
@@ -5,7 +5,7 @@
5
5
  * - AAA Pattern (Arrange-Act-Assert)
6
6
  * - Behavior-focused testing with proper mocking
7
7
  * - Error categorization and circuit breaker testing
8
- * - Chrome detection and network utilities testing
8
+ * - Brave detection and network utilities testing
9
9
  */
10
10
  import { describe, it, expect, beforeEach, vi } from 'vitest';
11
11
  import { categorizeError, BrowserErrorType, withTimeout, isPortAvailable, testHostConnectivity, findAvailablePort, updateCircuitBreakerOnFailure, updateCircuitBreakerOnSuccess, isCircuitBreakerOpen, detectBravePath, validateSession, findAuthElements, getContentPriorityConfig, updateContentPriorityConfig, getBrowserInstance, getPageInstance, forceKillBraveProcesses } from './browser-manager.js';
@@ -110,8 +110,8 @@ describe('Browser Manager', () => {
110
110
  });
111
111
  describe('Timeout Wrapper', () => {
112
112
  it('should resolve when operation completes within timeout', async () => {
113
- // Arrange: Create operation that resolves quickly
114
- const operation = vi.fn().mockResolvedValue('success');
113
+ // Arrange: Create operation that resolves immediately
114
+ const operation = vi.fn().mockImplementation(() => Promise.resolve('success'));
115
115
  // Act: Execute with timeout
116
116
  const result = await withTimeout(operation, 1000, 'test-context');
117
117
  // Assert: Should return operation result
@@ -127,21 +127,22 @@ describe('Browser Manager', () => {
127
127
  expect(operation).toHaveBeenCalledOnce();
128
128
  });
129
129
  it('should reject when operation throws error', async () => {
130
- // Arrange: Create operation that throws
131
- const operation = vi.fn().mockRejectedValue(new Error('operation failed'));
130
+ // Arrange: Create operation that throws immediately
131
+ const operation = vi.fn().mockImplementation(() => Promise.reject(new Error('operation failed')));
132
132
  // Act & Assert: Should propagate operation error
133
133
  await expect(withTimeout(operation, 1000, 'test-context'))
134
134
  .rejects.toThrow('operation failed');
135
135
  expect(operation).toHaveBeenCalledOnce();
136
136
  });
137
137
  it('should clear timeout when operation completes', async () => {
138
- // Arrange: Create operation that resolves
139
- const operation = vi.fn().mockResolvedValue('success');
138
+ // Arrange: Create operation that resolves immediately
139
+ const operation = vi.fn().mockImplementation(() => Promise.resolve('success'));
140
140
  const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
141
141
  // Act: Execute with timeout
142
142
  await withTimeout(operation, 1000, 'test-context');
143
143
  // Assert: Should clear timeout
144
144
  expect(clearTimeoutSpy).toHaveBeenCalled();
145
+ clearTimeoutSpy.mockRestore();
145
146
  });
146
147
  });
147
148
  describe('Port Availability', () => {
@@ -46,7 +46,7 @@ export async function handleRESTAPIEndpointFinder(args) {
46
46
  await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 });
47
47
  }
48
48
  // Wait for additional requests
49
- await page.waitForTimeout(scanDuration);
49
+ await new Promise(resolve => setTimeout(resolve, scanDuration));
50
50
  page.off('request', requestHandler);
51
51
  }
52
52
  // Also scan page content for API endpoints
@@ -207,7 +207,7 @@ export async function handlePuzzleCaptchaHandler(args) {
207
207
  const stepSize = targetDistance / steps;
208
208
  for (let i = 0; i < steps; i++) {
209
209
  await page.mouse.move(box.x + box.width / 2 + (stepSize * i), box.y + box.height / 2, { steps: 5 });
210
- await page.waitForTimeout(50 + Math.random() * 50); // Random delay for human-like behavior
210
+ await new Promise(resolve => setTimeout(resolve, 50 + Math.random() * 50)); // Random delay for human-like behavior
211
211
  }
212
212
  await page.mouse.up();
213
213
  result.attemptedSolve = true;
@@ -1,7 +1,7 @@
1
1
  // Pagination & Navigation Tools
2
2
  // Auto pagination, infinite scroll, multi-page scraping, sitemap parser
3
3
  // @ts-nocheck
4
- import { getCurrentPage } from '../browser-manager.js';
4
+ import { getPageInstance } from '../browser-manager.js';
5
5
  import { validateWorkflow } from '../workflow-validation.js';
6
6
  import { withErrorHandling } from '../system-utils.js';
7
7
  import * as xml2js from 'xml2js';
@@ -14,7 +14,10 @@ export async function handleAutoPagination(args) {
14
14
  requireBrowser: true,
15
15
  requirePage: true,
16
16
  });
17
- const page = getCurrentPage();
17
+ const page = getPageInstance();
18
+ if (!page) {
19
+ throw new Error('Browser not initialized. Call browser_init first.');
20
+ }
18
21
  const nextButtonSelector = args.nextButtonSelector || 'a[rel="next"], button:contains("Next"), .next, .pagination-next';
19
22
  const maxPages = args.maxPages || 10;
20
23
  const dataSelector = args.dataSelector;
@@ -51,14 +54,14 @@ export async function handleAutoPagination(args) {
51
54
  }
52
55
  // Click next button
53
56
  await nextButton.click();
54
- await page.waitForTimeout(waitBetweenPages);
57
+ await new Promise(resolve => setTimeout(resolve, waitBetweenPages));
55
58
  // Wait for navigation or content load
56
59
  try {
57
60
  await page.waitForNavigation({ timeout: 5000, waitUntil: 'domcontentloaded' });
58
61
  }
59
62
  catch (e) {
60
63
  // No navigation occurred, content loaded dynamically
61
- await page.waitForTimeout(1000);
64
+ await new Promise(resolve => setTimeout(resolve, 1000));
62
65
  }
63
66
  currentPage++;
64
67
  }
@@ -81,7 +84,10 @@ export async function handleInfiniteScroll(args) {
81
84
  requireBrowser: true,
82
85
  requirePage: true,
83
86
  });
84
- const page = getCurrentPage();
87
+ const page = getPageInstance();
88
+ if (!page) {
89
+ throw new Error('Browser not initialized. Call browser_init first.');
90
+ }
85
91
  const maxScrolls = args.maxScrolls || 10;
86
92
  const scrollDelay = args.scrollDelay || 1000;
87
93
  const dataSelector = args.dataSelector;
@@ -114,7 +120,7 @@ export async function handleInfiniteScroll(args) {
114
120
  window.scrollTo(0, document.body.scrollHeight);
115
121
  });
116
122
  // Wait for new content to load
117
- await page.waitForTimeout(scrollDelay);
123
+ await new Promise(resolve => setTimeout(resolve, scrollDelay));
118
124
  scrollCount++;
119
125
  }
120
126
  return {
@@ -136,7 +142,10 @@ export async function handleMultiPageScraper(args) {
136
142
  requireBrowser: true,
137
143
  requirePage: true,
138
144
  });
139
- const page = getCurrentPage();
145
+ const page = getPageInstance();
146
+ if (!page) {
147
+ throw new Error('Browser not initialized. Call browser_init first.');
148
+ }
140
149
  const urls = args.urls;
141
150
  const dataSelector = args.dataSelector;
142
151
  const waitBetweenPages = args.waitBetweenPages || 1000;
@@ -145,7 +154,7 @@ export async function handleMultiPageScraper(args) {
145
154
  const url = urls[i];
146
155
  try {
147
156
  await page.goto(url, { waitUntil: 'domcontentloaded' });
148
- await page.waitForTimeout(waitBetweenPages);
157
+ await new Promise(resolve => setTimeout(resolve, waitBetweenPages));
149
158
  const pageData = await page.evaluate((selector) => {
150
159
  const elements = document.querySelectorAll(selector);
151
160
  return Array.from(elements).map((el) => ({
@@ -187,7 +196,10 @@ export async function handleSitemapParser(args) {
187
196
  requireBrowser: true,
188
197
  requirePage: true,
189
198
  });
190
- const page = getCurrentPage();
199
+ const page = getPageInstance();
200
+ if (!page) {
201
+ throw new Error('Browser not initialized. Call browser_init first.');
202
+ }
191
203
  const currentUrl = page.url();
192
204
  const baseUrl = new URL(currentUrl).origin;
193
205
  const sitemapUrl = args.sitemapUrl || `${baseUrl}/sitemap.xml`;
@@ -255,7 +267,10 @@ export async function handleBreadcrumbNavigator(args) {
255
267
  requireBrowser: true,
256
268
  requirePage: true,
257
269
  });
258
- const page = getCurrentPage();
270
+ const page = getPageInstance();
271
+ if (!page) {
272
+ throw new Error('Browser not initialized. Call browser_init first.');
273
+ }
259
274
  const breadcrumbSelector = args.breadcrumbSelector || '.breadcrumb, nav[aria-label="breadcrumb"], .breadcrumbs';
260
275
  const followLinks = args.followLinks || false;
261
276
  const breadcrumbData = await page.evaluate((selector) => {
@@ -236,7 +236,7 @@ export async function handleVideoRecording(args) {
236
236
  const framePath = path.join(framesDir, `frame_${i.toString().padStart(4, '0')}.png`);
237
237
  await page.screenshot({ path: framePath });
238
238
  frames.push(framePath);
239
- await page.waitForTimeout(frameDelay);
239
+ await new Promise(resolve => setTimeout(resolve, frameDelay));
240
240
  }
241
241
  }
242
242
  return {
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { TOOLS, SERVER_INFO, CAPABILITIES, TOOL_NAMES } from './tool-definitions
13
13
  console.error('🔍 [DEBUG] Loading system utils...');
14
14
  import { withErrorHandling } from './system-utils.js';
15
15
  console.error('🔍 [DEBUG] Loading browser manager...');
16
- import { closeBrowser, forceKillAllChromeProcesses } from './browser-manager.js';
16
+ import { closeBrowser, forceKillBraveProcesses } from './browser-manager.js';
17
17
  console.error('🔍 [DEBUG] Loading core infrastructure...');
18
18
  import { setupProcessCleanup } from './core-infrastructure.js';
19
19
  // Import handlers
@@ -266,7 +266,7 @@ async function main() {
266
266
  setupProcessCleanup(async () => {
267
267
  console.error('🔍 [DEBUG] Process cleanup triggered');
268
268
  await closeBrowser();
269
- await forceKillAllChromeProcesses();
269
+ await forceKillBraveProcesses();
270
270
  });
271
271
  // Create and start the server transport
272
272
  console.error('🔍 [DEBUG] Creating StdioServerTransport...');
@@ -25,7 +25,7 @@ export const DEFAULT_CONTENT_PRIORITY_CONFIG = {
25
25
  export const TOOLS = [
26
26
  {
27
27
  name: 'browser_init',
28
- description: 'Initialize a new browser instance with anti-detection features and automatic Chrome path detection',
28
+ description: 'Initialize a new browser instance with anti-detection features and automatic Brave Browser path detection',
29
29
  inputSchema: {
30
30
  type: 'object',
31
31
  properties: {
@@ -41,7 +41,7 @@ export const TOOLS = [
41
41
  },
42
42
  ignoreAllFlags: {
43
43
  type: 'boolean',
44
- description: 'Ignore all Chrome flags (recommended: true for clean startup without --no-sandbox)',
44
+ description: 'Ignore all browser flags (recommended: true for clean startup without --no-sandbox)',
45
45
  default: true,
46
46
  },
47
47
  proxy: {
@@ -62,11 +62,11 @@ export const TOOLS = [
62
62
  },
63
63
  customConfig: {
64
64
  type: 'object',
65
- description: 'Custom configuration for Chrome launcher. Use chromePath to specify custom Chrome executable path',
65
+ description: 'Custom configuration for Brave launcher. Use chromePath to specify custom Brave executable path',
66
66
  properties: {
67
67
  chromePath: {
68
68
  type: 'string',
69
- description: 'Custom path to Chrome executable (auto-detected if not specified)',
69
+ description: 'Custom path to Brave executable (auto-detected if not specified)',
70
70
  },
71
71
  },
72
72
  additionalProperties: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.9.5",
3
+ "version": "2.9.7",
4
4
  "description": "MCP server for brave-real-browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.20.0",
37
+ "@types/pngjs": "^6.0.5",
37
38
  "@types/turndown": "^5.0.5",
38
39
  "ajv": "^8.12.0",
39
- "axios": "^1.6.5",
40
+ "axios": "^1.12.2",
40
41
  "brave-real-browser": "^1.5.102",
41
42
  "brave-real-launcher": "^1.2.16",
42
- "brave-real-playwright-core": "^1.55.1-patch.1",
43
- "brave-real-puppeteer-core": "^24.23.0-patch.1",
43
+ "brave-real-puppeteer-core": "^24.24.0",
44
44
  "cheerio": "^1.0.0-rc.12",
45
45
  "chrono-node": "^2.7.0",
46
46
  "compromise": "^14.13.0",