@flowdot.ai/mcp-server 1.0.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 (315) hide show
  1. package/README.md +162 -0
  2. package/bin/flowdot-mcp.js +15 -0
  3. package/dist/api-client.d.ts +349 -0
  4. package/dist/api-client.d.ts.map +1 -0
  5. package/dist/api-client.js +789 -0
  6. package/dist/api-client.js.map +1 -0
  7. package/dist/index.d.ts +26 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +32 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/server.d.ts +15 -0
  12. package/dist/server.d.ts.map +1 -0
  13. package/dist/server.js +96 -0
  14. package/dist/server.js.map +1 -0
  15. package/dist/tools/add-connection.d.ts +16 -0
  16. package/dist/tools/add-connection.d.ts.map +1 -0
  17. package/dist/tools/add-connection.js +62 -0
  18. package/dist/tools/add-connection.js.map +1 -0
  19. package/dist/tools/add-custom-node-comment.d.ts +15 -0
  20. package/dist/tools/add-custom-node-comment.d.ts.map +1 -0
  21. package/dist/tools/add-custom-node-comment.js +69 -0
  22. package/dist/tools/add-custom-node-comment.js.map +1 -0
  23. package/dist/tools/add-node.d.ts +18 -0
  24. package/dist/tools/add-node.d.ts.map +1 -0
  25. package/dist/tools/add-node.js +66 -0
  26. package/dist/tools/add-node.js.map +1 -0
  27. package/dist/tools/add-shared-result-comment.d.ts +15 -0
  28. package/dist/tools/add-shared-result-comment.d.ts.map +1 -0
  29. package/dist/tools/add-shared-result-comment.js +70 -0
  30. package/dist/tools/add-shared-result-comment.js.map +1 -0
  31. package/dist/tools/add-workflow-comment.d.ts +14 -0
  32. package/dist/tools/add-workflow-comment.d.ts.map +1 -0
  33. package/dist/tools/add-workflow-comment.js +66 -0
  34. package/dist/tools/add-workflow-comment.js.map +1 -0
  35. package/dist/tools/agent-chat.d.ts +14 -0
  36. package/dist/tools/agent-chat.d.ts.map +1 -0
  37. package/dist/tools/agent-chat.js +80 -0
  38. package/dist/tools/agent-chat.js.map +1 -0
  39. package/dist/tools/cancel-execution.d.ts +12 -0
  40. package/dist/tools/cancel-execution.d.ts.map +1 -0
  41. package/dist/tools/cancel-execution.js +37 -0
  42. package/dist/tools/cancel-execution.js.map +1 -0
  43. package/dist/tools/clone-app.d.ts +11 -0
  44. package/dist/tools/clone-app.d.ts.map +1 -0
  45. package/dist/tools/clone-app.js +63 -0
  46. package/dist/tools/clone-app.js.map +1 -0
  47. package/dist/tools/copy-custom-node.d.ts +14 -0
  48. package/dist/tools/copy-custom-node.d.ts.map +1 -0
  49. package/dist/tools/copy-custom-node.js +50 -0
  50. package/dist/tools/copy-custom-node.js.map +1 -0
  51. package/dist/tools/create-app.d.ts +11 -0
  52. package/dist/tools/create-app.d.ts.map +1 -0
  53. package/dist/tools/create-app.js +182 -0
  54. package/dist/tools/create-app.js.map +1 -0
  55. package/dist/tools/create-custom-node.d.ts +28 -0
  56. package/dist/tools/create-custom-node.d.ts.map +1 -0
  57. package/dist/tools/create-custom-node.js +221 -0
  58. package/dist/tools/create-custom-node.js.map +1 -0
  59. package/dist/tools/create-input-preset.d.ts +15 -0
  60. package/dist/tools/create-input-preset.d.ts.map +1 -0
  61. package/dist/tools/create-input-preset.js +76 -0
  62. package/dist/tools/create-input-preset.js.map +1 -0
  63. package/dist/tools/create-shared-result.d.ts +17 -0
  64. package/dist/tools/create-shared-result.d.ts.map +1 -0
  65. package/dist/tools/create-shared-result.js +78 -0
  66. package/dist/tools/create-shared-result.js.map +1 -0
  67. package/dist/tools/create-workflow.d.ts +13 -0
  68. package/dist/tools/create-workflow.d.ts.map +1 -0
  69. package/dist/tools/create-workflow.js +49 -0
  70. package/dist/tools/create-workflow.js.map +1 -0
  71. package/dist/tools/delete-app.d.ts +11 -0
  72. package/dist/tools/delete-app.d.ts.map +1 -0
  73. package/dist/tools/delete-app.js +40 -0
  74. package/dist/tools/delete-app.js.map +1 -0
  75. package/dist/tools/delete-connection.d.ts +13 -0
  76. package/dist/tools/delete-connection.d.ts.map +1 -0
  77. package/dist/tools/delete-connection.js +41 -0
  78. package/dist/tools/delete-connection.js.map +1 -0
  79. package/dist/tools/delete-custom-node.d.ts +13 -0
  80. package/dist/tools/delete-custom-node.d.ts.map +1 -0
  81. package/dist/tools/delete-custom-node.js +41 -0
  82. package/dist/tools/delete-custom-node.js.map +1 -0
  83. package/dist/tools/delete-input-preset.d.ts +13 -0
  84. package/dist/tools/delete-input-preset.d.ts.map +1 -0
  85. package/dist/tools/delete-input-preset.js +42 -0
  86. package/dist/tools/delete-input-preset.js.map +1 -0
  87. package/dist/tools/delete-node.d.ts +13 -0
  88. package/dist/tools/delete-node.d.ts.map +1 -0
  89. package/dist/tools/delete-node.js +41 -0
  90. package/dist/tools/delete-node.js.map +1 -0
  91. package/dist/tools/delete-workflow.d.ts +12 -0
  92. package/dist/tools/delete-workflow.d.ts.map +1 -0
  93. package/dist/tools/delete-workflow.js +37 -0
  94. package/dist/tools/delete-workflow.js.map +1 -0
  95. package/dist/tools/duplicate-workflow.d.ts +13 -0
  96. package/dist/tools/duplicate-workflow.d.ts.map +1 -0
  97. package/dist/tools/duplicate-workflow.js +49 -0
  98. package/dist/tools/duplicate-workflow.js.map +1 -0
  99. package/dist/tools/execute-workflow.d.ts +15 -0
  100. package/dist/tools/execute-workflow.d.ts.map +1 -0
  101. package/dist/tools/execute-workflow.js +112 -0
  102. package/dist/tools/execute-workflow.js.map +1 -0
  103. package/dist/tools/favorite-custom-node.d.ts +14 -0
  104. package/dist/tools/favorite-custom-node.d.ts.map +1 -0
  105. package/dist/tools/favorite-custom-node.js +48 -0
  106. package/dist/tools/favorite-custom-node.js.map +1 -0
  107. package/dist/tools/favorite-workflow.d.ts +13 -0
  108. package/dist/tools/favorite-workflow.d.ts.map +1 -0
  109. package/dist/tools/favorite-workflow.js +42 -0
  110. package/dist/tools/favorite-workflow.js.map +1 -0
  111. package/dist/tools/get-app-template.d.ts +10 -0
  112. package/dist/tools/get-app-template.d.ts.map +1 -0
  113. package/dist/tools/get-app-template.js +856 -0
  114. package/dist/tools/get-app-template.js.map +1 -0
  115. package/dist/tools/get-app.d.ts +11 -0
  116. package/dist/tools/get-app.d.ts.map +1 -0
  117. package/dist/tools/get-app.js +124 -0
  118. package/dist/tools/get-app.js.map +1 -0
  119. package/dist/tools/get-custom-node-comments.d.ts +13 -0
  120. package/dist/tools/get-custom-node-comments.d.ts.map +1 -0
  121. package/dist/tools/get-custom-node-comments.js +65 -0
  122. package/dist/tools/get-custom-node-comments.js.map +1 -0
  123. package/dist/tools/get-custom-node-template.d.ts +31 -0
  124. package/dist/tools/get-custom-node-template.d.ts.map +1 -0
  125. package/dist/tools/get-custom-node-template.js +212 -0
  126. package/dist/tools/get-custom-node-template.js.map +1 -0
  127. package/dist/tools/get-custom-node.d.ts +13 -0
  128. package/dist/tools/get-custom-node.d.ts.map +1 -0
  129. package/dist/tools/get-custom-node.js +98 -0
  130. package/dist/tools/get-custom-node.js.map +1 -0
  131. package/dist/tools/get-execution-history.d.ts +14 -0
  132. package/dist/tools/get-execution-history.d.ts.map +1 -0
  133. package/dist/tools/get-execution-history.js +65 -0
  134. package/dist/tools/get-execution-history.js.map +1 -0
  135. package/dist/tools/get-execution.d.ts +12 -0
  136. package/dist/tools/get-execution.d.ts.map +1 -0
  137. package/dist/tools/get-execution.js +81 -0
  138. package/dist/tools/get-execution.js.map +1 -0
  139. package/dist/tools/get-input-preset.d.ts +13 -0
  140. package/dist/tools/get-input-preset.d.ts.map +1 -0
  141. package/dist/tools/get-input-preset.js +69 -0
  142. package/dist/tools/get-input-preset.js.map +1 -0
  143. package/dist/tools/get-node-connections.d.ts +13 -0
  144. package/dist/tools/get-node-connections.d.ts.map +1 -0
  145. package/dist/tools/get-node-connections.js +67 -0
  146. package/dist/tools/get-node-connections.js.map +1 -0
  147. package/dist/tools/get-node-schema.d.ts +12 -0
  148. package/dist/tools/get-node-schema.d.ts.map +1 -0
  149. package/dist/tools/get-node-schema.js +113 -0
  150. package/dist/tools/get-node-schema.js.map +1 -0
  151. package/dist/tools/get-public-workflows.d.ts +13 -0
  152. package/dist/tools/get-public-workflows.d.ts.map +1 -0
  153. package/dist/tools/get-public-workflows.js +63 -0
  154. package/dist/tools/get-public-workflows.js.map +1 -0
  155. package/dist/tools/get-shared-result-comments.d.ts +13 -0
  156. package/dist/tools/get-shared-result-comments.d.ts.map +1 -0
  157. package/dist/tools/get-shared-result-comments.js +62 -0
  158. package/dist/tools/get-shared-result-comments.js.map +1 -0
  159. package/dist/tools/get-shared-result.d.ts +13 -0
  160. package/dist/tools/get-shared-result.d.ts.map +1 -0
  161. package/dist/tools/get-shared-result.js +83 -0
  162. package/dist/tools/get-shared-result.js.map +1 -0
  163. package/dist/tools/get-workflow-comments.d.ts +12 -0
  164. package/dist/tools/get-workflow-comments.d.ts.map +1 -0
  165. package/dist/tools/get-workflow-comments.js +60 -0
  166. package/dist/tools/get-workflow-comments.js.map +1 -0
  167. package/dist/tools/get-workflow-details.d.ts +12 -0
  168. package/dist/tools/get-workflow-details.d.ts.map +1 -0
  169. package/dist/tools/get-workflow-details.js +87 -0
  170. package/dist/tools/get-workflow-details.js.map +1 -0
  171. package/dist/tools/get-workflow-graph.d.ts +12 -0
  172. package/dist/tools/get-workflow-graph.d.ts.map +1 -0
  173. package/dist/tools/get-workflow-graph.js +83 -0
  174. package/dist/tools/get-workflow-graph.js.map +1 -0
  175. package/dist/tools/get-workflow-inputs-schema.d.ts +12 -0
  176. package/dist/tools/get-workflow-inputs-schema.d.ts.map +1 -0
  177. package/dist/tools/get-workflow-inputs-schema.js +74 -0
  178. package/dist/tools/get-workflow-inputs-schema.js.map +1 -0
  179. package/dist/tools/get-workflow-metrics.d.ts +13 -0
  180. package/dist/tools/get-workflow-metrics.d.ts.map +1 -0
  181. package/dist/tools/get-workflow-metrics.js +65 -0
  182. package/dist/tools/get-workflow-metrics.js.map +1 -0
  183. package/dist/tools/get-workflow-public-url.d.ts +12 -0
  184. package/dist/tools/get-workflow-public-url.d.ts.map +1 -0
  185. package/dist/tools/get-workflow-public-url.js +48 -0
  186. package/dist/tools/get-workflow-public-url.js.map +1 -0
  187. package/dist/tools/get-workflow-tags.d.ts +12 -0
  188. package/dist/tools/get-workflow-tags.d.ts.map +1 -0
  189. package/dist/tools/get-workflow-tags.js +42 -0
  190. package/dist/tools/get-workflow-tags.js.map +1 -0
  191. package/dist/tools/index.d.ts +12 -0
  192. package/dist/tools/index.d.ts.map +1 -0
  193. package/dist/tools/index.js +407 -0
  194. package/dist/tools/index.js.map +1 -0
  195. package/dist/tools/link-app-workflow.d.ts +11 -0
  196. package/dist/tools/link-app-workflow.d.ts.map +1 -0
  197. package/dist/tools/link-app-workflow.js +69 -0
  198. package/dist/tools/link-app-workflow.js.map +1 -0
  199. package/dist/tools/list-apps.d.ts +11 -0
  200. package/dist/tools/list-apps.d.ts.map +1 -0
  201. package/dist/tools/list-apps.js +75 -0
  202. package/dist/tools/list-apps.js.map +1 -0
  203. package/dist/tools/list-available-nodes.d.ts +10 -0
  204. package/dist/tools/list-available-nodes.d.ts.map +1 -0
  205. package/dist/tools/list-available-nodes.js +94 -0
  206. package/dist/tools/list-available-nodes.js.map +1 -0
  207. package/dist/tools/list-custom-nodes.d.ts +16 -0
  208. package/dist/tools/list-custom-nodes.d.ts.map +1 -0
  209. package/dist/tools/list-custom-nodes.js +80 -0
  210. package/dist/tools/list-custom-nodes.js.map +1 -0
  211. package/dist/tools/list-input-presets.d.ts +15 -0
  212. package/dist/tools/list-input-presets.d.ts.map +1 -0
  213. package/dist/tools/list-input-presets.js +100 -0
  214. package/dist/tools/list-input-presets.js.map +1 -0
  215. package/dist/tools/list-shared-results.d.ts +15 -0
  216. package/dist/tools/list-shared-results.d.ts.map +1 -0
  217. package/dist/tools/list-shared-results.js +80 -0
  218. package/dist/tools/list-shared-results.js.map +1 -0
  219. package/dist/tools/list-workflows.d.ts +13 -0
  220. package/dist/tools/list-workflows.d.ts.map +1 -0
  221. package/dist/tools/list-workflows.js +70 -0
  222. package/dist/tools/list-workflows.js.map +1 -0
  223. package/dist/tools/publish-app.d.ts +11 -0
  224. package/dist/tools/publish-app.d.ts.map +1 -0
  225. package/dist/tools/publish-app.js +44 -0
  226. package/dist/tools/publish-app.js.map +1 -0
  227. package/dist/tools/retry-execution.d.ts +12 -0
  228. package/dist/tools/retry-execution.d.ts.map +1 -0
  229. package/dist/tools/retry-execution.js +45 -0
  230. package/dist/tools/retry-execution.js.map +1 -0
  231. package/dist/tools/search-apps.d.ts +11 -0
  232. package/dist/tools/search-apps.d.ts.map +1 -0
  233. package/dist/tools/search-apps.js +104 -0
  234. package/dist/tools/search-apps.js.map +1 -0
  235. package/dist/tools/search-public-custom-nodes.d.ts +19 -0
  236. package/dist/tools/search-public-custom-nodes.d.ts.map +1 -0
  237. package/dist/tools/search-public-custom-nodes.js +101 -0
  238. package/dist/tools/search-public-custom-nodes.js.map +1 -0
  239. package/dist/tools/search-workflows.d.ts +14 -0
  240. package/dist/tools/search-workflows.d.ts.map +1 -0
  241. package/dist/tools/search-workflows.js +62 -0
  242. package/dist/tools/search-workflows.js.map +1 -0
  243. package/dist/tools/set-workflow-tags.d.ts +13 -0
  244. package/dist/tools/set-workflow-tags.d.ts.map +1 -0
  245. package/dist/tools/set-workflow-tags.js +42 -0
  246. package/dist/tools/set-workflow-tags.js.map +1 -0
  247. package/dist/tools/stream-execution.d.ts +13 -0
  248. package/dist/tools/stream-execution.d.ts.map +1 -0
  249. package/dist/tools/stream-execution.js +70 -0
  250. package/dist/tools/stream-execution.js.map +1 -0
  251. package/dist/tools/toggle-community-inputs.d.ts +13 -0
  252. package/dist/tools/toggle-community-inputs.d.ts.map +1 -0
  253. package/dist/tools/toggle-community-inputs.js +49 -0
  254. package/dist/tools/toggle-community-inputs.js.map +1 -0
  255. package/dist/tools/toggle-custom-node-visibility.d.ts +14 -0
  256. package/dist/tools/toggle-custom-node-visibility.d.ts.map +1 -0
  257. package/dist/tools/toggle-custom-node-visibility.js +59 -0
  258. package/dist/tools/toggle-custom-node-visibility.js.map +1 -0
  259. package/dist/tools/toggle-workflow-public.d.ts +13 -0
  260. package/dist/tools/toggle-workflow-public.d.ts.map +1 -0
  261. package/dist/tools/toggle-workflow-public.js +42 -0
  262. package/dist/tools/toggle-workflow-public.js.map +1 -0
  263. package/dist/tools/unlink-app-workflow.d.ts +11 -0
  264. package/dist/tools/unlink-app-workflow.d.ts.map +1 -0
  265. package/dist/tools/unlink-app-workflow.js +44 -0
  266. package/dist/tools/unlink-app-workflow.js.map +1 -0
  267. package/dist/tools/unpublish-app.d.ts +11 -0
  268. package/dist/tools/unpublish-app.d.ts.map +1 -0
  269. package/dist/tools/unpublish-app.js +39 -0
  270. package/dist/tools/unpublish-app.js.map +1 -0
  271. package/dist/tools/update-app.d.ts +11 -0
  272. package/dist/tools/update-app.d.ts.map +1 -0
  273. package/dist/tools/update-app.js +101 -0
  274. package/dist/tools/update-app.js.map +1 -0
  275. package/dist/tools/update-custom-node.d.ts +28 -0
  276. package/dist/tools/update-custom-node.d.ts.map +1 -0
  277. package/dist/tools/update-custom-node.js +174 -0
  278. package/dist/tools/update-custom-node.js.map +1 -0
  279. package/dist/tools/update-input-preset.d.ts +16 -0
  280. package/dist/tools/update-input-preset.d.ts.map +1 -0
  281. package/dist/tools/update-input-preset.js +79 -0
  282. package/dist/tools/update-input-preset.js.map +1 -0
  283. package/dist/tools/update-node.d.ts +18 -0
  284. package/dist/tools/update-node.d.ts.map +1 -0
  285. package/dist/tools/update-node.js +73 -0
  286. package/dist/tools/update-node.js.map +1 -0
  287. package/dist/tools/validate-workflow.d.ts +12 -0
  288. package/dist/tools/validate-workflow.d.ts.map +1 -0
  289. package/dist/tools/validate-workflow.js +61 -0
  290. package/dist/tools/validate-workflow.js.map +1 -0
  291. package/dist/tools/vote-custom-node.d.ts +14 -0
  292. package/dist/tools/vote-custom-node.d.ts.map +1 -0
  293. package/dist/tools/vote-custom-node.js +60 -0
  294. package/dist/tools/vote-custom-node.js.map +1 -0
  295. package/dist/tools/vote-input-preset.d.ts +14 -0
  296. package/dist/tools/vote-input-preset.d.ts.map +1 -0
  297. package/dist/tools/vote-input-preset.js +49 -0
  298. package/dist/tools/vote-input-preset.js.map +1 -0
  299. package/dist/tools/vote-shared-result.d.ts +14 -0
  300. package/dist/tools/vote-shared-result.d.ts.map +1 -0
  301. package/dist/tools/vote-shared-result.js +49 -0
  302. package/dist/tools/vote-shared-result.js.map +1 -0
  303. package/dist/tools/vote-workflow.d.ts +13 -0
  304. package/dist/tools/vote-workflow.d.ts.map +1 -0
  305. package/dist/tools/vote-workflow.js +45 -0
  306. package/dist/tools/vote-workflow.js.map +1 -0
  307. package/dist/types.d.ts +670 -0
  308. package/dist/types.d.ts.map +1 -0
  309. package/dist/types.js +5 -0
  310. package/dist/types.js.map +1 -0
  311. package/dist/utils/script-validator.d.ts +35 -0
  312. package/dist/utils/script-validator.d.ts.map +1 -0
  313. package/dist/utils/script-validator.js +282 -0
  314. package/dist/utils/script-validator.js.map +1 -0
  315. package/package.json +54 -0
