n8n-nodes-clientify 0.2.4 → 0.2.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.
- package/README.md +31 -338
- package/dist/README.md +31 -338
- package/dist/appmixer/clientify/crm/AddCompanyAddress/AddCompanyAddress.js +33 -0
- package/dist/appmixer/clientify/crm/AddCompanyAddress/component.json +115 -0
- package/dist/appmixer/clientify/crm/AddCompanyCall/AddCompanyCall.js +32 -0
- package/dist/appmixer/clientify/crm/AddCompanyCall/component.json +109 -0
- package/dist/appmixer/clientify/crm/AddCompanyCheckin/AddCompanyCheckin.js +31 -0
- package/dist/appmixer/clientify/crm/AddCompanyCheckin/component.json +98 -0
- package/dist/appmixer/clientify/crm/AddCompanyEmail/AddCompanyEmail.js +25 -0
- package/dist/appmixer/clientify/crm/AddCompanyEmail/component.json +84 -0
- package/dist/appmixer/clientify/crm/AddCompanyEmployee/AddCompanyEmployee.js +22 -0
- package/dist/appmixer/clientify/crm/AddCompanyEmployee/component.json +65 -0
- package/dist/appmixer/clientify/crm/AddCompanyNote/AddCompanyNote.js +25 -0
- package/dist/appmixer/clientify/crm/AddCompanyNote/component.json +75 -0
- package/dist/appmixer/clientify/crm/AddCompanyPhone/AddCompanyPhone.js +25 -0
- package/dist/appmixer/clientify/crm/AddCompanyPhone/component.json +87 -0
- package/dist/appmixer/clientify/crm/AddCompanyTag/AddCompanyTag.js +23 -0
- package/dist/appmixer/clientify/crm/AddCompanyTag/component.json +71 -0
- package/dist/appmixer/clientify/crm/AddCompanyWebsite/AddCompanyWebsite.js +23 -0
- package/dist/appmixer/clientify/crm/AddCompanyWebsite/component.json +65 -0
- package/dist/appmixer/clientify/crm/AddContactAddress/AddContactAddress.js +33 -0
- package/dist/appmixer/clientify/crm/AddContactAddress/component.json +115 -0
- package/dist/appmixer/clientify/crm/AddContactCall/AddContactCall.js +20 -0
- package/dist/appmixer/clientify/crm/AddContactCall/component.json +55 -0
- package/dist/appmixer/clientify/crm/AddContactCheckin/AddContactCheckin.js +33 -0
- package/dist/appmixer/clientify/crm/AddContactCheckin/component.json +109 -0
- package/dist/appmixer/clientify/crm/AddContactEmail/AddContactEmail.js +25 -0
- package/dist/appmixer/clientify/crm/AddContactEmail/component.json +85 -0
- package/dist/appmixer/clientify/crm/AddContactNote/AddContactNote.js +25 -0
- package/dist/appmixer/clientify/crm/AddContactNote/component.json +75 -0
- package/dist/appmixer/clientify/crm/AddContactOtherCompany/AddContactOtherCompany.js +23 -0
- package/dist/appmixer/clientify/crm/AddContactOtherCompany/component.json +65 -0
- package/dist/appmixer/clientify/crm/AddContactPhone/AddContactPhone.js +25 -0
- package/dist/appmixer/clientify/crm/AddContactPhone/component.json +88 -0
- package/dist/appmixer/clientify/crm/AddContactTag/AddContactTag.js +23 -0
- package/dist/appmixer/clientify/crm/AddContactTag/component.json +71 -0
- package/dist/appmixer/clientify/crm/AssignContactOwner/AssignContactOwner.js +23 -0
- package/dist/appmixer/clientify/crm/AssignContactOwner/component.json +93 -0
- package/dist/appmixer/clientify/crm/BatchCreateContacts/BatchCreateContacts.js +23 -0
- package/dist/appmixer/clientify/crm/BatchCreateContacts/component.json +90 -0
- package/dist/appmixer/clientify/crm/CompleteTask/CompleteTask.js +24 -0
- package/dist/appmixer/clientify/crm/CompleteTask/component.json +69 -0
- package/dist/appmixer/clientify/crm/CreateCompany/CreateCompany.js +19 -0
- package/dist/appmixer/clientify/crm/CreateCompany/component.json +58 -0
- package/dist/appmixer/clientify/crm/CreateContact/CreateContact.js +19 -0
- package/dist/appmixer/clientify/crm/CreateContact/component.json +88 -0
- package/dist/appmixer/clientify/crm/CreateTask/CreateTask.js +19 -0
- package/dist/appmixer/clientify/crm/CreateTask/component.json +167 -0
- package/dist/appmixer/clientify/crm/DeleteCompany/DeleteCompany.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteCompany/component.json +51 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyAddress/DeleteCompanyAddress.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyAddress/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyEmail/DeleteCompanyEmail.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyEmail/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyPhone/DeleteCompanyPhone.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyPhone/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyWebsite/DeleteCompanyWebsite.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteCompanyWebsite/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteContact/DeleteContact.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteContact/component.json +51 -0
- package/dist/appmixer/clientify/crm/DeleteContactAddress/DeleteContactAddress.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteContactAddress/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteContactEmail/DeleteContactEmail.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteContactEmail/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteContactOtherCompany/DeleteContactOtherCompany.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteContactOtherCompany/component.json +62 -0
- package/dist/appmixer/clientify/crm/DeleteContactPhone/DeleteContactPhone.js +22 -0
- package/dist/appmixer/clientify/crm/DeleteContactPhone/component.json +62 -0
- package/dist/appmixer/clientify/crm/GetCompany/GetCompany.js +24 -0
- package/dist/appmixer/clientify/crm/GetCompany/component.json +69 -0
- package/dist/appmixer/clientify/crm/GetContact/GetContact.js +24 -0
- package/dist/appmixer/clientify/crm/GetContact/component.json +90 -0
- package/dist/appmixer/clientify/crm/GetCurrentUser/GetCurrentUser.js +17 -0
- package/dist/appmixer/clientify/crm/GetCurrentUser/component.json +49 -0
- package/dist/appmixer/clientify/crm/GetTask/GetTask.js +24 -0
- package/dist/appmixer/clientify/crm/GetTask/component.json +78 -0
- package/dist/appmixer/clientify/crm/ListAllCompanyTags/ListAllCompanyTags.js +16 -0
- package/dist/appmixer/clientify/crm/ListAllCompanyTags/component.json +67 -0
- package/dist/appmixer/clientify/crm/ListAllContactTags/ListAllContactTags.js +16 -0
- package/dist/appmixer/clientify/crm/ListAllContactTags/component.json +67 -0
- package/dist/appmixer/clientify/crm/ListCompanies/ListCompanies.js +26 -0
- package/dist/appmixer/clientify/crm/ListCompanies/component.json +117 -0
- package/dist/appmixer/clientify/crm/ListCompanyAddresses/ListCompanyAddresses.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyAddresses/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListCompanyCustomfields/ListCompanyCustomfields.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyCustomfields/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListCompanyEmails/ListCompanyEmails.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyEmails/component.json +88 -0
- package/dist/appmixer/clientify/crm/ListCompanyEmployees/ListCompanyEmployees.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyEmployees/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListCompanyPhones/ListCompanyPhones.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyPhones/component.json +91 -0
- package/dist/appmixer/clientify/crm/ListCompanySectors/ListCompanySectors.js +16 -0
- package/dist/appmixer/clientify/crm/ListCompanySectors/component.json +64 -0
- package/dist/appmixer/clientify/crm/ListCompanyTags/ListCompanyTags.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyTags/component.json +85 -0
- package/dist/appmixer/clientify/crm/ListCompanyTasks/ListCompanyTasks.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyTasks/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListCompanyWallentries/ListCompanyWallentries.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyWallentries/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListCompanyWebsites/ListCompanyWebsites.js +20 -0
- package/dist/appmixer/clientify/crm/ListCompanyWebsites/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListContactAddresses/ListContactAddresses.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactAddresses/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListContactCustomfields/ListContactCustomfields.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactCustomfields/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListContactEmails/ListContactEmails.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactEmails/component.json +88 -0
- package/dist/appmixer/clientify/crm/ListContactOtherCompanies/ListContactOtherCompanies.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactOtherCompanies/component.json +85 -0
- package/dist/appmixer/clientify/crm/ListContactPhones/ListContactPhones.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactPhones/component.json +91 -0
- package/dist/appmixer/clientify/crm/ListContactTags/ListContactTags.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactTags/component.json +85 -0
- package/dist/appmixer/clientify/crm/ListContactTasks/ListContactTasks.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactTasks/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListContactWallentries/ListContactWallentries.js +20 -0
- package/dist/appmixer/clientify/crm/ListContactWallentries/component.json +79 -0
- package/dist/appmixer/clientify/crm/ListContacts/ListContacts.js +26 -0
- package/dist/appmixer/clientify/crm/ListContacts/component.json +138 -0
- package/dist/appmixer/clientify/crm/ListCustomFieldValues/ListCustomFieldValues.js +19 -0
- package/dist/appmixer/clientify/crm/ListCustomFieldValues/component.json +77 -0
- package/dist/appmixer/clientify/crm/ListCustomFields/ListCustomFields.js +19 -0
- package/dist/appmixer/clientify/crm/ListCustomFields/component.json +77 -0
- package/dist/appmixer/clientify/crm/ListTaskStages/ListTaskStages.js +19 -0
- package/dist/appmixer/clientify/crm/ListTaskStages/component.json +87 -0
- package/dist/appmixer/clientify/crm/ListTaskTypes/ListTaskTypes.js +19 -0
- package/dist/appmixer/clientify/crm/ListTaskTypes/component.json +87 -0
- package/dist/appmixer/clientify/crm/ListTasks/ListTasks.js +25 -0
- package/dist/appmixer/clientify/crm/ListTasks/component.json +102 -0
- package/dist/appmixer/clientify/crm/ListUsers/ListUsers.js +24 -0
- package/dist/appmixer/clientify/crm/ListUsers/component.json +93 -0
- package/dist/appmixer/clientify/crm/RemoveCompanyEmployee/RemoveCompanyEmployee.js +22 -0
- package/dist/appmixer/clientify/crm/RemoveCompanyEmployee/component.json +62 -0
- package/dist/appmixer/clientify/crm/RemoveCompanyTag/RemoveCompanyTag.js +22 -0
- package/dist/appmixer/clientify/crm/RemoveCompanyTag/component.json +62 -0
- package/dist/appmixer/clientify/crm/RemoveContactTag/RemoveContactTag.js +22 -0
- package/dist/appmixer/clientify/crm/RemoveContactTag/component.json +62 -0
- package/dist/appmixer/clientify/crm/SearchCompanies/SearchCompanies.js +29 -0
- package/dist/appmixer/clientify/crm/SearchCompanies/component.json +111 -0
- package/dist/appmixer/clientify/crm/UpdateCompany/UpdateCompany.js +24 -0
- package/dist/appmixer/clientify/crm/UpdateCompany/component.json +60 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyAddress/UpdateCompanyAddress.js +35 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyAddress/component.json +131 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyEmail/UpdateCompanyEmail.js +27 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyEmail/component.json +91 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyPhone/UpdateCompanyPhone.js +27 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyPhone/component.json +91 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyWebsite/UpdateCompanyWebsite.js +25 -0
- package/dist/appmixer/clientify/crm/UpdateCompanyWebsite/component.json +81 -0
- package/dist/appmixer/clientify/crm/UpdateContact/UpdateContact.js +24 -0
- package/dist/appmixer/clientify/crm/UpdateContact/component.json +81 -0
- package/dist/appmixer/clientify/crm/UpdateContactAddress/UpdateContactAddress.js +35 -0
- package/dist/appmixer/clientify/crm/UpdateContactAddress/component.json +152 -0
- package/dist/appmixer/clientify/crm/UpdateContactEmail/UpdateContactEmail.js +27 -0
- package/dist/appmixer/clientify/crm/UpdateContactEmail/component.json +112 -0
- package/dist/appmixer/clientify/crm/UpdateContactMarketingStatus/UpdateContactMarketingStatus.js +25 -0
- package/dist/appmixer/clientify/crm/UpdateContactMarketingStatus/component.json +92 -0
- package/dist/appmixer/clientify/crm/UpdateContactOtherCompany/UpdateContactOtherCompany.js +25 -0
- package/dist/appmixer/clientify/crm/UpdateContactOtherCompany/component.json +102 -0
- package/dist/appmixer/clientify/crm/UpdateContactPhone/UpdateContactPhone.js +27 -0
- package/dist/appmixer/clientify/crm/UpdateContactPhone/component.json +112 -0
- package/dist/appmixer/clientify/crm/UpdateTask/UpdateTask.js +24 -0
- package/dist/appmixer/clientify/crm/UpdateTask/component.json +69 -0
- package/dist/appmixer/clientify/crm/clientify.js +49 -0
- package/dist/appmixer/clientify/crm/fields.js +24 -0
- package/dist/appmixer/clientify/crm/module.json +7 -0
- package/dist/credentials/{ClientifyMcpApi.credentials.d.ts → ClientifyApi.credentials.d.ts} +1 -1
- package/dist/credentials/ClientifyApi.credentials.js +33 -0
- package/dist/nodes/{ClientifyMcp/ClientifyMcpDynamic.node.d.ts → ClientifyApi/ClientifyApi.node.d.ts} +1 -1
- package/dist/nodes/ClientifyApi/ClientifyApi.node.js +139 -0
- package/dist/nodes/ClientifyApi/ClientifyApiCatalog.d.ts +23 -0
- package/dist/nodes/ClientifyApi/ClientifyApiCatalog.js +217 -0
- package/dist/nodes/{ClientifyMcp/ClientifyMcpTrigger.node.d.ts → ClientifyTrigger/ClientifyTrigger.node.d.ts} +1 -1
- package/dist/nodes/{ClientifyMcp/ClientifyMcpTrigger.node.js → ClientifyTrigger/ClientifyTrigger.node.js} +6 -12
- package/dist/nodes/ClientifyTrigger/clientify.png +0 -0
- package/dist/nodes/ClientifyTrigger/clientify.svg +5 -0
- package/dist/package.json +13 -6
- package/package.json +13 -6
- package/dist/credentials/ClientifyMcpApi.credentials.js +0 -25
- package/dist/nodes/ClientifyMcp/ClientifyMcpDynamic.node.js +0 -211
- package/dist/nodes/ClientifyMcp/ClientifyMcpFields.d.ts +0 -15
- package/dist/nodes/ClientifyMcp/ClientifyMcpFields.js +0 -894
- /package/dist/nodes/{ClientifyMcp → ClientifyApi}/clientify.png +0 -0
- /package/dist/nodes/{ClientifyMcp → ClientifyApi}/clientify.svg +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientifyMcpDynamic = void 0;
|
|
4
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
const ClientifyMcpFields_1 = require("./ClientifyMcpFields");
|
|
6
|
-
class ClientifyMcpDynamic {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.description = {
|
|
9
|
-
displayName: 'Clientify',
|
|
10
|
-
name: 'clientifyMcpDynamic',
|
|
11
|
-
icon: 'file:clientify.svg',
|
|
12
|
-
group: ['transform'],
|
|
13
|
-
version: 1,
|
|
14
|
-
subtitle: '={{$parameter["tool"]}}',
|
|
15
|
-
description: 'Connect to Clientify CRM via MCP',
|
|
16
|
-
defaults: {
|
|
17
|
-
name: 'Clientify',
|
|
18
|
-
},
|
|
19
|
-
inputs: ["main" /* NodeConnectionType.Main */],
|
|
20
|
-
outputs: ["main" /* NodeConnectionType.Main */],
|
|
21
|
-
credentials: [
|
|
22
|
-
{
|
|
23
|
-
name: 'clientifyMcpApi',
|
|
24
|
-
required: true,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
properties: (() => {
|
|
28
|
-
const props = [
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Tool',
|
|
31
|
-
name: 'tool',
|
|
32
|
-
type: 'options',
|
|
33
|
-
options: ClientifyMcpFields_1.toolOptions,
|
|
34
|
-
default: 'listContacts',
|
|
35
|
-
required: true,
|
|
36
|
-
description: 'Select the MCP tool to execute',
|
|
37
|
-
},
|
|
38
|
-
...ClientifyMcpFields_1.toolFields,
|
|
39
|
-
];
|
|
40
|
-
// Add additional fields for each tool
|
|
41
|
-
for (const toolOption of ClientifyMcpFields_1.toolOptions) {
|
|
42
|
-
const additionalField = (0, ClientifyMcpFields_1.getAdditionalFieldsForTool)(toolOption.value);
|
|
43
|
-
if (additionalField) {
|
|
44
|
-
props.push(additionalField);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return props;
|
|
48
|
-
})(),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
async execute() {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f;
|
|
53
|
-
const items = this.getInputData();
|
|
54
|
-
const returnData = [];
|
|
55
|
-
// Get credentials
|
|
56
|
-
const credentials = await this.getCredentials('clientifyMcpApi');
|
|
57
|
-
const authToken = credentials.authToken;
|
|
58
|
-
// MCP Server URL is fixed
|
|
59
|
-
const mcpUrl = 'https://mcp.clientify.com/mcp';
|
|
60
|
-
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
61
|
-
try {
|
|
62
|
-
const toolName = this.getNodeParameter('tool', itemIndex);
|
|
63
|
-
// Build tool arguments from individual fields
|
|
64
|
-
const toolArguments = {};
|
|
65
|
-
// Process regular fields
|
|
66
|
-
for (const field of ClientifyMcpFields_1.toolFields) {
|
|
67
|
-
const fieldName = field.name;
|
|
68
|
-
// Check if this field should be shown for the current tool
|
|
69
|
-
if ((_c = (_b = (_a = field.displayOptions) === null || _a === void 0 ? void 0 : _a.show) === null || _b === void 0 ? void 0 : _b.tool) === null || _c === void 0 ? void 0 : _c.includes(toolName)) {
|
|
70
|
-
try {
|
|
71
|
-
const value = this.getNodeParameter(fieldName, itemIndex);
|
|
72
|
-
if (value !== undefined && value !== '' && value !== null) {
|
|
73
|
-
toolArguments[fieldName] = value;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
// Field might not exist for this tool
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// Process additional fields
|
|
82
|
-
const additionalFieldsParam = `additionalFields`;
|
|
83
|
-
try {
|
|
84
|
-
const additionalFields = this.getNodeParameter(additionalFieldsParam, itemIndex);
|
|
85
|
-
if (additionalFields && typeof additionalFields === 'object') {
|
|
86
|
-
Object.assign(toolArguments, additionalFields);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
// Additional fields might not exist for this tool
|
|
91
|
-
}
|
|
92
|
-
// Step 1: Initialize session
|
|
93
|
-
const initRequest = {
|
|
94
|
-
jsonrpc: '2.0',
|
|
95
|
-
id: 1,
|
|
96
|
-
method: 'initialize',
|
|
97
|
-
params: {
|
|
98
|
-
protocolVersion: '2024-11-05',
|
|
99
|
-
capabilities: {}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const initOptions = {
|
|
103
|
-
method: 'POST',
|
|
104
|
-
url: mcpUrl,
|
|
105
|
-
headers: {
|
|
106
|
-
'Content-Type': 'application/json',
|
|
107
|
-
'x-end-user-token': authToken,
|
|
108
|
-
},
|
|
109
|
-
body: initRequest,
|
|
110
|
-
json: true,
|
|
111
|
-
returnFullResponse: true,
|
|
112
|
-
};
|
|
113
|
-
const initResponse = await this.helpers.httpRequest(initOptions);
|
|
114
|
-
// Extract session ID from headers
|
|
115
|
-
const sessionId = initResponse.headers['mcp-session-id'] || initResponse.headers['Mcp-Session-Id'];
|
|
116
|
-
if (!sessionId) {
|
|
117
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Failed to get session ID from MCP server');
|
|
118
|
-
}
|
|
119
|
-
// Step 2: Execute the selected tool
|
|
120
|
-
const requestBody = {
|
|
121
|
-
jsonrpc: '2.0',
|
|
122
|
-
id: 2,
|
|
123
|
-
method: 'tools/call',
|
|
124
|
-
params: {
|
|
125
|
-
name: toolName,
|
|
126
|
-
arguments: toolArguments,
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
// Make request with session ID
|
|
130
|
-
const options = {
|
|
131
|
-
method: 'POST',
|
|
132
|
-
url: mcpUrl,
|
|
133
|
-
headers: {
|
|
134
|
-
'Content-Type': 'application/json',
|
|
135
|
-
'x-end-user-token': authToken,
|
|
136
|
-
'Mcp-Session-Id': sessionId,
|
|
137
|
-
},
|
|
138
|
-
body: requestBody,
|
|
139
|
-
json: true,
|
|
140
|
-
};
|
|
141
|
-
const response = await this.helpers.httpRequest(options);
|
|
142
|
-
// Process response
|
|
143
|
-
if (response.error) {
|
|
144
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `MCP Error: ${response.error.message || JSON.stringify(response.error)}`);
|
|
145
|
-
}
|
|
146
|
-
// Parse MCP response to make it user-friendly
|
|
147
|
-
let parsedResult = {};
|
|
148
|
-
try {
|
|
149
|
-
// Check if response has the MCP structure with JSON string
|
|
150
|
-
if ((_f = (_e = (_d = response.result) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.text) {
|
|
151
|
-
// Parse the JSON string from MCP response
|
|
152
|
-
const mcpData = JSON.parse(response.result.content[0].text);
|
|
153
|
-
// Return the parsed data directly - clean and accessible
|
|
154
|
-
parsedResult = mcpData;
|
|
155
|
-
// Add helpful boolean flags for common checks (generic, works for any response)
|
|
156
|
-
if (typeof mcpData === 'object' && mcpData !== null) {
|
|
157
|
-
// If there's a count field, add a boolean for it
|
|
158
|
-
if ('count' in mcpData) {
|
|
159
|
-
parsedResult._hasResults = mcpData.count > 0;
|
|
160
|
-
}
|
|
161
|
-
// If there's a results array, add a boolean for it
|
|
162
|
-
if (Array.isArray(mcpData.results)) {
|
|
163
|
-
parsedResult._hasResults = mcpData.results.length > 0;
|
|
164
|
-
parsedResult._resultCount = mcpData.results.length;
|
|
165
|
-
}
|
|
166
|
-
// If there's a success field, expose it clearly
|
|
167
|
-
if ('success' in mcpData) {
|
|
168
|
-
parsedResult._success = mcpData.success;
|
|
169
|
-
}
|
|
170
|
-
// If there's an error field, expose it clearly
|
|
171
|
-
if ('error' in mcpData) {
|
|
172
|
-
parsedResult._hasError = true;
|
|
173
|
-
parsedResult._error = mcpData.error;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
// Not an MCP text response - return as is
|
|
179
|
-
parsedResult = response.result || response;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
catch (parseError) {
|
|
183
|
-
// If parsing fails, return original result
|
|
184
|
-
parsedResult = response.result || response;
|
|
185
|
-
}
|
|
186
|
-
// Return formatted result with both parsed and raw data
|
|
187
|
-
returnData.push({
|
|
188
|
-
json: Object.assign(Object.assign({ success: true, tool: toolName, sessionId: sessionId }, parsedResult), {
|
|
189
|
-
// Keep raw response for advanced users
|
|
190
|
-
_raw: response.result || response }),
|
|
191
|
-
pairedItem: itemIndex,
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
if (this.continueOnFail()) {
|
|
196
|
-
returnData.push({
|
|
197
|
-
json: {
|
|
198
|
-
success: false,
|
|
199
|
-
error: error instanceof Error ? error.message : String(error),
|
|
200
|
-
},
|
|
201
|
-
pairedItem: itemIndex,
|
|
202
|
-
});
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
throw error;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return [returnData];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.ClientifyMcpDynamic = ClientifyMcpDynamic;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export declare const toolOptions: ({
|
|
3
|
-
name: string;
|
|
4
|
-
value: string;
|
|
5
|
-
description: string;
|
|
6
|
-
} | {
|
|
7
|
-
name: string;
|
|
8
|
-
value: string;
|
|
9
|
-
description?: undefined;
|
|
10
|
-
})[];
|
|
11
|
-
export declare const toolFields: INodeProperties[];
|
|
12
|
-
export declare const additionalFieldsDefinitions: {
|
|
13
|
-
[key: string]: INodeProperties[];
|
|
14
|
-
};
|
|
15
|
-
export declare function getAdditionalFieldsForTool(toolName: string): INodeProperties | null;
|