@n8n/n8n-nodes-langchain 1.87.1 → 1.88.0

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.
Files changed (37) hide show
  1. package/dist/credentials/MilvusApi.credentials.js +72 -0
  2. package/dist/credentials/MilvusApi.credentials.js.map +1 -0
  3. package/dist/known/credentials.json +7 -0
  4. package/dist/known/nodes.json +12 -0
  5. package/dist/methods/defined.json +3 -0
  6. package/dist/methods/referenced.json +3 -0
  7. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +258 -0
  8. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -0
  9. package/dist/nodes/mcp/McpClientTool/loadOptions.js +51 -0
  10. package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -0
  11. package/dist/nodes/mcp/McpClientTool/types.js +17 -0
  12. package/dist/nodes/mcp/McpClientTool/types.js.map +1 -0
  13. package/dist/nodes/mcp/McpClientTool/utils.js +192 -0
  14. package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -0
  15. package/dist/nodes/mcp/McpTrigger/FlushingSSEServerTransport.js +39 -0
  16. package/dist/nodes/mcp/McpTrigger/FlushingSSEServerTransport.js.map +1 -0
  17. package/dist/nodes/mcp/McpTrigger/McpServer.js +179 -0
  18. package/dist/nodes/mcp/McpTrigger/McpServer.js.map +1 -0
  19. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js +181 -0
  20. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js.map +1 -0
  21. package/dist/nodes/mcp/mcp.dark.svg +7 -0
  22. package/dist/nodes/mcp/mcp.svg +7 -0
  23. package/dist/nodes/vector_store/VectorStoreMilvus/VectorStoreMilvus.node.js +106 -0
  24. package/dist/nodes/vector_store/VectorStoreMilvus/VectorStoreMilvus.node.js.map +1 -0
  25. package/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-black.svg +1 -0
  26. package/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-white.svg +1 -0
  27. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js +16 -0
  28. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +1 -1
  29. package/dist/nodes/vector_store/shared/descriptions.js +24 -0
  30. package/dist/nodes/vector_store/shared/descriptions.js.map +1 -1
  31. package/dist/types/credentials.json +1 -0
  32. package/dist/types/nodes.json +3 -0
  33. package/dist/utils/helpers.js +7 -1
  34. package/dist/utils/helpers.js.map +1 -1
  35. package/dist/utils/logWrapper.js +9 -2
  36. package/dist/utils/logWrapper.js.map +1 -1
  37. package/package.json +10 -4
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var MilvusApi_credentials_exports = {};
20
+ __export(MilvusApi_credentials_exports, {
21
+ MilvusApi: () => MilvusApi
22
+ });
23
+ module.exports = __toCommonJS(MilvusApi_credentials_exports);
24
+ class MilvusApi {
25
+ constructor() {
26
+ this.name = "milvusApi";
27
+ this.displayName = "Milvus";
28
+ this.documentationUrl = "milvus";
29
+ this.properties = [
30
+ {
31
+ displayName: "Base URL",
32
+ name: "baseUrl",
33
+ required: true,
34
+ type: "string",
35
+ default: "http://localhost:19530"
36
+ },
37
+ {
38
+ displayName: "Username",
39
+ name: "username",
40
+ type: "string",
41
+ default: ""
42
+ },
43
+ {
44
+ displayName: "Password",
45
+ name: "password",
46
+ type: "string",
47
+ typeOptions: { password: true },
48
+ default: ""
49
+ }
50
+ ];
51
+ this.authenticate = {
52
+ type: "generic",
53
+ properties: {
54
+ headers: {
55
+ Authorization: "=Bearer {{$credentials.username}}:{{$credentials.password}}"
56
+ }
57
+ }
58
+ };
59
+ this.test = {
60
+ request: {
61
+ baseURL: "={{ $credentials.baseUrl }}",
62
+ url: "/v1/vector/collections",
63
+ method: "GET"
64
+ }
65
+ };
66
+ }
67
+ }
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ MilvusApi
71
+ });
72
+ //# sourceMappingURL=MilvusApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../credentials/MilvusApi.credentials.ts"],"sourcesContent":["import type {\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n\tIAuthenticateGeneric,\n} from 'n8n-workflow';\n\nexport class MilvusApi implements ICredentialType {\n\tname = 'milvusApi';\n\n\tdisplayName = 'Milvus';\n\n\tdocumentationUrl = 'milvus';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Base URL',\n\t\t\tname: 'baseUrl',\n\t\t\trequired: true,\n\t\t\ttype: 'string',\n\t\t\tdefault: 'http://localhost:19530',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Username',\n\t\t\tname: 'username',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Password',\n\t\t\tname: 'password',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\theaders: {\n\t\t\t\tAuthorization: '=Bearer {{$credentials.username}}:{{$credentials.password}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{ $credentials.baseUrl }}',\n\t\t\turl: '/v1/vector/collections',\n\t\t\tmethod: 'GET',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,UAAqC;AAAA,EAA3C;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,UAAU;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,SAAS;AAAA,MACV;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,QACL,QAAQ;AAAA,MACT;AAAA,IACD;AAAA;AACD;","names":[]}
@@ -59,6 +59,13 @@
59
59
  "memoryMotorhead"