@@ -0,0 +1,789 @@
1
+ /**
2
+ * FlowDot Hub API Client
3
+ *
4
+ * Handles communication with the FlowDot Hub API using MCP tokens.
5
+ */
6
+ export class FlowDotApiClient {
7
+ hubUrl;
8
+ apiToken;
9
+ constructor(hubUrl, apiToken) {
10
+ // Remove trailing slash from hubUrl
11
+ this.hubUrl = hubUrl.replace(/\/$/, '');
12
+ this.apiToken = apiToken;
13
+ }
14
+ /**
15
+ * Make an authenticated request to the FlowDot Hub API.
16
+ */
17
+ async request(endpoint, options = {}) {
18
+ const url = `${this.hubUrl}/api/mcp/v1${endpoint}`;
19
+ const response = await fetch(url, {
20
+ ...options,
21
+ headers: {
22
+ Authorization: `Bearer ${this.apiToken}`,
23
+ 'Content-Type': 'application/json',
24
+ Accept: 'application/json',
25
+ ...options.headers,
26
+ },
27
+ });
28
+ const data = (await response.json());
29
+ if (!response.ok || !data.success) {
30
+ const errorMessage = data.error || data.message || `API error: ${response.status}`;
31
+ throw new Error(errorMessage);
32
+ }
33
+ return data.data;
34
+ }
35
+ /**
36
+ * List workflows available to the user.
37
+ */
38
+ async listWorkflows(filter, favoritesOnly) {
39
+ const params = new URLSearchParams();
40
+ if (filter)
41
+ params.set('filter', filter);
42
+ if (favoritesOnly)
43
+ params.set('favorites_only', 'true');
44
+ const queryString = params.toString();
45
+ const endpoint = `/workflows${queryString ? `?${queryString}` : ''}`;
46
+ return this.request(endpoint);
47
+ }
48
+ /**
49
+ * Get a specific workflow by ID.
50
+ */
51
+ async getWorkflow(workflowId) {
52
+ return this.request(`/workflows/${workflowId}`);
53
+ }
54
+ /**
55
+ * Execute a workflow.
56
+ */
57
+ async executeWorkflow(workflowId, inputs = {}, waitForCompletion = true, mode = 'flowdot') {
58
+ return this.request(`/workflows/${workflowId}/execute`, {
59
+ method: 'POST',
60
+ body: JSON.stringify({
61
+ inputs,
62
+ wait_for_completion: waitForCompletion,
63
+ mode,
64
+ }),
65
+ });
66
+ }
67
+ /**
68
+ * Get execution status and results.
69
+ */
70
+ async getExecution(executionId) {
71
+ return this.request(`/executions/${executionId}`);
72
+ }
73
+ /**
74
+ * Chat with the FlowDot agent.
75
+ */
76
+ async agentChat(message, conversationId, mode) {
77
+ return this.request('/agent/chat', {
78
+ method: 'POST',
79
+ body: JSON.stringify({
80
+ message,
81
+ conversation_id: conversationId,
82
+ mode: mode || 'flowdot',
83
+ }),
84
+ });
85
+ }
86
+ /**
87
+ * Test the connection to the FlowDot Hub.
88
+ */
89
+ async testConnection() {
90
+ try {
91
+ await this.listWorkflows();
92
+ return true;
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ }
98
+ // ============================================
99
+ // Analytics & Feedback (analytics:read scope)
100
+ // ============================================
101
+ /**
102
+ * Get workflow execution metrics.
103
+ */
104
+ async getWorkflowMetrics(workflowId, period) {
105
+ const params = new URLSearchParams();
106
+ if (period)
107
+ params.set('period', period);
108
+ const queryString = params.toString();
109
+ return this.request(`/workflows/${workflowId}/metrics${queryString ? `?${queryString}` : ''}`);
110
+ }
111
+ /**
112
+ * Get workflow comments.
113
+ */
114
+ async getWorkflowComments(workflowId) {
115
+ return this.request(`/workflows/${workflowId}/comments`);
116
+ }
117
+ /**
118
+ * Get execution history for a workflow.
119
+ */
120
+ async getExecutionHistory(workflowId, page, limit) {
121
+ const params = new URLSearchParams();
122
+ if (page)
123
+ params.set('page', page.toString());
124
+ if (limit)
125
+ params.set('limit', limit.toString());
126
+ const queryString = params.toString();
127
+ return this.request(`/workflows/${workflowId}/executions${queryString ? `?${queryString}` : ''}`);
128
+ }
129
+ // ============================================
130
+ // Workflow Management (workflows:manage scope)
131
+ // ============================================
132
+ /**
133
+ * Get detailed workflow information including nodes, connections, signature.
134
+ */
135
+ async getWorkflowDetails(workflowId) {
136
+ return this.request(`/workflows/${workflowId}/details`);
137
+ }
138
+ /**
139
+ * Get the input schema for a workflow.
140
+ */
141
+ async getWorkflowInputsSchema(workflowId) {
142
+ return this.request(`/workflows/${workflowId}/inputs-schema`);
143
+ }
144
+ /**
145
+ * Duplicate a workflow.
146
+ */
147
+ async duplicateWorkflow(workflowId, name) {
148
+ return this.request(`/workflows/${workflowId}/duplicate`, {
149
+ method: 'POST',
150
+ body: JSON.stringify({ name }),
151
+ });
152
+ }
153
+ /**
154
+ * Toggle workflow public/private status.
155
+ */
156
+ async toggleWorkflowPublic(workflowId, isPublic) {
157
+ return this.request(`/workflows/${workflowId}/toggle-public`, {
158
+ method: 'POST',
159
+ body: JSON.stringify({ is_public: isPublic }),
160
+ });
161
+ }
162
+ /**
163
+ * Favorite or unfavorite a workflow.
164
+ */
165
+ async favoriteWorkflow(workflowId, favorite) {
166
+ return this.request(`/workflows/${workflowId}/favorite`, {
167
+ method: 'POST',
168
+ body: JSON.stringify({ favorite }),
169
+ });
170
+ }
171
+ // ============================================
172
+ // Execution Enhancements (executions:manage scope)
173
+ // ============================================
174
+ /**
175
+ * Cancel a running execution.
176
+ */
177
+ async cancelExecution(executionId) {
178
+ return this.request(`/executions/${executionId}/cancel`, {
179
+ method: 'POST',
180
+ });
181
+ }
182
+ /**
183
+ * Retry a failed execution.
184
+ */
185
+ async retryExecution(executionId) {
186
+ return this.request(`/executions/${executionId}/retry`, {
187
+ method: 'POST',
188
+ });
189
+ }
190
+ /**
191
+ * Get SSE stream URL for execution (client handles actual streaming).
192
+ */
193
+ getExecutionStreamUrl(executionId) {
194
+ return `${this.hubUrl}/api/mcp/v1/executions/${executionId}/stream`;
195
+ }
196
+ /**
197
+ * Get auth token for SSE requests.
198
+ */
199
+ getAuthToken() {
200
+ return this.apiToken;
201
+ }
202
+ // ============================================
203
+ // Discovery & Organization (discovery:read scope)
204
+ // ============================================
205
+ /**
206
+ * Get workflow tags.
207
+ */
208
+ async getWorkflowTags(workflowId) {
209
+ return this.request(`/workflows/${workflowId}/tags`);
210
+ }
211
+ /**
212
+ * Set workflow tags.
213
+ */
214
+ async setWorkflowTags(workflowId, tags) {
215
+ return this.request(`/workflows/${workflowId}/tags`, {
216
+ method: 'POST',
217
+ body: JSON.stringify({ tags }),
218
+ });
219
+ }
220
+ /**
221
+ * Search workflows by name, description, or tags.
222
+ */
223
+ async searchWorkflows(query, tags, page) {
224
+ const params = new URLSearchParams();
225
+ params.set('q', query);
226
+ if (tags && tags.length > 0)
227
+ params.set('tags', tags.join(','));
228
+ if (page)
229
+ params.set('page', page.toString());
230
+ return this.request(`/workflows/search?${params.toString()}`);
231
+ }
232
+ /**
233
+ * Get public workflows from all users.
234
+ */
235
+ async getPublicWorkflows(page, sortBy) {
236
+ const params = new URLSearchParams();
237
+ if (page)
238
+ params.set('page', page.toString());
239
+ if (sortBy)
240
+ params.set('sort_by', sortBy);
241
+ const queryString = params.toString();
242
+ return this.request(`/workflows/public${queryString ? `?${queryString}` : ''}`);
243
+ }
244
+ // ============================================
245
+ // Workflow Building (workflows:build scope)
246
+ // ============================================
247
+ /**
248
+ * Create a new empty workflow.
249
+ */
250
+ async createWorkflow(name, description) {
251
+ return this.request('/workflows', {
252
+ method: 'POST',
253
+ body: JSON.stringify({ name, description }),
254
+ });
255
+ }
256
+ /**
257
+ * Delete a workflow.
258
+ */
259
+ async deleteWorkflow(workflowId) {
260
+ return this.request(`/workflows/${workflowId}`, {
261
+ method: 'DELETE',
262
+ });
263
+ }
264
+ /**
265
+ * Get the full graph (nodes and connections) of a workflow.
266
+ */
267
+ async getWorkflowGraph(workflowId) {
268
+ return this.request(`/workflows/${workflowId}/graph`);
269
+ }
270
+ /**
271
+ * Validate a workflow for errors.
272
+ */
273
+ async validateWorkflow(workflowId) {
274
+ return this.request(`/workflows/${workflowId}/validate`, {
275
+ method: 'POST',
276
+ });
277
+ }
278
+ // ============================================
279
+ // Node Operations (nodes:manage scope)
280
+ // ============================================
281
+ /**
282
+ * List all available node types.
283
+ * Note: Response may be an array or object depending on the API version.
284
+ */
285
+ async listAvailableNodes() {
286
+ return this.request('/node-types');
287
+ }
288
+ /**
289
+ * Get schema for a specific node type.
290
+ */
291
+ async getNodeSchema(nodeType) {
292
+ return this.request(`/node-types/${encodeURIComponent(nodeType)}/schema`);
293
+ }
294
+ /**
295
+ * Add a node to a workflow.
296
+ */
297
+ async addNode(workflowId, nodeType, position, properties) {
298
+ return this.request(`/workflows/${workflowId}/nodes`, {
299
+ method: 'POST',
300
+ body: JSON.stringify({ type: nodeType, position, properties }),
301
+ });
302
+ }
303
+ /**
304
+ * Update a node in a workflow.
305
+ */
306
+ async updateNode(workflowId, nodeId, updates) {
307
+ return this.request(`/workflows/${workflowId}/nodes/${nodeId}`, {
308
+ method: 'PUT',
309
+ body: JSON.stringify(updates),
310
+ });
311
+ }
312
+ /**
313
+ * Delete a node from a workflow.
314
+ */
315
+ async deleteNode(workflowId, nodeId) {
316
+ return this.request(`/workflows/${workflowId}/nodes/${nodeId}`, {
317
+ method: 'DELETE',
318
+ });
319
+ }
320
+ // ============================================
321
+ // Connection Operations (connections:manage scope)
322
+ // ============================================
323
+ /**
324
+ * Add a connection between nodes.
325
+ */
326
+ async addConnection(workflowId, sourceNodeId, sourceSocketId, targetNodeId, targetSocketId) {
327
+ return this.request(`/workflows/${workflowId}/connections`, {
328
+ method: 'POST',
329
+ body: JSON.stringify({
330
+ source_node_id: sourceNodeId,
331
+ source_socket_id: sourceSocketId,
332
+ target_node_id: targetNodeId,
333
+ target_socket_id: targetSocketId,
334
+ }),
335
+ });
336
+ }
337
+ /**
338
+ * Delete a connection from a workflow.
339
+ */
340
+ async deleteConnection(workflowId, connectionId) {
341
+ return this.request(`/workflows/${workflowId}/connections/${connectionId}`, {
342
+ method: 'DELETE',
343
+ });
344
+ }
345
+ /**
346
+ * Get all connections for a specific node.
347
+ */
348
+ async getNodeConnections(workflowId, nodeId) {
349
+ return this.request(`/workflows/${workflowId}/nodes/${nodeId}/connections`);
350
+ }
351
+ // ============================================
352
+ // Custom Node Operations (custom_nodes:read / custom_nodes:manage)
353
+ // ============================================
354
+ /**
355
+ * List user's own custom nodes.
356
+ */
357
+ async listCustomNodes(options) {
358
+ const params = new URLSearchParams();
359
+ if (options?.search)
360
+ params.set('search', options.search);
361
+ if (options?.category)
362
+ params.set('category', options.category);
363
+ if (options?.limit)
364
+ params.set('limit', options.limit.toString());
365
+ if (options?.page)
366
+ params.set('page', options.page.toString());
367
+ const queryString = params.toString();
368
+ return this.request(`/custom-nodes${queryString ? `?${queryString}` : ''}`);
369
+ }
370
+ /**
371
+ * Search public custom nodes.
372
+ */
373
+ async searchPublicCustomNodes(filters) {
374
+ const params = new URLSearchParams();
375
+ if (filters?.q)
376
+ params.set('q', filters.q);
377
+ if (filters?.category)
378
+ params.set('category', filters.category);
379
+ if (filters?.tags && filters.tags.length > 0)
380
+ params.set('tags', JSON.stringify(filters.tags));
381
+ if (filters?.verified_only)
382
+ params.set('verified_only', 'true');
383
+ if (filters?.sort)
384
+ params.set('sort', filters.sort);
385
+ if (filters?.limit)
386
+ params.set('limit', filters.limit.toString());
387
+ if (filters?.page)
388
+ params.set('page', filters.page.toString());
389
+ const queryString = params.toString();
390
+ return this.request(`/custom-nodes/search${queryString ? `?${queryString}` : ''}`);
391
+ }
392
+ /**
393
+ * Get a specific custom node with full details including script_code.
394
+ */
395
+ async getCustomNode(nodeId) {
396
+ return this.request(`/custom-nodes/${nodeId}`);
397
+ }
398
+ /**
399
+ * Get comments for a custom node.
400
+ */
401
+ async getCustomNodeComments(nodeId) {
402
+ return this.request(`/custom-nodes/${nodeId}/comments`);
403
+ }
404
+ /**
405
+ * Create a new custom node.
406
+ */
407
+ async createCustomNode(input) {
408
+ return this.request('/custom-nodes', {
409
+ method: 'POST',
410
+ body: JSON.stringify(input),
411
+ });
412
+ }
413
+ /**
414
+ * Update a custom node.
415
+ */
416
+ async updateCustomNode(nodeId, updates) {
417
+ return this.request(`/custom-nodes/${nodeId}`, {
418
+ method: 'PUT',
419
+ body: JSON.stringify(updates),
420
+ });
421
+ }
422
+ /**
423
+ * Delete a custom node.
424
+ */
425
+ async deleteCustomNode(nodeId) {
426
+ return this.request(`/custom-nodes/${nodeId}`, {
427
+ method: 'DELETE',
428
+ });
429
+ }
430
+ /**
431
+ * Copy a public custom node to user's library.
432
+ */
433
+ async copyCustomNode(nodeId, name) {
434
+ return this.request(`/custom-nodes/${nodeId}/copy`, {
435
+ method: 'POST',
436
+ body: JSON.stringify({ name }),
437
+ });
438
+ }
439
+ /**
440
+ * Toggle custom node visibility.
441
+ */
442
+ async toggleCustomNodeVisibility(nodeId, visibility) {
443
+ return this.request(`/custom-nodes/${nodeId}/visibility`, {
444
+ method: 'POST',
445
+ body: JSON.stringify({ visibility }),
446
+ });
447
+ }
448
+ /**
449
+ * Vote on a custom node.
450
+ */
451
+ async voteCustomNode(nodeId, vote) {
452
+ return this.request(`/custom-nodes/${nodeId}/vote`, {
453
+ method: 'POST',
454
+ body: JSON.stringify({ vote }),
455
+ });
456
+ }
457
+ /**
458
+ * Toggle favorite on a custom node.
459
+ */
460
+ async favoriteCustomNode(nodeId, favorite) {
461
+ return this.request(`/custom-nodes/${nodeId}/favorite`, {
462
+ method: 'POST',
463
+ body: JSON.stringify({ favorite }),
464
+ });
465
+ }
466
+ /**
467
+ * Add a comment to a custom node.
468
+ */
469
+ async addCustomNodeComment(nodeId, content, parentId) {
470
+ return this.request(`/custom-nodes/${nodeId}/comments`, {
471
+ method: 'POST',
472
+ body: JSON.stringify({ content, parent_id: parentId }),
473
+ });
474
+ }
475
+ // ============================================
476
+ // App Operations (apps:read / apps:manage)
477
+ // ============================================
478
+ /**
479
+ * List user's own apps.
480
+ */
481
+ async listApps(options) {
482
+ const params = new URLSearchParams();
483
+ if (options?.search)
484
+ params.set('search', options.search);
485
+ if (options?.category)
486
+ params.set('category', options.category);
487
+ if (options?.limit)
488
+ params.set('limit', options.limit.toString());
489
+ if (options?.page)
490
+ params.set('page', options.page.toString());
491
+ const queryString = params.toString();
492
+ return this.request(`/apps${queryString ? `?${queryString}` : ''}`);
493
+ }
494
+ /**
495
+ * Search public apps.
496
+ */
497
+ async searchPublicApps(filters) {
498
+ const params = new URLSearchParams();
499
+ if (filters?.q)
500
+ params.set('q', filters.q);
501
+ if (filters?.category)
502
+ params.set('category', filters.category);
503
+ if (filters?.tag)
504
+ params.set('tag', filters.tag);
505
+ if (filters?.mobile_compatible)
506
+ params.set('mobile_compatible', 'true');
507
+ if (filters?.sort)
508
+ params.set('sort', filters.sort);
509
+ if (filters?.limit)
510
+ params.set('limit', filters.limit.toString());
511
+ if (filters?.page)
512
+ params.set('page', filters.page.toString());
513
+ const queryString = params.toString();
514
+ return this.request(`/apps/search${queryString ? `?${queryString}` : ''}`);
515
+ }
516
+ /**
517
+ * Get app categories.
518
+ */
519
+ async getAppCategories() {
520
+ return this.request('/apps/categories');
521
+ }
522
+ /**
523
+ * Get popular app tags.
524
+ */
525
+ async getAppTags() {
526
+ return this.request('/apps/tags');
527
+ }
528
+ /**
529
+ * Get a specific app with full details including code.
530
+ */
531
+ async getApp(appId) {
532
+ return this.request(`/apps/${appId}`);
533
+ }
534
+ /**
535
+ * Get comments for an app.
536
+ */
537
+ async getAppComments(appId) {
538
+ return this.request(`/apps/${appId}/comments`);
539
+ }
540
+ /**
541
+ * Create a new app.
542
+ */
543
+ async createApp(input) {
544
+ return this.request('/apps', {
545
+ method: 'POST',
546
+ body: JSON.stringify(input),
547
+ });
548
+ }
549
+ /**
550
+ * Update an app.
551
+ */
552
+ async updateApp(appId, updates) {
553
+ return this.request(`/apps/${appId}`, {
554
+ method: 'PUT',
555
+ body: JSON.stringify(updates),
556
+ });
557
+ }
558
+ /**
559
+ * Delete an app.
560
+ */
561
+ async deleteApp(appId) {
562
+ return this.request(`/apps/${appId}`, {
563
+ method: 'DELETE',
564
+ });
565
+ }
566
+ /**
567
+ * Publish an app (make it public).
568
+ */
569
+ async publishApp(appId) {
570
+ return this.request(`/apps/${appId}/publish`, {
571
+ method: 'POST',
572
+ });
573
+ }
574
+ /**
575
+ * Unpublish an app (make it private).
576
+ */
577
+ async unpublishApp(appId) {
578
+ return this.request(`/apps/${appId}/unpublish`, {
579
+ method: 'POST',
580
+ });
581
+ }
582
+ /**
583
+ * Clone a public app to user's library.
584
+ */
585
+ async cloneApp(appId, name) {
586
+ return this.request(`/apps/${appId}/clone`, {
587
+ method: 'POST',
588
+ body: JSON.stringify({ name }),
589
+ });
590
+ }
591
+ /**
592
+ * Vote on an app.
593
+ */
594
+ async voteApp(appId, vote) {
595
+ return this.request(`/apps/${appId}/vote`, {
596
+ method: 'POST',
597
+ body: JSON.stringify({ vote }),
598
+ });
599
+ }
600
+ /**
601
+ * Toggle favorite on an app.
602
+ */
603
+ async favoriteApp(appId, favorite) {
604
+ return this.request(`/apps/${appId}/favorite`, {
605
+ method: 'POST',
606
+ body: JSON.stringify({ favorite }),
607
+ });
608
+ }
609
+ /**
610
+ * Add a comment to an app.
611
+ */
612
+ async addAppComment(appId, content, parentId) {
613
+ return this.request(`/apps/${appId}/comments`, {
614
+ method: 'POST',
615
+ body: JSON.stringify({ content, parent_id: parentId }),
616
+ });
617
+ }
618
+ /**
619
+ * Get workflows linked to an app.
620
+ */
621
+ async getAppWorkflows(appId) {
622
+ return this.request(`/apps/${appId}/workflows`);
623
+ }
624
+ /**
625
+ * Link a workflow to an app.
626
+ */
627
+ async linkAppWorkflow(appId, workflowHash, alias) {
628
+ return this.request(`/apps/${appId}/workflows`, {
629
+ method: 'POST',
630
+ body: JSON.stringify({ workflow_hash: workflowHash, alias }),
631
+ });
632
+ }
633
+ /**
634
+ * Unlink a workflow from an app.
635
+ */
636
+ async unlinkAppWorkflow(appId, workflowHash) {
637
+ return this.request(`/apps/${appId}/workflows/${workflowHash}`, {
638
+ method: 'DELETE',
639
+ });
640
+ }
641
+ // ============================================
642
+ // Sharing & Public URLs (sharing:read / sharing:manage)
643
+ // ============================================
644
+ /**
645
+ * Get the public URL for a workflow.
646
+ */
647
+ async getWorkflowPublicUrl(workflowId) {
648
+ return this.request(`/workflows/${workflowId}/public-url`);
649
+ }
650
+ /**
651
+ * List shared results for a workflow.
652
+ */
653
+ async listSharedResults(workflowId, options) {
654
+ const params = new URLSearchParams();
655
+ if (options?.sort)
656
+ params.set('sort', options.sort);
657
+ if (options?.limit)
658
+ params.set('limit', options.limit.toString());
659
+ if (options?.page)
660
+ params.set('page', options.page.toString());
661
+ const queryString = params.toString();
662
+ return this.request(`/workflows/${workflowId}/shared-results${queryString ? `?${queryString}` : ''}`);
663
+ }
664
+ /**
665
+ * Get a specific shared result.
666
+ */
667
+ async getSharedResult(workflowId, resultHash) {
668
+ return this.request(`/workflows/${workflowId}/shared-results/${resultHash}`);
669
+ }
670
+ /**
671
+ * Get comments for a shared result.
672
+ */
673
+ async getSharedResultComments(workflowId, resultHash) {
674
+ return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/comments`);
675
+ }
676
+ /**
677
+ * Create a shared result from an execution.
678
+ */
679
+ async createSharedResult(workflowId, input) {
680
+ return this.request(`/workflows/${workflowId}/shared-results`, {
681
+ method: 'POST',
682
+ body: JSON.stringify(input),
683
+ });
684
+ }
685
+ /**
686
+ * Add a comment to a workflow.
687
+ */
688
+ async addWorkflowComment(workflowId, content, parentId) {
689
+ return this.request(`/workflows/${workflowId}/comments`, {
690
+ method: 'POST',
691
+ body: JSON.stringify({ content, parent_id: parentId }),
692
+ });
693
+ }
694
+ /**
695
+ * Add a comment to a shared result.
696
+ */
697
+ async addSharedResultComment(workflowId, resultHash, content, parentId) {
698
+ return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/comments`, {
699
+ method: 'POST',
700
+ body: JSON.stringify({ content, parent_id: parentId }),
701
+ });
702
+ }
703
+ /**
704
+ * Vote on a workflow.
705
+ */
706
+ async voteWorkflow(workflowId, vote) {
707
+ return this.request(`/workflows/${workflowId}/vote`, {
708
+ method: 'POST',
709
+ body: JSON.stringify({ vote }),
710
+ });
711
+ }
712
+ /**
713
+ * Vote on a shared result.
714
+ */
715
+ async voteSharedResult(workflowId, resultHash, vote) {
716
+ return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/vote`, {
717
+ method: 'POST',
718
+ body: JSON.stringify({ vote }),
719
+ });
720
+ }
721
+ // ============================================
722
+ // Input Presets (presets:read / presets:manage)
723
+ // ============================================
724
+ /**
725
+ * List input presets for a workflow.
726
+ */
727
+ async listInputPresets(workflowId, options) {
728
+ const params = new URLSearchParams();
729
+ if (options?.sort)
730
+ params.set('sort', options.sort);
731
+ if (options?.limit)
732
+ params.set('limit', options.limit.toString());
733
+ if (options?.page)
734
+ params.set('page', options.page.toString());
735
+ const queryString = params.toString();
736
+ return this.request(`/workflows/${workflowId}/input-presets${queryString ? `?${queryString}` : ''}`);
737
+ }
738
+ /**
739
+ * Get a specific input preset.
740
+ */
741
+ async getInputPreset(workflowId, presetHash) {
742
+ return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`);
743
+ }
744
+ /**
745
+ * Create a new input preset.
746
+ */
747
+ async createInputPreset(workflowId, input) {
748
+ return this.request(`/workflows/${workflowId}/input-presets`, {
749
+ method: 'POST',
750
+ body: JSON.stringify(input),
751
+ });
752
+ }
753
+ /**
754
+ * Update an input preset.
755
+ */
756
+ async updateInputPreset(workflowId, presetHash, updates) {
757
+ return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`, {
758
+ method: 'PUT',
759
+ body: JSON.stringify(updates),
760
+ });
761
+ }
762
+ /**
763
+ * Delete an input preset.
764
+ */
765
+ async deleteInputPreset(workflowId, presetHash) {
766
+ return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`, {
767
+ method: 'DELETE',
768
+ });
769
+ }
770
+ /**
771
+ * Vote on an input preset.
772
+ */
773
+ async voteInputPreset(workflowId, presetHash, vote) {
774
+ return this.request(`/workflows/${workflowId}/input-presets/${presetHash}/vote`, {
775
+ method: 'POST',
776
+ body: JSON.stringify({ vote }),
777
+ });
778
+ }
779
+ /**
780
+ * Toggle community inputs (input presets) for a workflow.
781
+ */
782
+ async toggleCommunityInputs(workflowId, enabled) {
783
+ return this.request(`/workflows/${workflowId}/community-inputs`, {
784
+ method: 'POST',
785
+ body: JSON.stringify({ enabled }),
786
+ });
787
+ }
788
+ }
789
+ //# sourceMappingURL=api-client.js.map