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

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.
@@ -50,8 +50,12 @@ class BrowserSessionManager {
50
50
  try {
51
51
  await this.mcpClient.connect(this.transport);
52
52
  // Stability delay for SSE connections to ensure pipe is fully open
53
+ // Remote servers often need a moment to register the session before accepting POST calls
53
54
  if (isUrl) {
54
- await new Promise(resolve => setTimeout(resolve, 1000));
55
+ if (process.env.NODE_ENV !== 'production') {
56
+ console.log(`[MCP] SSE Connected to ${mcpEndpoint}. Waiting for session stabilization...`);
57
+ }
58
+ await new Promise(resolve => setTimeout(resolve, 2000));
55
59
  }
56
60
  }
57
61
  catch (error) {
@@ -59,11 +63,11 @@ class BrowserSessionManager {
59
63
  const transportType = isUrl ? 'SSE' : 'Stdio';
60
64
  throw new Error(`Failed to connect to MCP server via ${transportType} at ${mcpEndpoint}. Error: ${error.message}`);
61
65
  }
66
+ this.isInitialized = true;
67
+ this.config = { mcpEndpoint, cdpEndpoint };
62
68
  // Fetch available tools from MCP server
63
69
  const toolsResponse = await this.mcpClient.listTools();
64
- this.tools = toolsResponse.tools || [];
65
- this.config = { mcpEndpoint, cdpEndpoint };
66
- this.isInitialized = true;
70
+ this.tools = toolsResponse.tools;
67
71
  return this.tools;
68
72
  }
69
73
  async callTool(toolName, toolArgs) {
@@ -71,9 +75,8 @@ class BrowserSessionManager {
71
75
  throw new Error('MCP client not initialized. Please configure credentials first.');
72
76
  }
73
77
  try {
74
- if (this.config.mcpEndpoint?.includes('http')) {
75
- console.log(`Calling remote tool: ${toolName} on ${this.config.mcpEndpoint}`);
76
- }
78
+ // Log exact payload to debug truncation issues reported by users
79
+ console.log(`[MCP] Calling tool "${toolName}" with args:`, JSON.stringify(toolArgs || {}));
77
80
  const result = await this.mcpClient.callTool({
78
81
  name: toolName,
79
82
  arguments: toolArgs || {}
@@ -81,7 +84,7 @@ class BrowserSessionManager {
81
84
  return result;
82
85
  }
83
86
  catch (error) {
84
- console.error(`MCP Tool Call Error (${toolName}):`, error);
87
+ console.error(`[MCP] Tool Call Error (${toolName}):`, error);
85
88
  throw new Error(`MCP Tool Error: ${error.message}${error.data ? ' - ' + JSON.stringify(error.data) : ''}`);
86
89
  }
87
90
  }
@@ -287,11 +287,7 @@ class SmartBrowserAutomation {
287
287
  // AI Agent mode: Just initialize or close
288
288
  const operation = this.getNodeParameter('operation', i);
289
289
  if (operation === 'initialize') {
290
- // Pull CDP URL from options if available, fallback to credentials
291
- const cdpUrl = options.cdpUrl || credentials.cdpEndpoint;
292
- if (verbose) {
293
- console.log(`Initializing AI session with CDP: ${cdpUrl}`);
294
- }
290
+ const cdpUrl = credentials.cdpEndpoint;
295
291
  const tools = await sessionManager.initialize(credentials.mcpEndpoint, true, cdpUrl);
296
292
  let connectionStatus = 'Skipped (No CDP URL provided)';
297
293
  let connectionResult = null;
@@ -316,6 +312,7 @@ class SmartBrowserAutomation {
316
312
  browserConnection: connectionStatus,
317
313
  browserResponse: connectionResult,
318
314
  totalToolsAvailable: tools.length,
315
+ availableTools: tools.map(t => t.name),
319
316
  },
320
317
  pairedItem: i,
321
318
  });
@@ -65,6 +65,7 @@ async function createDynamicBrowserTools(credentials) {
65
65
  properties: mcpSchemaToN8nProperties(mcpTool.inputSchema),
66
66
  async execute(toolInput) {
67
67
  try {
68
+ console.log(`[AI Agent] Executing tool: ${toolName}`);
68
69
  const result = await sessionManager.callTool(toolName, toolInput);
69
70
  return result;
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-smart-browser-automation",
3
- "version": "1.1.5",
3
+ "version": "1.1.8",
4
4
  "description": "n8n node for AI-driven browser automation using MCP",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",