langflow-mcp-server 2.0.0 → 2.1.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.
@@ -38,7 +38,7 @@ class LangflowClient {
38
38
  }
39
39
  async getFlow(flowId) {
40
40
  try {
41
- const response = await this.client.get(`/flows/${flowId}`);
41
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}`);
42
42
  return response.data;
43
43
  }
44
44
  catch (error) {
@@ -47,7 +47,7 @@ class LangflowClient {
47
47
  }
48
48
  async updateFlow(flowId, updates) {
49
49
  try {
50
- const response = await this.client.patch(`/flows/${flowId}`, updates);
50
+ const response = await this.client.patch(`/flows/${encodeURIComponent(flowId)}`, updates);
51
51
  return response.data;
52
52
  }
53
53
  catch (error) {
@@ -56,7 +56,7 @@ class LangflowClient {
56
56
  }
57
57
  async deleteFlow(flowId) {
58
58
  try {
59
- await this.client.delete(`/flows/${flowId}`);
59
+ await this.client.delete(`/flows/${encodeURIComponent(flowId)}`);
60
60
  }
61
61
  catch (error) {
62
62
  throw this.handleError(error, `Failed to delete flow ${flowId}`);
@@ -81,6 +81,9 @@ class LangflowClient {
81
81
  Object.entries(response.data).forEach(([category, items]) => {
82
82
  if (items && typeof items === 'object') {
83
83
  Object.entries(items).forEach(([name, info]) => {
84
+ if (!info || typeof info !== 'object') {
85
+ return;
86
+ }
84
87
  components.push({
85
88
  name,
86
89
  display_name: info.display_name || name,
@@ -99,7 +102,7 @@ class LangflowClient {
99
102
  }
100
103
  async runFlow(flowIdOrName, inputRequest, stream = false) {
101
104
  try {
102
- const response = await this.client.post(`/run/${flowIdOrName}`, {
105
+ const response = await this.client.post(`/run/${encodeURIComponent(flowIdOrName)}`, {
103
106
  ...inputRequest,
104
107
  stream
105
108
  });
@@ -111,7 +114,7 @@ class LangflowClient {
111
114
  }
112
115
  async triggerWebhook(flowIdOrName, inputRequest) {
113
116
  try {
114
- const response = await this.client.post(`/webhook/${flowIdOrName}`, inputRequest);
117
+ const response = await this.client.post(`/webhook/${encodeURIComponent(flowIdOrName)}`, inputRequest);
115
118
  return response.data;
116
119
  }
117
120
  catch (error) {
@@ -165,7 +168,7 @@ class LangflowClient {
165
168
  }
166
169
  async getFolder(folderId) {
167
170
  try {
168
- const response = await this.client.get(`/folders/${folderId}`);
171
+ const response = await this.client.get(`/folders/${encodeURIComponent(folderId)}`);
169
172
  return response.data;
170
173
  }
171
174
  catch (error) {
@@ -174,7 +177,7 @@ class LangflowClient {
174
177
  }
175
178
  async updateFolder(folderId, updates) {
176
179
  try {
177
- const response = await this.client.patch(`/folders/${folderId}`, updates);
180
+ const response = await this.client.patch(`/folders/${encodeURIComponent(folderId)}`, updates);
178
181
  return response.data;
179
182
  }
180
183
  catch (error) {
@@ -183,7 +186,7 @@ class LangflowClient {
183
186
  }
184
187
  async deleteFolder(folderId) {
185
188
  try {
186
- await this.client.delete(`/folders/${folderId}`);
189
+ await this.client.delete(`/folders/${encodeURIComponent(folderId)}`);
187
190
  }
188
191
  catch (error) {
189
192
  throw this.handleError(error, `Failed to delete folder ${folderId}`);
@@ -209,7 +212,7 @@ class LangflowClient {
209
212
  }
210
213
  async getProject(projectId) {
211
214
  try {
212
- const response = await this.client.get(`/projects/${projectId}`);
215
+ const response = await this.client.get(`/projects/${encodeURIComponent(projectId)}`);
213
216
  return response.data;
214
217
  }
215
218
  catch (error) {
@@ -218,7 +221,7 @@ class LangflowClient {
218
221
  }
219
222
  async updateProject(projectId, updates) {
220
223
  try {
221
- const response = await this.client.patch(`/projects/${projectId}`, updates);
224
+ const response = await this.client.patch(`/projects/${encodeURIComponent(projectId)}`, updates);
222
225
  return response.data;
223
226
  }
224
227
  catch (error) {
@@ -227,7 +230,7 @@ class LangflowClient {
227
230
  }
228
231
  async deleteProject(projectId) {
229
232
  try {
230
- await this.client.delete(`/projects/${projectId}`);
233
+ await this.client.delete(`/projects/${encodeURIComponent(projectId)}`);
231
234
  }
232
235
  catch (error) {
233
236
  throw this.handleError(error, `Failed to delete project ${projectId}`);
@@ -244,7 +247,7 @@ class LangflowClient {
244
247
  }
245
248
  async downloadProject(projectId) {
246
249
  try {
247
- const response = await this.client.get(`/projects/download/${projectId}`);
250
+ const response = await this.client.get(`/projects/download/${encodeURIComponent(projectId)}`);
248
251
  return response.data;
249
252
  }
250
253
  catch (error) {
@@ -271,7 +274,7 @@ class LangflowClient {
271
274
  }
272
275
  async updateVariable(variableId, updates) {
273
276
  try {
274
- const response = await this.client.patch(`/variables/${variableId}`, updates);
277
+ const response = await this.client.patch(`/variables/${encodeURIComponent(variableId)}`, updates);
275
278
  return response.data;
276
279
  }
277
280
  catch (error) {
@@ -280,7 +283,7 @@ class LangflowClient {
280
283
  }
281
284
  async deleteVariable(variableId) {
282
285
  try {
283
- await this.client.delete(`/variables/${variableId}`);
286
+ await this.client.delete(`/variables/${encodeURIComponent(variableId)}`);
284
287
  }
285
288
  catch (error) {
286
289
  throw this.handleError(error, `Failed to delete variable ${variableId}`);
@@ -288,7 +291,7 @@ class LangflowClient {
288
291
  }
289
292
  async buildFlow(flowId, request, params) {
290
293
  try {
291
- const response = await this.client.post(`/build/${flowId}/flow`, request, { params });
294
+ const response = await this.client.post(`/build/${encodeURIComponent(flowId)}/flow`, request, { params });
292
295
  return response.data;
293
296
  }
294
297
  catch (error) {
@@ -297,7 +300,7 @@ class LangflowClient {
297
300
  }
298
301
  async getBuildStatus(jobId, eventDelivery = 'polling') {
299
302
  try {
300
- const response = await this.client.get(`/build/${jobId}/events`, { params: { event_delivery: eventDelivery } });
303
+ const response = await this.client.get(`/build/${encodeURIComponent(jobId)}/events`, { params: { event_delivery: eventDelivery } });
301
304
  return response.data;
302
305
  }
303
306
  catch (error) {
@@ -306,7 +309,7 @@ class LangflowClient {
306
309
  }
307
310
  async cancelBuild(jobId) {
308
311
  try {
309
- const response = await this.client.post(`/build/${jobId}/cancel`);
312
+ const response = await this.client.post(`/build/${encodeURIComponent(jobId)}/cancel`);
310
313
  return response.data;
311
314
  }
312
315
  catch (error) {
@@ -354,7 +357,7 @@ class LangflowClient {
354
357
  try {
355
358
  const formData = new form_data_1.default();
356
359
  formData.append('file', params.file, params.file_name);
357
- const response = await this.client.post(`/files/upload/${params.flow_id}`, formData, {
360
+ const response = await this.client.post(`/files/upload/${encodeURIComponent(params.flow_id)}`, formData, {
358
361
  headers: {
359
362
  ...formData.getHeaders()
360
363
  }
@@ -367,7 +370,7 @@ class LangflowClient {
367
370
  }
368
371
  async downloadFile(params) {
369
372
  try {
370
- const response = await this.client.get(`/files/download/${params.flow_id}/${params.file_name}`, {
373
+ const response = await this.client.get(`/files/download/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`, {
371
374
  responseType: 'arraybuffer'
372
375
  });
373
376
  return response.data;
@@ -378,7 +381,7 @@ class LangflowClient {
378
381
  }
379
382
  async listFiles(params) {
380
383
  try {
381
- const response = await this.client.get(`/files/list/${params.flow_id}`);
384
+ const response = await this.client.get(`/files/list/${encodeURIComponent(params.flow_id)}`);
382
385
  return response.data;
383
386
  }
384
387
  catch (error) {
@@ -387,7 +390,7 @@ class LangflowClient {
387
390
  }
388
391
  async deleteFile(params) {
389
392
  try {
390
- const response = await this.client.delete(`/files/delete/${params.flow_id}/${params.file_name}`);
393
+ const response = await this.client.delete(`/files/delete/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`);
391
394
  return response.data;
392
395
  }
393
396
  catch (error) {
@@ -396,7 +399,7 @@ class LangflowClient {
396
399
  }
397
400
  async getFileImage(params) {
398
401
  try {
399
- const response = await this.client.get(`/files/images/${params.flow_id}/${params.file_name}`, {
402
+ const response = await this.client.get(`/files/images/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`, {
400
403
  responseType: 'arraybuffer'
401
404
  });
402
405
  return response.data;
@@ -476,7 +479,7 @@ class LangflowClient {
476
479
  }
477
480
  async getStoreComponent(componentId) {
478
481
  try {
479
- const response = await this.client.get(`/store/components/${componentId}`);
482
+ const response = await this.client.get(`/store/components/${encodeURIComponent(componentId)}`);
480
483
  return response.data;
481
484
  }
482
485
  catch (error) {
@@ -503,7 +506,7 @@ class LangflowClient {
503
506
  }
504
507
  async runFlowAdvanced(flowId, request, stream = false) {
505
508
  try {
506
- const response = await this.client.post(`/run/advanced/${flowId}`, {
509
+ const response = await this.client.post(`/run/advanced/${encodeURIComponent(flowId)}`, {
507
510
  ...request,
508
511
  stream
509
512
  });
@@ -515,7 +518,7 @@ class LangflowClient {
515
518
  }
516
519
  async processFlow(flowId, request) {
517
520
  try {
518
- const response = await this.client.post(`/process/${flowId}`, request);
521
+ const response = await this.client.post(`/process/${encodeURIComponent(flowId)}`, request);
519
522
  return response.data;
520
523
  }
521
524
  catch (error) {
@@ -524,7 +527,7 @@ class LangflowClient {
524
527
  }
525
528
  async predictFlow(flowId, request) {
526
529
  try {
527
- const response = await this.client.post(`/predict/${flowId}`, request);
530
+ const response = await this.client.post(`/predict/${encodeURIComponent(flowId)}`, request);
528
531
  return response.data;
529
532
  }
530
533
  catch (error) {
@@ -551,7 +554,7 @@ class LangflowClient {
551
554
  }
552
555
  async getMonitorMessage(messageId) {
553
556
  try {
554
- const response = await this.client.get(`/monitor/messages/${messageId}`);
557
+ const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
555
558
  return response.data;
556
559
  }
557
560
  catch (error) {
@@ -569,7 +572,7 @@ class LangflowClient {
569
572
  }
570
573
  async getMonitorSessionMessages(sessionId) {
571
574
  try {
572
- const response = await this.client.get(`/monitor/messages/session/${sessionId}`);
575
+ const response = await this.client.get(`/monitor/messages/session/${encodeURIComponent(sessionId)}`);
573
576
  return response.data;
574
577
  }
575
578
  catch (error) {
@@ -578,7 +581,7 @@ class LangflowClient {
578
581
  }
579
582
  async migrateMonitorSession(params) {
580
583
  try {
581
- const response = await this.client.patch(`/monitor/messages/session/${params.old_session_id}`, null, { params: { new_session_id: params.new_session_id } });
584
+ const response = await this.client.patch(`/monitor/messages/session/${encodeURIComponent(params.old_session_id)}`, null, { params: { new_session_id: params.new_session_id } });
582
585
  return response.data;
583
586
  }
584
587
  catch (error) {
@@ -615,7 +618,7 @@ class LangflowClient {
615
618
  }
616
619
  async buildVertices(flowId, request) {
617
620
  try {
618
- const response = await this.client.post(`/build/${flowId}/vertices`, request || {});
621
+ const response = await this.client.post(`/build/${encodeURIComponent(flowId)}/vertices`, {}, { params: request });
619
622
  return response.data;
620
623
  }
621
624
  catch (error) {
@@ -624,7 +627,7 @@ class LangflowClient {
624
627
  }
625
628
  async getVertex(params) {
626
629
  try {
627
- const response = await this.client.get(`/build/${params.flow_id}/vertices/${params.vertex_id}`);
630
+ const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`);
628
631
  return response.data;
