brave-real-browser-mcp-server 2.19.5 → 2.19.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/dist/browser-manager.js +36 -3
- package/dist/index.js +6 -5
- package/package.json +2 -3
package/dist/browser-manager.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
import { connect } from 'brave-real-browser';
|
|
2
2
|
import * as net from 'net';
|
|
3
|
-
import * as
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
// ESM compatibility
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
// Load environment variables from .env file (manually, completely silent)
|
|
10
|
+
function loadEnvFile() {
|
|
11
|
+
const envPaths = [
|
|
12
|
+
path.join(process.cwd(), '.env'),
|
|
13
|
+
path.join(__dirname, '..', '.env'),
|
|
14
|
+
path.join(__dirname, '.env')
|
|
15
|
+
];
|
|
16
|
+
for (const envPath of envPaths) {
|
|
17
|
+
try {
|
|
18
|
+
if (fs.existsSync(envPath)) {
|
|
19
|
+
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
20
|
+
envContent.split('\n').forEach(line => {
|
|
21
|
+
const trimmed = line.trim();
|
|
22
|
+
if (trimmed && !trimmed.startsWith('#')) {
|
|
23
|
+
const [key, ...valueParts] = trimmed.split('=');
|
|
24
|
+
const value = valueParts.join('=').replace(/^["']|["']$/g, '');
|
|
25
|
+
if (key && !process.env[key]) {
|
|
26
|
+
process.env[key] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// Silently ignore .env loading errors
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
loadEnvFile();
|
|
6
39
|
// Browser error categorization
|
|
7
40
|
export var BrowserErrorType;
|
|
8
41
|
(function (BrowserErrorType) {
|
package/dist/index.js
CHANGED
|
@@ -247,7 +247,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
247
247
|
}
|
|
248
248
|
catch (error) {
|
|
249
249
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
250
|
-
|
|
250
|
+
debug(`Tool ${name} failed:`, errorMessage);
|
|
251
251
|
return {
|
|
252
252
|
content: [
|
|
253
253
|
{
|
|
@@ -277,6 +277,7 @@ async function main() {
|
|
|
277
277
|
debug('Attempting to connect server to transport...');
|
|
278
278
|
await server.connect(transport);
|
|
279
279
|
debug('Server connected to transport successfully');
|
|
280
|
+
// Startup messages - visible to user via stderr (MCP protocol allows stderr for logs)
|
|
280
281
|
console.error('🚀 Brave Real Browser MCP Server started successfully');
|
|
281
282
|
console.error('📋 Available tools:', TOOLS.map(t => t.name).join(', '));
|
|
282
283
|
console.error('🔧 Workflow validation: Active');
|
|
@@ -300,13 +301,13 @@ async function main() {
|
|
|
300
301
|
debug('Setting up error handlers...');
|
|
301
302
|
process.on('uncaughtException', (error) => {
|
|
302
303
|
debug(`Uncaught exception at ${new Date().toISOString()}`);
|
|
303
|
-
|
|
304
|
+
debug('❌ Uncaught exception:', error);
|
|
304
305
|
debug(`Stack trace:`, error.stack);
|
|
305
306
|
process.exit(1);
|
|
306
307
|
});
|
|
307
308
|
process.on('unhandledRejection', (reason, promise) => {
|
|
308
309
|
debug(`Unhandled rejection at ${new Date().toISOString()}`);
|
|
309
|
-
|
|
310
|
+
debug('❌ Unhandled rejection:', reason);
|
|
310
311
|
debug(`Promise:`, promise);
|
|
311
312
|
process.exit(1);
|
|
312
313
|
});
|
|
@@ -339,7 +340,7 @@ if (isMain) {
|
|
|
339
340
|
debug('Module is main - starting server...');
|
|
340
341
|
main().catch((error) => {
|
|
341
342
|
debug(`Main function failed at ${new Date().toISOString()}`);
|
|
342
|
-
|
|
343
|
+
debug('❌ Failed to start server:', error);
|
|
343
344
|
debug(`Error stack:`, error.stack);
|
|
344
345
|
process.exit(1);
|
|
345
346
|
});
|
|
@@ -349,7 +350,7 @@ else {
|
|
|
349
350
|
debug('FORCE STARTING - This is likely an npx execution');
|
|
350
351
|
main().catch((error) => {
|
|
351
352
|
debug(`Forced main function failed at ${new Date().toISOString()}`);
|
|
352
|
-
|
|
353
|
+
debug('❌ Failed to start server:', error);
|
|
353
354
|
debug(`Error stack:`, error.stack);
|
|
354
355
|
process.exit(1);
|
|
355
356
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-browser-mcp-server",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.7",
|
|
4
4
|
"description": "🦁 MCP server for Brave Real Browser - NPM Workspaces Monorepo with anti-detection features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,8 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@modelcontextprotocol/sdk": "latest",
|
|
41
41
|
"@types/turndown": "latest",
|
|
42
|
-
"brave-real-browser": "^2.1.
|
|
43
|
-
"dotenv": "latest",
|
|
42
|
+
"brave-real-browser": "^2.1.7",
|
|
44
43
|
"turndown": "latest"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|