60
60
  ]
61
61
  },
62
+ "milvusApi": {
63
+ "className": "MilvusApi",
64
+ "sourcePath": "dist/credentials/MilvusApi.credentials.js",
65
+ "supportedNodes": [
66
+ "vectorStoreMilvus"
67
+ ]
68
+ },
62
69
  "mistralCloudApi": {
63
70
  "className": "MistralCloudApi",
64
71
  "sourcePath": "dist/credentials/MistralCloudApi.credentials.js",
@@ -155,6 +155,14 @@
155
155
  "className": "LmOpenHuggingFaceInference",
156
156
  "sourcePath": "dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js"
157
157
  },
158
+ "mcpClientTool": {
159
+ "className": "McpClientTool",
160
+ "sourcePath": "dist/nodes/mcp/McpClientTool/McpClientTool.node.js"
161
+ },
162
+ "mcpTrigger": {
163
+ "className": "McpTrigger",
164
+ "sourcePath": "dist/nodes/mcp/McpTrigger/McpTrigger.node.js"
165
+ },
158
166
  "memoryBufferWindow": {
159
167
  "className": "MemoryBufferWindow",
160
168
  "sourcePath": "dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js"
@@ -287,6 +295,10 @@
287
295
  "className": "VectorStoreInMemoryLoad",
288
296
  "sourcePath": "dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js"
289
297
  },
298
+ "vectorStoreMilvus": {
299
+ "className": "VectorStoreMilvus",
300
+ "sourcePath": "dist/nodes/vector_store/VectorStoreMilvus/VectorStoreMilvus.node.js"
301
+ },
290
302
  "vectorStoreMongoDBAtlas": {
291
303
  "className": "VectorStoreMongoDBAtlas",
292
304
  "sourcePath": "dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js"
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "openAi": [
3
3
  "getFiles"
4
+ ],
5
+ "mcpClientTool": [
6
+ "getTools"
4
7
  ]
5
8
  }
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "openAi": [
3
3
  "getFiles"
4
+ ],
5
+ "mcpClientTool": [
6
+ "getTools"
4
7
  ]