629
632
  }
630
633
  catch (error) {
@@ -633,7 +636,7 @@ class LangflowClient {
633
636
  }
634
637
  async streamVertexBuild(params) {
635
638
  try {
636
- const response = await this.client.get(`/build/${params.flow_id}/${params.vertex_id}/stream`);
639
+ const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.vertex_id)}/stream`);
637
640
  return response.data;
638
641
  }
639
642
  catch (error) {
@@ -669,7 +672,7 @@ class LangflowClient {
669
672
  }
670
673
  async getUser(userId) {
671
674
  try {
672
- const response = await this.client.get(`/users/${userId}`);
675
+ const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
673
676
  return response.data;
674
677
  }
675
678
  catch (error) {
@@ -678,7 +681,7 @@ class LangflowClient {
678
681
  }
679
682
  async updateUser(userId, updates) {
680
683
  try {
681
- const response = await this.client.patch(`/users/${userId}`, updates);
684
+ const response = await this.client.patch(`/users/${encodeURIComponent(userId)}`, updates);
682
685
  return response.data;
683
686
  }
684
687
  catch (error) {
@@ -716,7 +719,7 @@ class LangflowClient {
716
719
  }
717
720
  async deleteApiKey(apiKeyId) {
718
721
  try {
719
- await this.client.delete(`/api_key/${apiKeyId}`);
722
+ await this.client.delete(`/api_key/${encodeURIComponent(apiKeyId)}`);
720
723
  }
721
724
  catch (error) {
722
725
  throw this.handleError(error, `Failed to delete API key ${apiKeyId}`);
@@ -785,7 +788,7 @@ class LangflowClient {
785
788
  }
786
789
  async getPublicFlow(flowId) {
787
790
  try {
788
- const response = await this.client.get(`/flows/public_flow/${flowId}`);
791
+ const response = await this.client.get(`/flows/public_flow/${encodeURIComponent(flowId)}`);
789
792
  return response.data;
790
793
  }
791
794
  catch (error) {
@@ -803,7 +806,7 @@ class LangflowClient {
803
806
  }
804
807
  async getTaskStatus(taskId) {
805
808
  try {
806
- const response = await this.client.get(`/task/${taskId}`);
809
+ const response = await this.client.get(`/task/${encodeURIComponent(taskId)}`);
807
810
  return response.data;
808
811
  }
809
812
  catch (error) {
@@ -893,7 +896,7 @@ class LangflowClient {
893
896
  }
894
897
  async getMonitorMessageById(messageId) {
895
898
  try {
896
- const response = await this.client.get(`/monitor/messages/${messageId}`);
899
+ const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
897
900
  return response.data;
898
901
  }
899
902
  catch (error) {
@@ -902,7 +905,7 @@ class LangflowClient {
902
905
  }
903
906
  async getMonitorTransactionById(transactionId) {
904
907
  try {
905
- const response = await this.client.get(`/monitor/transactions/${transactionId}`);
908
+ const response = await this.client.get(`/monitor/transactions/${encodeURIComponent(transactionId)}`);
906
909
  return response.data;
907
910
  }
908
911
  catch (error) {
@@ -920,7 +923,7 @@ class LangflowClient {
920
923
  }
921
924
  async getMonitorVertexBuildById(vertexBuildId) {
922
925
  try {
923
- const response = await this.client.get(`/monitor/vertices/builds/${vertexBuildId}`);
926
+ const response = await this.client.get(`/monitor/vertices/builds/${encodeURIComponent(vertexBuildId)}`);
924
927
  return response.data;
925
928
  }
926
929
  catch (error) {
@@ -929,7 +932,7 @@ class LangflowClient {
929
932
  }
930
933
  async uploadTextData(params) {
931
934
  try {
932
- const response = await this.client.post(`/files/upload/${params.flow_id}/text`, {
935
+ const response = await this.client.post(`/files/upload/${encodeURIComponent(params.flow_id)}/text`, {
933
936
  text: params.text_data,
934
937
  file_name: params.file_name
935
938
  });
@@ -950,7 +953,7 @@ class LangflowClient {
950
953
  }
951
954
  async updateCustomComponent(componentId, updates) {
952
955
  try {
953
- const response = await this.client.patch(`/custom_component/${componentId}`, updates);
956
+ const response = await this.client.patch(`/custom_component/${encodeURIComponent(componentId)}`, updates);
954
957
  return response.data;
955
958
  }
956
959
  catch (error) {
@@ -959,7 +962,7 @@ class LangflowClient {
959
962
  }
960
963
  async deleteCustomComponent(componentId) {
961
964
  try {
962
- await this.client.delete(`/custom_component/${componentId}`);
965
+ await this.client.delete(`/custom_component/${encodeURIComponent(componentId)}`);
963
966
  }
964
967
  catch (error) {
965
968
  throw this.handleError(error, `Failed to delete custom component ${componentId}`);
@@ -967,7 +970,7 @@ class LangflowClient {
967
970
  }
968
971
  async deleteUser(userId) {
969
972
  try {
970
- await this.client.delete(`/users/${userId}`);
973
+ await this.client.delete(`/users/${encodeURIComponent(userId)}`);
971
974
  }
972
975
  catch (error) {
973
976
  throw this.handleError(error, `Failed to delete user ${userId}`);
@@ -1002,7 +1005,7 @@ class LangflowClient {
1002
1005
  }
1003
1006
  async exportFlow(flowId) {
1004
1007
  try {
1005
- const response = await this.client.get(`/flows/${flowId}/export`);
1008
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/export`);
1006
1009
  return response.data;
