n8n-nodes-smart-browser-automation 1.6.19 → 1.6.21
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.
|
@@ -113,19 +113,23 @@ class SmartBrowserAutomationTools {
|
|
|
113
113
|
const cdpOverride = this.getNodeParameter('cdpOverride', itemIndex, '');
|
|
114
114
|
const useCDP = credentials.browserMode === 'cdp';
|
|
115
115
|
const cdpUrl = (cdpOverride || credentials.cdpEndpoint || '').trim();
|
|
116
|
+
const mcpEndpoint = (credentials.mcpEndpoint || '').trim();
|
|
117
|
+
if (!mcpEndpoint) {
|
|
118
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'MCP Endpoint is required in credentials', {
|
|
119
|
+
itemIndex,
|
|
120
|
+
description: 'Configure MCP Endpoint in Smart Browser Automation credentials (e.g. http://localhost:3000 or https://host/sse)',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Basic pre-validation so users see a clear error in the UI
|
|
124
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(mcpEndpoint)) {
|
|
125
|
+
throw new n8n_workflow_1.NodeOperationError(node, `MCP Endpoint looks incomplete: "${mcpEndpoint}" (add http:// or https://)`, { itemIndex });
|
|
126
|
+
}
|
|
116
127
|
try {
|
|
117
|
-
await sessionManager.initialize(
|
|
128
|
+
await sessionManager.initialize(mcpEndpoint, useCDP, useCDP ? cdpUrl : undefined);
|
|
118
129
|
}
|
|
119
130
|
catch (error) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
description: JSON.stringify({
|
|
123
|
-
mcpEndpoint: credentials.mcpEndpoint,
|
|
124
|
-
browserMode: credentials.browserMode,
|
|
125
|
-
useCDP,
|
|
126
|
-
cdpEndpoint: useCDP ? cdpUrl : undefined,
|
|
127
|
-
}),
|
|
128
|
-
});
|
|
131
|
+
const e = error;
|
|
132
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Failed to connect to MCP at ${mcpEndpoint} (${useCDP ? 'cdp' : 'launch'}${useCDP ? ` | cdp=${cdpUrl || 'unset'}` : ''}): ${e.message}`, { itemIndex });
|
|
129
133
|
}
|
|
130
134
|
const mcpTools = await sessionManager.listTools();
|
|
131
135
|
if (!mcpTools.length) {
|