brave-real-browser-mcp-server 2.9.9 → 2.9.11
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 +41 -39
- package/dist/browser-manager.js +17 -17
- package/dist/handlers/browser-handlers.js +1 -1
- package/dist/handlers/content-handlers.js +1 -1
- package/dist/handlers/navigation-handlers.js +2 -2
- package/dist/handlers/specialized-tools-handlers.js +1738 -0
- package/dist/handlers/video-extraction-handlers.js +5 -10
- package/dist/index.js +258 -63
- package/dist/tool-definitions.js +444 -0
- package/dist/video-extraction/dom-extractors.js +101 -0
- package/dist/workflow-validation.js +31 -1
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -43,6 +43,46 @@ If you're just using this MCP server (not developing it), you don't need to run
|
|
|
43
43
|
- Download and install Node.js (version 18 or higher)
|
|
44
44
|
- Verify installation by opening terminal/command prompt and typing: `node --version`
|
|
45
45
|
|
|
46
|
+
## Installation for Developers
|
|
47
|
+
|
|
48
|
+
> **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.
|
|
49
|
+
|
|
50
|
+
This section is for developers who want to:
|
|
51
|
+
- Contribute to the project
|
|
52
|
+
- Run the server locally for development
|
|
53
|
+
- Create custom modifications
|
|
54
|
+
|
|
55
|
+
### Global Installation (For Command Line Usage)
|
|
56
|
+
|
|
57
|
+
If you want to run the server directly from the command line without using npx:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install -g brave-real-browser-mcp-server@latest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
After global installation, you can run:
|
|
64
|
+
```bash
|
|
65
|
+
brave-real-browser-mcp-server
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Development Setup (For Contributors)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Clone the repository
|
|
72
|
+
git clone https://github.com/withLinda/brave-real-browser-mcp-server.git
|
|
73
|
+
cd brave-real-browser-mcp-server
|
|
74
|
+
|
|
75
|
+
# Install dependencies
|
|
76
|
+
npm install
|
|
77
|
+
|
|
78
|
+
# Build the project
|
|
79
|
+
npm run build
|
|
80
|
+
|
|
81
|
+
# Run in development mode
|
|
82
|
+
npm run dev
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
|
|
46
86
|
#### 2. Configure Claude Desktop
|
|
47
87
|
|
|
48
88
|
**For Windows:**
|
|
@@ -68,7 +108,7 @@ If you're just using this MCP server (not developing it), you don't need to run
|
|
|
68
108
|
"command": "npx",
|
|
69
109
|
"args": ["brave-real-browser-mcp-server@latest"],
|
|
70
110
|
"env": {
|
|
71
|
-
"BRAVE_PATH": "C
|
|
111
|
+
"BRAVE_PATH": "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
|
|
72
112
|
}
|
|
73
113
|
}
|
|
74
114
|
}
|
|
@@ -207,44 +247,6 @@ This project **exclusively uses Brave Browser** and is specifically optimized fo
|
|
|
207
247
|
- Detected paths: `/usr/bin/brave-browser`, `/snap/bin/brave`, `/usr/bin/brave`, `/opt/brave.com/brave/brave-browser`
|
|
208
248
|
- Install xvfb for headless operation: `sudo apt-get install -y xvfb`
|
|
209
249
|
|
|
210
|
-
## Installation for Developers
|
|
211
|
-
|
|
212
|
-
> **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.
|
|
213
|
-
|
|
214
|
-
This section is for developers who want to:
|
|
215
|
-
- Contribute to the project
|
|
216
|
-
- Run the server locally for development
|
|
217
|
-
- Create custom modifications
|
|
218
|
-
|
|
219
|
-
### Global Installation (For Command Line Usage)
|
|
220
|
-
|
|
221
|
-
If you want to run the server directly from the command line without using npx:
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
npm install -g brave-real-browser-mcp-server@latest
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
After global installation, you can run:
|
|
228
|
-
```bash
|
|
229
|
-
brave-real-browser-mcp-server
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Development Setup (For Contributors)
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
# Clone the repository
|
|
236
|
-
git clone https://github.com/withLinda/brave-real-browser-mcp-server.git
|
|
237
|
-
cd brave-real-browser-mcp-server
|
|
238
|
-
|
|
239
|
-
# Install dependencies
|
|
240
|
-
npm install
|
|
241
|
-
|
|
242
|
-
# Build the project
|
|
243
|
-
npm run build
|
|
244
|
-
|
|
245
|
-
# Run in development mode
|
|
246
|
-
npm run dev
|
|
247
|
-
```
|
|
248
250
|
|
|
249
251
|
## Usage
|
|
250
252
|
|
package/dist/browser-manager.js
CHANGED
|
@@ -233,7 +233,7 @@ function getWindowsBraveFromRegistry() {
|
|
|
233
233
|
];
|
|
234
234
|
for (const bravePath of bravePaths) {
|
|
235
235
|
if (fs.existsSync(bravePath)) {
|
|
236
|
-
console.
|
|
236
|
+
console.log(`✅ Found Brave via Registry detection: ${bravePath}`);
|
|
237
237
|
return bravePath;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -249,7 +249,7 @@ function getWindowsBraveFromRegistry() {
|
|
|
249
249
|
const result = execSync(installDirQuery, { encoding: 'utf8', timeout: 5000 });
|
|
250
250
|
const match = result.match(/REG_SZ\s+(.+\.exe)/);
|
|
251
251
|
if (match && match[1] && fs.existsSync(match[1])) {
|
|
252
|
-
console.
|
|
252
|
+
console.log(`✅ Found Brave via App Paths registry: ${match[1]}`);
|
|
253
253
|
return match[1];
|
|
254
254
|
}
|
|
255
255
|
}
|
|
@@ -271,7 +271,7 @@ export function detectBravePath() {
|
|
|
271
271
|
try {
|
|
272
272
|
const bravePath = braveLauncher.getBravePath();
|
|
273
273
|
if (bravePath && fs.existsSync(bravePath)) {
|
|
274
|
-
console.
|
|
274
|
+
console.log(`✅ Found Brave via brave-real-launcher (professional detection): ${bravePath}`);
|
|
275
275
|
return bravePath;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
@@ -285,7 +285,7 @@ export function detectBravePath() {
|
|
|
285
285
|
if (fs.existsSync(configPath)) {
|
|
286
286
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
287
287
|
if (config.bravePath && fs.existsSync(config.bravePath)) {
|
|
288
|
-
console.
|
|
288
|
+
console.log(`✅ Found Brave via .brave-config.json (auto-detected): ${config.bravePath}`);
|
|
289
289
|
return config.bravePath;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
@@ -296,7 +296,7 @@ export function detectBravePath() {
|
|
|
296
296
|
// PRIORITY 1: Check environment variables first (BRAVE_PATH only)
|
|
297
297
|
const envBravePath = process.env.BRAVE_PATH;
|
|
298
298
|
if (envBravePath && fs.existsSync(envBravePath)) {
|
|
299
|
-
console.
|
|
299
|
+
console.log(`✅ Found Brave via BRAVE_PATH environment variable: ${envBravePath}`);
|
|
300
300
|
return envBravePath;
|
|
301
301
|
}
|
|
302
302
|
// PRIORITY 2: Brave paths detection (Brave-only project!)
|
|
@@ -354,8 +354,8 @@ export function detectBravePath() {
|
|
|
354
354
|
try {
|
|
355
355
|
console.error(` Checking: ${bravePath}`);
|
|
356
356
|
if (fs.existsSync(bravePath)) {
|
|
357
|
-
console.
|
|
358
|
-
console.
|
|
357
|
+
console.log(`✅ Found Brave Browser at: ${bravePath}`);
|
|
358
|
+
console.log(' 🎯 Perfect! Using Brave Browser (optimized for this project)');
|
|
359
359
|
return bravePath;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
@@ -598,14 +598,14 @@ export async function initializeBrowser(options) {
|
|
|
598
598
|
if (options?.plugins && Array.isArray(options.plugins)) {
|
|
599
599
|
connectOptions.plugins = options.plugins;
|
|
600
600
|
}
|
|
601
|
-
console.
|
|
601
|
+
console.log('🔍 Testing network connectivity...');
|
|
602
602
|
const hostTest = await testHostConnectivity();
|
|
603
|
-
console.
|
|
604
|
-
console.
|
|
605
|
-
console.
|
|
603
|
+
console.log(` localhost available: ${hostTest.localhost}`);
|
|
604
|
+
console.log(` 127.0.0.1 available: ${hostTest.ipv4}`);
|
|
605
|
+
console.log(` recommended host: ${hostTest.recommendedHost}`);
|
|
606
606
|
const availablePort = await findAvailablePort();
|
|
607
607
|
if (availablePort) {
|
|
608
|
-
console.
|
|
608
|
+
console.log(`🔍 Found available debugging port: ${availablePort}`);
|
|
609
609
|
}
|
|
610
610
|
else {
|
|
611
611
|
console.error('⚠️ No available ports found in range 9222-9322, using system-assigned port');
|
|
@@ -691,17 +691,17 @@ export async function initializeBrowser(options) {
|
|
|
691
691
|
for (let strategyIndex = 0; strategyIndex < connectionStrategies.length; strategyIndex++) {
|
|
692
692
|
const { strategyName, strategy } = connectionStrategies[strategyIndex];
|
|
693
693
|
try {
|
|
694
|
-
console.
|
|
694
|
+
console.log(`🔄 Attempting browser connection using ${strategyName}...`);
|
|
695
695
|
const result = await withTimeout(async () => {
|
|
696
696
|
try {
|
|
697
|
-
console.
|
|
697
|
+
console.log(` Strategy config: ${JSON.stringify({
|
|
698
698
|
headless: strategy.headless,
|
|
699
699
|
ignoreAllFlags: strategy.ignoreAllFlags,
|
|
700
700
|
chromeFlags: strategy.customConfig?.chromeFlags || 'none',
|
|
701
701
|
chromePath: strategy.customConfig?.chromePath || 'default'
|
|
702
702
|
})}`);
|
|
703
703
|
const connectResult = await connect(strategy);
|
|
704
|
-
console.
|
|
704
|
+
console.log(` ✅ Connection successful with ${strategyName}`);
|
|
705
705
|
return connectResult;
|
|
706
706
|
}
|
|
707
707
|
catch (connectionError) {
|
|
@@ -729,7 +729,7 @@ export async function initializeBrowser(options) {
|
|
|
729
729
|
const { browser, page } = result;
|
|
730
730
|
browserInstance = browser;
|
|
731
731
|
pageInstance = page;
|
|
732
|
-
console.
|
|
732
|
+
console.log(`✅ Browser initialized successfully using ${strategyName}`);
|
|
733
733
|
updateCircuitBreakerOnSuccess();
|
|
734
734
|
// Resolve the init promise to unblock waiting calls
|
|
735
735
|
if (resolveInit) {
|
|
@@ -862,7 +862,7 @@ export async function closeBrowser() {
|
|
|
862
862
|
browserInitDepth = 0;
|
|
863
863
|
browserInitializationInProgress = false; // Also reset initialization flag
|
|
864
864
|
browserInitPromise = null; // Clear promise lock
|
|
865
|
-
console.
|
|
865
|
+
console.log('🔄 Browser closed, browserInitDepth and initialization flag reset');
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
}
|
|
@@ -49,7 +49,7 @@ export async function handleBrowserClose() {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
// Workflow validation wrapper
|
|
52
|
-
async function withWorkflowValidation(toolName, args, operation) {
|
|
52
|
+
export async function withWorkflowValidation(toolName, args, operation) {
|
|
53
53
|
// Validate workflow state before execution
|
|
54
54
|
const validation = validateWorkflow(toolName, args);
|
|
55
55
|
// Defensive check: if validation is undefined or null, allow execution (test environment)
|
|
@@ -40,7 +40,7 @@ export async function handleGetContent(args) {
|
|
|
40
40
|
const tokenCount = tokenManager.countTokens(processedContent);
|
|
41
41
|
const maxTokens = 20000; // Safe default for MCP
|
|
42
42
|
if (tokenCount > maxTokens) {
|
|
43
|
-
console.
|
|
43
|
+
console.log(`Content size (${tokenCount} tokens) exceeds limit (${maxTokens} tokens). Chunking content...`);
|
|
44
44
|
const chunks = [processedContent.substring(0, Math.floor(maxTokens * 0.8 * 3))];
|
|
45
45
|
const firstChunk = chunks[0];
|
|
46
46
|
return {
|
|
@@ -10,7 +10,7 @@ export async function handleNavigate(args) {
|
|
|
10
10
|
throw new Error('Browser not initialized. Call browser_init first.');
|
|
11
11
|
}
|
|
12
12
|
const { url, waitUntil = 'domcontentloaded' } = args;
|
|
13
|
-
console.
|
|
13
|
+
console.log(`🔄 Navigating to: ${url}`);
|
|
14
14
|
// Navigate with retry logic
|
|
15
15
|
let lastError = null;
|
|
16
16
|
let success = false;
|
|
@@ -23,7 +23,7 @@ export async function handleNavigate(args) {
|
|
|
23
23
|
timeout: 60000
|
|
24
24
|
});
|
|
25
25
|
}, 60000, 'page-navigation');
|
|
26
|
-
console.
|
|
26
|
+
console.log(`✅ Navigation successful to: ${url}`);
|
|
27
27
|
success = true;
|
|
28
28
|
break;
|
|
29
29
|
}
|