1007
1010
  }
1008
1011
  catch (error) {
@@ -1020,7 +1023,7 @@ class LangflowClient {
1020
1023
  }
1021
1024
  async cloneFlow(flowId, name) {
1022
1025
  try {
1023
- const response = await this.client.post(`/flows/${flowId}/clone`, { name });
1026
+ const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/clone`, { name });
1024
1027
  return response.data;
1025
1028
  }
1026
1029
  catch (error) {
@@ -1029,7 +1032,7 @@ class LangflowClient {
1029
1032
  }
1030
1033
  async getFlowDependencies(flowId) {
1031
1034
  try {
1032
- const response = await this.client.get(`/flows/${flowId}/dependencies`);
1035
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/dependencies`);
1033
1036
  return response.data;
1034
1037
  }
1035
1038
  catch (error) {
@@ -1047,7 +1050,7 @@ class LangflowClient {
1047
1050
  }
1048
1051
  async buildVertex(params) {
1049
1052
  try {
1050
- const response = await this.client.post(`/build/${params.flow_id}/vertices/${params.vertex_id}`, params.inputs || {});
1053
+ const response = await this.client.post(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`, params.inputs || {});
1051
1054
  return response.data;
1052
1055
  }
1053
1056
  catch (error) {
@@ -1056,7 +1059,7 @@ class LangflowClient {
1056
1059
  }
1057
1060
  async cancelExecution(params) {
1058
1061
  try {
1059
- const response = await this.client.post(`/executions/${params.execution_id}/cancel`);
1062
+ const response = await this.client.post(`/executions/${encodeURIComponent(params.execution_id)}/cancel`);
1060
1063
  return response.data;
1061
1064
  }
1062
1065
  catch (error) {
@@ -1065,7 +1068,7 @@ class LangflowClient {
1065
1068
  }
1066
1069
  async getExecutionResult(params) {
1067
1070
  try {
1068
- const response = await this.client.get(`/executions/${params.execution_id}/result`);
1071
+ const response = await this.client.get(`/executions/${encodeURIComponent(params.execution_id)}/result`);
1069
1072
  return response.data;
1070
1073
  }
1071
1074
  catch (error) {
@@ -1074,7 +1077,7 @@ class LangflowClient {
1074
1077
  }
1075
1078
  async getFileMetadata(params) {
1076
1079
  try {
1077
- const response = await this.client.get(`/files/${params.flow_id}/${params.file_name}/metadata`);
1080
+ const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}/metadata`);
1078
1081
  return response.data;
1079
1082
  }
1080
1083
  catch (error) {
@@ -1092,7 +1095,7 @@ class LangflowClient {
1092
1095
  }
1093
1096
  async getUserById(userId) {
1094
1097
  try {
1095
- const response = await this.client.get(`/users/${userId}`);
1098
+ const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
1096
1099
  return response.data;
1097
1100
  }
1098
1101
  catch (error) {
@@ -1101,7 +1104,7 @@ class LangflowClient {
1101
1104
  }
1102
1105
  async listFilesDetailed(params) {
1103
1106
  try {
1104
- const response = await this.client.get(`/files/${params.flow_id}/detailed`);
1107
+ const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/detailed`);
1105
1108
  return response.data;
1106
1109
  }
1107
1110
  catch (error) {
@@ -1124,7 +1127,7 @@ class LangflowClient {
1124
1127
  async runAdvancedExecution(params) {
1125
1128
  try {
1126
1129
  const { flow_id, ...request } = params;
1127
- const response = await this.client.post(`/executions/${flow_id}/advanced`, request);
1130
+ const response = await this.client.post(`/executions/${encodeURIComponent(flow_id)}/advanced`, request);
1128
1131
  return response.data;
1129
1132
  }
1130
1133
  catch (error) {
@@ -1153,7 +1156,7 @@ class LangflowClient {
1153
1156
  }
1154
1157
  async updateStoreComponent(componentId, updates) {
1155
1158
  try {
1156
- const response = await this.client.patch(`/store/components/${componentId}`, updates);
1159
+ const response = await this.client.patch(`/store/components/${encodeURIComponent(componentId)}`, updates);
1157
1160
  return response.data;
1158
1161
  }
1159
1162
  catch (error) {
@@ -1171,7 +1174,7 @@ class LangflowClient {
1171
1174
  }
1172
1175
  async validateFlow(params) {
1173
1176
  try {
1174
- const response = await this.client.post(`/flows/${params.flow_id}/validate`);
1177
+ const response = await this.client.post(`/flows/${encodeURIComponent(params.flow_id)}/validate`);
1175
1178
  return response.data;
1176
1179
  }
1177
1180
  catch (error) {
@@ -1195,8 +1198,9 @@ class LangflowClient {
1195
1198
  return val;
1196
1199
  if (depth > MAX_DEPTH)
1197
1200
  return '[max depth exceeded]';
1198
- if (Buffer.isBuffer(val) || val instanceof ArrayBuffer)
1201
+ if (Buffer.isBuffer(val) || val instanceof ArrayBuffer || ArrayBuffer.isView(val)) {
1199
1202
  return '[binary data]';
1203
+ }
1200
1204
  if (seen.has(val))
1201
1205
  return '[circular reference]';
1202
1206
  seen.add(val);