5
8
  }
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var McpClientTool_node_exports = {};
20
+ __export(McpClientTool_node_exports, {
21
+ McpClientTool: () => McpClientTool
22
+ });
23
+ module.exports = __toCommonJS(McpClientTool_node_exports);
24
+ var import_n8n_workflow = require("n8n-workflow");
25
+ var import_logWrapper = require("../../../utils/logWrapper");
26
+ var import_sharedFields = require("../../../utils/sharedFields");
27
+ var import_loadOptions = require("./loadOptions");
28
+ var import_utils = require("./utils");
29
+ class McpClientTool {
30
+ constructor() {
31
+ this.description = {
32
+ displayName: "MCP Client Tool",
33
+ name: "mcpClientTool",
34
+ icon: {
35
+ light: "file:../mcp.svg",
36
+ dark: "file:../mcp.dark.svg"
37
+ },
38
+ group: ["output"],
39
+ version: 1,
40
+ description: "Connect tools from an MCP Server",
41
+ defaults: {
42
+ name: "MCP Client"
43
+ },
44
+ codex: {
45
+ categories: ["AI"],
46
+ subcategories: {
47
+ AI: ["Model Context Protocol", "Tools"]
48
+ },
49
+ alias: ["Model Context Protocol", "MCP Client"],
50
+ resources: {
51
+ primaryDocumentation: [
52
+ {
53
+ url: "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.mcpclienttool/"
54
+ }
55
+ ]
56
+ }
57
+ },
58
+ inputs: [],
59
+ outputs: [{ type: import_n8n_workflow.NodeConnectionTypes.AiTool, displayName: "Tools" }],
60
+ credentials: [
61
+ {
62
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
63
+ name: "httpBearerAuth",
64
+ required: true,
65
+ displayOptions: {
66
+ show: {
67
+ authentication: ["bearerAuth"]
68
+ }
69
+ }
70
+ },
71
+ {
72
+ name: "httpHeaderAuth",
73
+ required: true,
74
+ displayOptions: {
75
+ show: {
76
+ authentication: ["headerAuth"]
77
+ }
78
+ }
79
+ }
80
+ ],
81
+ properties: [
82
+ (0, import_sharedFields.getConnectionHintNoticeField)([import_n8n_workflow.NodeConnectionTypes.AiAgent]),
83
+ {
84
+ displayName: "SSE Endpoint",
85
+ name: "sseEndpoint",
86
+ type: "string",
87
+ description: "SSE Endpoint of your MCP server",
88
+ placeholder: "e.g. https://my-mcp-server.ai/sse",
89
+ default: "",
90
+ required: true
91
+ },
92
+ {
93
+ displayName: "Authentication",
94
+ name: "authentication",
95
+ type: "options",
96
+ options: [
97
+ {
98
+ name: "Bearer Auth",
99
+ value: "bearerAuth"
100
+ },
101
+ {
102
+ name: "Header Auth",
103
+ value: "headerAuth"
104
+ },
105
+ {
106
+ name: "None",
107
+ value: "none"
108
+ }
109
+ ],
110
+ default: "none",
111
+ description: "The way to authenticate with your SSE endpoint"
112
+ },
113
+ {
114
+ displayName: "Credentials",
115
+ name: "credentials",
116
+ type: "credentials",
117
+ default: "",
118
+ displayOptions: {
119
+ show: {
120
+ authentication: ["headerAuth", "bearerAuth"]
121
+ }
122
+ }
123
+ },
124
+ {
125
+ displayName: "Tools to Include",
126
+ name: "include",
127
+ type: "options",
128
+ description: "How to select the tools you want to be exposed to the AI Agent",
129
+ default: "all",
130
+ options: [
131
+ {
132
+ name: "All",
133
+ value: "all",
134
+ description: "Also include all unchanged fields from the input"
135
+ },
136
+ {
137
+ name: "Selected",
138
+ value: "selected",
139
+ description: 'Also include the tools listed in the parameter "Tools to Include"'
140
+ },
141
+ {
142
+ name: "All Except",
143
+ value: "except",
144
+ description: 'Exclude the tools listed in the parameter "Tools to Exclude"'
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ displayName: "Tools to Include",
150
+ name: "includeTools",
151
+ type: "multiOptions",
152
+ default: [],
153
+ description: 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
154
+ typeOptions: {
155
+ loadOptionsMethod: "getTools",
156
+ loadOptionsDependsOn: ["sseEndpoint"]
157
+ },
158
+ displayOptions: {
159
+ show: {
160
+ include: ["selected"]
161
+ }
162
+ }
163
+ },
164
+ {
165
+ displayName: "Tools to Exclude",
166
+ name: "excludeTools",
167
+ type: "multiOptions",
168
+ default: [],
169
+ description: 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
170
+ typeOptions: {
171
+ loadOptionsMethod: "getTools"
172
+ },
173
+ displayOptions: {
174
+ show: {
175
+ include: ["except"]
176
+ }
177
+ }
178
+ }
179
+ ]
180
+ };
181
+ this.methods = {
182
+ loadOptions: {
183
+ getTools: import_loadOptions.getTools
184
+ }
185
+ };
186
+ }
187
+ async supplyData(itemIndex) {
188
+ const authentication = this.getNodeParameter(
189
+ "authentication",
190
+ itemIndex
191
+ );
192
+ const sseEndpoint = this.getNodeParameter("sseEndpoint", itemIndex);
193
+ const node = this.getNode();
194
+ const { headers } = await (0, import_utils.getAuthHeaders)(this, authentication);
195
+ const client = await (0, import_utils.connectMcpClient)({
196
+ sseEndpoint,
197
+ headers,
198
+ name: node.type,
199
+ version: node.typeVersion
200
+ });
201
+ const setError = (message, description) => {
202
+ const error = new import_n8n_workflow.NodeOperationError(node, message, { itemIndex, description });
203
+ this.addOutputData(import_n8n_workflow.NodeConnectionTypes.AiTool, itemIndex, error);
204
+ throw error;
205
+ };
206
+ if (!client.ok) {
207
+ this.logger.error("McpClientTool: Failed to connect to MCP Server", {
208
+ error: client.error
209
+ });
210
+ switch (client.error.type) {
211
+ case "invalid_url":
212
+ return setError("Could not connect to your MCP server. The provided URL is invalid.");
213
+ case "connection":
214
+ default:
215
+ return setError("Could not connect to your MCP server");
216
+ }
217
+ }
218
+ this.logger.debug("McpClientTool: Successfully connected to MCP Server");
219
+ const mode = this.getNodeParameter("include", itemIndex);
220
+ const includeTools = this.getNodeParameter("includeTools", itemIndex, []);
221
+ const excludeTools = this.getNodeParameter("excludeTools", itemIndex, []);
222
+ const allTools = await (0, import_utils.getAllTools)(client.result);
223
+ const mcpTools = (0, import_utils.getSelectedTools)({
224
+ tools: allTools,
225
+ mode,
226
+ includeTools,
227
+ excludeTools
228
+ });
229
+ if (!mcpTools.length) {
230
+ return setError(
231
+ "MCP Server returned no tools",
232
+ "Connected successfully to your MCP server but it returned an empty list of tools."
233
+ );
234
+ }
235
+ const tools = mcpTools.map(
236
+ (tool) => (0, import_logWrapper.logWrapper)(
237
+ (0, import_utils.mcpToolToDynamicTool)(
238
+ tool,
239
+ (0, import_utils.createCallTool)(tool.name, client.result, (error) => {
240
+ this.logger.error(`McpClientTool: Tool "${tool.name}" failed to execute`, { error });
241
+ throw new import_n8n_workflow.NodeOperationError(node, `Failed to execute tool "${tool.name}"`, {
242
+ description: error
243
+ });
244
+ })
245
+ ),
246
+ this
247
+ )
248
+ );
249
+ this.logger.debug(`McpClientTool: Connected to MCP Server with ${tools.length} tools`);
250
+ const toolkit = new import_utils.McpToolkit(tools);
251
+ return { response: toolkit, closeFunction: async () => await client.result.close() };
252
+ }
253
+ }
254
+ // Annotate the CommonJS export names for ESM import in node:
255
+ 0 && (module.exports = {
256
+ McpClientTool
257
+ });
258
+ //# sourceMappingURL=McpClientTool.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/mcp/McpClientTool/McpClientTool.node.ts"],"sourcesContent":["import {\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { getTools } from './loadOptions';\nimport type { McpAuthenticationOption, McpToolIncludeMode } from './types';\nimport {\n\tconnectMcpClient,\n\tcreateCallTool,\n\tgetAllTools,\n\tgetAuthHeaders,\n\tgetSelectedTools,\n\tMcpToolkit,\n\tmcpToolToDynamicTool,\n} from './utils';\n\nexport class McpClientTool implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'MCP Client Tool',\n\t\tname: 'mcpClientTool',\n\t\ticon: {\n\t\t\tlight: 'file:../mcp.svg',\n\t\t\tdark: 'file:../mcp.dark.svg',\n\t\t},\n\t\tgroup: ['output'],\n\t\tversion: 1,\n\t\tdescription: 'Connect tools from an MCP Server',\n\t\tdefaults: {\n\t\t\tname: 'MCP Client',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Model Context Protocol', 'Tools'],\n\t\t\t},\n\t\t\talias: ['Model Context Protocol', 'MCP Client'],\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.mcpclienttool/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [{ type: NodeConnectionTypes.AiTool, displayName: 'Tools' }],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed\n\t\t\t\tname: 'httpBearerAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['bearerAuth'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'httpHeaderAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['headerAuth'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'SSE Endpoint',\n\t\t\t\tname: 'sseEndpoint',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'SSE Endpoint of your MCP server',\n\t\t\t\tplaceholder: 'e.g. https://my-mcp-server.ai/sse',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Authentication',\n\t\t\t\tname: 'authentication',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Bearer Auth',\n\t\t\t\t\t\tvalue: 'bearerAuth',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Header Auth',\n\t\t\t\t\t\tvalue: 'headerAuth',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'None',\n\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'none',\n\t\t\t\tdescription: 'The way to authenticate with your SSE endpoint',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Credentials',\n\t\t\t\tname: 'credentials',\n\t\t\t\ttype: 'credentials',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['headerAuth', 'bearerAuth'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Tools to Include',\n\t\t\t\tname: 'include',\n\t\t\t\ttype: 'options',\n\t\t\t\tdescription: 'How to select the tools you want to be exposed to the AI Agent',\n\t\t\t\tdefault: 'all',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'All',\n\t\t\t\t\t\tvalue: 'all',\n\t\t\t\t\t\tdescription: 'Also include all unchanged fields from the input',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Selected',\n\t\t\t\t\t\tvalue: 'selected',\n\t\t\t\t\t\tdescription: 'Also include the tools listed in the parameter \"Tools to Include\"',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'All Except',\n\t\t\t\t\t\tvalue: 'except',\n\t\t\t\t\t\tdescription: 'Exclude the tools listed in the parameter \"Tools to Exclude\"',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Tools to Include',\n\t\t\t\tname: 'includeTools',\n\t\t\t\ttype: 'multiOptions',\n\t\t\t\tdefault: [],\n\t\t\t\tdescription:\n\t\t\t\t\t'Choose from the list, or specify IDs using an <a href=\"https://docs.n8n.io/code/expressions/\">expression</a>',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsMethod: 'getTools',\n\t\t\t\t\tloadOptionsDependsOn: ['sseEndpoint'],\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tinclude: ['selected'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Tools to Exclude',\n\t\t\t\tname: 'excludeTools',\n\t\t\t\ttype: 'multiOptions',\n\t\t\t\tdefault: [],\n\t\t\t\tdescription:\n\t\t\t\t\t'Choose from the list, or specify IDs using an <a href=\"https://docs.n8n.io/code/expressions/\">expression</a>',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsMethod: 'getTools',\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tinclude: ['except'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n\n\tmethods = {\n\t\tloadOptions: {\n\t\t\tgetTools,\n\t\t},\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst authentication = this.getNodeParameter(\n\t\t\t'authentication',\n\t\t\titemIndex,\n\t\t) as McpAuthenticationOption;\n\t\tconst sseEndpoint = this.getNodeParameter('sseEndpoint', itemIndex) as string;\n\t\tconst node = this.getNode();\n\t\tconst { headers } = await getAuthHeaders(this, authentication);\n\t\tconst client = await connectMcpClient({\n\t\t\tsseEndpoint,\n\t\t\theaders,\n\t\t\tname: node.type,\n\t\t\tversion: node.typeVersion,\n\t\t});\n\n\t\tconst setError = (message: string, description?: string): SupplyData => {\n\t\t\tconst error = new NodeOperationError(node, message, { itemIndex, description });\n\t\t\tthis.addOutputData(NodeConnectionTypes.AiTool, itemIndex, error);\n\t\t\tthrow error;\n\t\t};\n\n\t\tif (!client.ok) {\n\t\t\tthis.logger.error('McpClientTool: Failed to connect to MCP Server', {\n\t\t\t\terror: client.error,\n\t\t\t});\n\n\t\t\tswitch (client.error.type) {\n\t\t\t\tcase 'invalid_url':\n\t\t\t\t\treturn setError('Could not connect to your MCP server. The provided URL is invalid.');\n\t\t\t\tcase 'connection':\n\t\t\t\tdefault:\n\t\t\t\t\treturn setError('Could not connect to your MCP server');\n\t\t\t}\n\t\t}\n\n\t\tthis.logger.debug('McpClientTool: Successfully connected to MCP Server');\n\n\t\tconst mode = this.getNodeParameter('include', itemIndex) as McpToolIncludeMode;\n\t\tconst includeTools = this.getNodeParameter('includeTools', itemIndex, []) as string[];\n\t\tconst excludeTools = this.getNodeParameter('excludeTools', itemIndex, []) as string[];\n\n\t\tconst allTools = await getAllTools(client.result);\n\t\tconst mcpTools = getSelectedTools({\n\t\t\ttools: allTools,\n\t\t\tmode,\n\t\t\tincludeTools,\n\t\t\texcludeTools,\n\t\t});\n\n\t\tif (!mcpTools.length) {\n\t\t\treturn setError(\n\t\t\t\t'MCP Server returned no tools',\n\t\t\t\t'Connected successfully to your MCP server but it returned an empty list of tools.',\n\t\t\t);\n\t\t}\n\n\t\tconst tools = mcpTools.map((tool) =>\n\t\t\tlogWrapper(\n\t\t\t\tmcpToolToDynamicTool(\n\t\t\t\t\ttool,\n\t\t\t\t\tcreateCallTool(tool.name, client.result, (error) => {\n\t\t\t\t\t\tthis.logger.error(`McpClientTool: Tool \"${tool.name}\" failed to execute`, { error });\n\t\t\t\t\t\tthrow new NodeOperationError(node, `Failed to execute tool \"${tool.name}\"`, {\n\t\t\t\t\t\t\tdescription: error,\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\tthis,\n\t\t\t),\n\t\t);\n\n\t\tthis.logger.debug(`McpClientTool: Connected to MCP Server with ${tools.length} tools`);\n\n\t\tconst toolkit = new McpToolkit(tools);\n\n\t\treturn { response: toolkit, closeFunction: async () => await client.result.close() };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAOO;AAEP,wBAA2B;AAC3B,0BAA6C;AAE7C,yBAAyB;AAEzB,mBAQO;AAEA,MAAM,cAAmC;AAAA,EAAzC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACP;AAAA,MACA,OAAO,CAAC,QAAQ;AAAA,MAChB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,0BAA0B,OAAO;AAAA,QACvC;AAAA,QACA,OAAO,CAAC,0BAA0B,YAAY;AAAA,QAC9C,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC,EAAE,MAAM,wCAAoB,QAAQ,aAAa,QAAQ,CAAC;AAAA,MACpE,aAAa;AAAA,QACZ;AAAA;AAAA,UAEC,MAAM;AAAA,UACN,UAAU;AAAA,UACV,gBAAgB;AAAA,YACf,MAAM;AAAA,cACL,gBAAgB,CA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Descriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var loadOptions_exports = {};
20
+ __export(loadOptions_exports, {
21
+ getTools: () => getTools
22
+ });
23
+ module.exports = __toCommonJS(loadOptions_exports);
24
+ var import_n8n_workflow = require("n8n-workflow");
25
+ var import_utils = require("./utils");
26
+ async function getTools() {
27
+ const authentication = this.getNodeParameter("authentication");
28
+ const sseEndpoint = this.getNodeParameter("sseEndpoint");
29
+ const node = this.getNode();
30
+ const { headers } = await (0, import_utils.getAuthHeaders)(this, authentication);
31
+ const client = await (0, import_utils.connectMcpClient)({
32
+ sseEndpoint,
33
+ headers,
34
+ name: node.type,
35
+ version: node.typeVersion
36
+ });
37
+ if (!client.ok) {
38
+ throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Could not connect to your MCP server");
39
+ }
40
+ const tools = await (0, import_utils.getAllTools)(client.result);
41
+ return tools.map((tool) => ({
42
+ name: tool.name,
43
+ value: tool.name,
44
+ description: tool.description
45
+ }));
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ getTools
50
+ });
51
+ //# sourceMappingURL=loadOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/mcp/McpClientTool/loadOptions.ts"],"sourcesContent":["import {\n\ttype ILoadOptionsFunctions,\n\ttype INodePropertyOptions,\n\tNodeOperationError,\n} from 'n8n-workflow';\n\nimport type { McpAuthenticationOption } from './types';\nimport { connectMcpClient, getAllTools, getAuthHeaders } from './utils';\n\nexport async function getTools(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {\n\tconst authentication = this.getNodeParameter('authentication') as McpAuthenticationOption;\n\tconst sseEndpoint = this.getNodeParameter('sseEndpoint') as string;\n\tconst node = this.getNode();\n\tconst { headers } = await getAuthHeaders(this, authentication);\n\tconst client = await connectMcpClient({\n\t\tsseEndpoint,\n\t\theaders,\n\t\tname: node.type,\n\t\tversion: node.typeVersion,\n\t});\n\n\tif (!client.ok) {\n\t\tthrow new NodeOperationError(this.getNode(), 'Could not connect to your MCP server');\n\t}\n\n\tconst tools = await getAllTools(client.result);\n\treturn tools.map((tool) => ({\n\t\tname: tool.name,\n\t\tvalue: tool.name,\n\t\tdescription: tool.description,\n\t}));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAIO;AAGP,mBAA8D;AAE9D,eAAsB,WAAuE;AAC5F,QAAM,iBAAiB,KAAK,iBAAiB,gBAAgB;AAC7D,QAAM,cAAc,KAAK,iBAAiB,aAAa;AACvD,QAAM,OAAO,KAAK,QAAQ;AAC1B,QAAM,EAAE,QAAQ,IAAI,UAAM,6BAAe,MAAM,cAAc;AAC7D,QAAM,SAAS,UAAM,+BAAiB;AAAA,IACrC;AAAA,IACA;AAAA,IACA,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,EACf,CAAC;AAED,MAAI,CAAC,OAAO,IAAI;AACf,UAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,sCAAsC;AAAA,EACpF;AAEA,QAAM,QAAQ,UAAM,0BAAY,OAAO,MAAM;AAC7C,SAAO,MAAM,IAAI,CAAC,UAAU;AAAA,IAC3B,MAAM,KAAK;AAAA,IACX,OAAO,KAAK;AAAA,IACZ,aAAa,KAAK;AAAA,EACnB,EAAE;AACH;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/mcp/McpClientTool/types.ts"],"sourcesContent":["import type { JSONSchema7 } from 'json-schema';\n\nexport type McpTool = { name: string; description?: string; inputSchema: JSONSchema7 };\n\nexport type McpToolIncludeMode = 'all' | 'selected' | 'except';\n\nexport type McpAuthenticationOption = 'none' | 'headerAuth' | 'bearerAuth';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}