n8n-nodes-smart-browser-automation 1.1.4 → 1.1.5

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.
@@ -49,6 +49,10 @@ class BrowserSessionManager {
49
49
  }
50
50
  try {
51
51
  await this.mcpClient.connect(this.transport);
52
+ // Stability delay for SSE connections to ensure pipe is fully open
53
+ if (isUrl) {
54
+ await new Promise(resolve => setTimeout(resolve, 1000));
55
+ }
52
56
  }
53
57
  catch (error) {
54
58
  this.isInitialized = false;
@@ -293,28 +293,29 @@ class SmartBrowserAutomation {
293
293
  console.log(`Initializing AI session with CDP: ${cdpUrl}`);
294
294
  }
295
295
  const tools = await sessionManager.initialize(credentials.mcpEndpoint, true, cdpUrl);
296
+ let connectionStatus = 'Skipped (No CDP URL provided)';
297
+ let connectionResult = null;
296
298
  // New logic: Auto-call browser_connect_cdp tool if a URL is provided
297
299
  if (options.cdpUrl) {
298
300
  if (verbose) {
299
301
  console.log(`Auto-calling 'browser_connect_cdp' with endpoint: ${options.cdpUrl}`);
300
302
  }
301
303
  try {
302
- await sessionManager.callTool('browser_connect_cdp', { endpoint: options.cdpUrl });
304
+ connectionResult = await sessionManager.callTool('browser_connect_cdp', { endpoint: options.cdpUrl });
305
+ connectionStatus = 'Successfully connected';
303
306
  }
304
307
  catch (error) {
308
+ connectionStatus = `Failed to connect: ${error.message}`;
305
309
  console.warn(`Failed to auto-connect browser via tool: ${error.message}`);
306
- // We don't throw here to allow the AI to potentially fix it or show the error
307
310
  }
308
311
  }
309
312
  returnData.push({
310
313
  json: {
311
314
  success: true,
312
- message: `MCP session initialized. Browser connect tool called for ${cdpUrl}.`,
313
- toolsCount: tools.length,
314
- tools: tools.map((t) => ({
315
- name: t.name,
316
- description: t.description
317
- })),
315
+ message: `MCP session initialized at ${credentials.mcpEndpoint}`,
316
+ browserConnection: connectionStatus,
317
+ browserResponse: connectionResult,
318
+ totalToolsAvailable: tools.length,
318
319
  },
319
320
  pairedItem: i,
320
321
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-smart-browser-automation",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "n8n node for AI-driven browser automation using MCP",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",