flowengine-mcp-app 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -113
- package/build/client.d.ts +8 -3
- package/build/client.d.ts.map +1 -1
- package/build/client.js +32 -5
- package/build/client.js.map +1 -1
- package/build/index.d.ts +7 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +186 -336
- package/build/index.js.map +1 -1
- package/package.json +3 -2
package/build/index.js
CHANGED
|
@@ -1,201 +1,124 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* FlowEngine MCP
|
|
4
|
-
*
|
|
3
|
+
* FlowEngine MCP Server
|
|
4
|
+
* Manage your white-label automation platform from Claude
|
|
5
|
+
*
|
|
6
|
+
* Core Features:
|
|
7
|
+
* 1. Instance Management - Provision and manage FlowEngine instances
|
|
8
|
+
* 2. Client Portals - Monitor and access client portals
|
|
9
|
+
* 3. AI FlowBuilder - Create forms, chatbots, and UI components
|
|
5
10
|
*/
|
|
6
11
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
12
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
-
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema,
|
|
13
|
+
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
14
|
import { FlowEngineClient } from './client.js';
|
|
10
15
|
import { renderPortalsDashboard, renderPortalDetails } from './ui/portals.js';
|
|
11
|
-
import { renderWorkflowsManager, renderWorkflowDetails } from './ui/workflows.js';
|
|
12
16
|
import { renderWidgetBuilder, renderWidgetDetails } from './ui/widgets.js';
|
|
13
17
|
import { renderInstancesManager, renderInstanceDetails } from './ui/instances.js';
|
|
14
|
-
import { renderDemoShowcase } from './ui/demo.js';
|
|
15
18
|
import { renderError } from './ui/base.js';
|
|
16
|
-
//
|
|
19
|
+
// Environment configuration
|
|
17
20
|
const API_KEY = process.env.FLOWENGINE_API_KEY;
|
|
18
21
|
const BASE_URL = process.env.FLOWENGINE_BASE_URL || 'https://flowengine.cloud';
|
|
19
|
-
// Initialize FlowEngine client
|
|
22
|
+
// Initialize FlowEngine client
|
|
20
23
|
const flowengine = API_KEY ? new FlowEngineClient({
|
|
21
24
|
apiKey: API_KEY,
|
|
22
25
|
baseUrl: BASE_URL,
|
|
23
26
|
}) : null;
|
|
24
|
-
// Helper to check if client is available
|
|
25
27
|
function ensureClient() {
|
|
26
28
|
if (!flowengine) {
|
|
27
|
-
throw new Error('FlowEngine API key not configured.
|
|
29
|
+
throw new Error('FlowEngine API key not configured. Set FLOWENGINE_API_KEY in your MCP config.');
|
|
28
30
|
}
|
|
29
31
|
return flowengine;
|
|
30
32
|
}
|
|
31
33
|
const server = new Server({
|
|
32
34
|
name: 'flowengine-mcp',
|
|
33
|
-
version: '
|
|
35
|
+
version: '1.0.0',
|
|
34
36
|
}, {
|
|
35
37
|
capabilities: {
|
|
36
38
|
resources: {},
|
|
37
39
|
tools: {},
|
|
38
|
-
prompts: {},
|
|
39
40
|
},
|
|
40
41
|
});
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
+
* Interactive UI Resources
|
|
43
44
|
*/
|
|
44
45
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
45
46
|
return {
|
|
46
47
|
resources: [
|
|
47
48
|
{
|
|
48
|
-
uri: '
|
|
49
|
-
name: 'n8n Demo & Templates',
|
|
50
|
-
description: 'Explore pre-built workflows and automation templates',
|
|
51
|
-
mimeType: 'text/html',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
uri: 'app://flowengine/portals',
|
|
49
|
+
uri: 'ui://flowengine/portals',
|
|
55
50
|
name: 'Client Portals',
|
|
56
|
-
description: 'View and manage your client portals
|
|
57
|
-
mimeType: 'text/html',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
uri: 'app://flowengine/workflows',
|
|
61
|
-
name: 'Workflows',
|
|
62
|
-
description: 'Manage automation workflows',
|
|
63
|
-
mimeType: 'text/html',
|
|
51
|
+
description: 'View and manage your client portals',
|
|
52
|
+
mimeType: 'text/html;profile=mcp-app',
|
|
64
53
|
},
|
|
65
54
|
{
|
|
66
|
-
uri: '
|
|
67
|
-
name: '
|
|
68
|
-
description: '
|
|
69
|
-
mimeType: 'text/html',
|
|
55
|
+
uri: 'ui://flowengine/ui-builder',
|
|
56
|
+
name: 'AI FlowBuilder',
|
|
57
|
+
description: 'Build forms, chatbots, and UI components with AI',
|
|
58
|
+
mimeType: 'text/html;profile=mcp-app',
|
|
70
59
|
},
|
|
71
60
|
{
|
|
72
|
-
uri: '
|
|
73
|
-
name: '
|
|
61
|
+
uri: 'ui://flowengine/instances',
|
|
62
|
+
name: 'Instance Manager',
|
|
74
63
|
description: 'Manage FlowEngine instances and hosting',
|
|
75
|
-
mimeType: 'text/html',
|
|
64
|
+
mimeType: 'text/html;profile=mcp-app',
|
|
76
65
|
},
|
|
77
66
|
],
|
|
78
67
|
};
|
|
79
68
|
});
|
|
80
69
|
/**
|
|
81
|
-
*
|
|
70
|
+
* Render Resources
|
|
82
71
|
*/
|
|
83
72
|
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
84
73
|
const uri = request.params.uri;
|
|
85
74
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
contents: [
|
|
90
|
-
{
|
|
91
|
-
uri,
|
|
92
|
-
mimeType: 'text/html',
|
|
93
|
-
text: html,
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (uri === 'app://flowengine/portals') {
|
|
75
|
+
// Client Portals Dashboard
|
|
76
|
+
if (uri === 'ui://flowengine/portals') {
|
|
99
77
|
const instances = await ensureClient().getClientInstances();
|
|
100
78
|
const html = renderPortalsDashboard(instances);
|
|
101
79
|
return {
|
|
102
|
-
contents: [
|
|
103
|
-
{
|
|
104
|
-
uri,
|
|
105
|
-
mimeType: 'text/html',
|
|
106
|
-
text: html,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
if (uri === 'app://flowengine/workflows') {
|
|
112
|
-
const workflows = await ensureClient().getWorkflows();
|
|
113
|
-
const html = renderWorkflowsManager(workflows);
|
|
114
|
-
return {
|
|
115
|
-
contents: [
|
|
116
|
-
{
|
|
117
|
-
uri,
|
|
118
|
-
mimeType: 'text/html',
|
|
119
|
-
text: html,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
80
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
122
81
|
};
|
|
123
82
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const html = renderWidgetBuilder(widgets);
|
|
127
|
-
return {
|
|
128
|
-
contents: [
|
|
129
|
-
{
|
|
130
|
-
uri,
|
|
131
|
-
mimeType: 'text/html',
|
|
132
|
-
text: html,
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
if (uri === 'app://flowengine/hosting') {
|
|
138
|
-
const instances = await ensureClient().getInstances();
|
|
139
|
-
const html = renderInstancesManager(instances);
|
|
140
|
-
return {
|
|
141
|
-
contents: [
|
|
142
|
-
{
|
|
143
|
-
uri,
|
|
144
|
-
mimeType: 'text/html',
|
|
145
|
-
text: html,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
// Handle detail views with query parameters
|
|
151
|
-
if (uri.startsWith('app://flowengine/portal/')) {
|
|
83
|
+
// Portal Details
|
|
84
|
+
if (uri.startsWith('ui://flowengine/portal/')) {
|
|
152
85
|
const instanceId = uri.split('/').pop() || '';
|
|
153
86
|
const client = ensureClient();
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
]);
|
|
87
|
+
// Fetch data sequentially to avoid API concurrency issues
|
|
88
|
+
const workflows = await client.getClientPanelWorkflows(instanceId);
|
|
89
|
+
const widgets = await client.getClientPanelWidgets(instanceId);
|
|
158
90
|
const html = renderPortalDetails(instanceId, workflows, widgets);
|
|
159
91
|
return {
|
|
160
|
-
contents: [
|
|
161
|
-
{
|
|
162
|
-
uri,
|
|
163
|
-
mimeType: 'text/html',
|
|
164
|
-
text: html,
|
|
165
|
-
},
|
|
166
|
-
],
|
|
92
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
167
93
|
};
|
|
168
94
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
const html = renderWorkflowDetails(workflow, executions);
|
|
95
|
+
// AI FlowBuilder (UI Components)
|
|
96
|
+
if (uri === 'ui://flowengine/ui-builder') {
|
|
97
|
+
const widgets = await ensureClient().getWidgets();
|
|
98
|
+
const html = renderWidgetBuilder(widgets);
|
|
174
99
|
return {
|
|
175
|
-
contents: [
|
|
176
|
-
{
|
|
177
|
-
uri,
|
|
178
|
-
mimeType: 'text/html',
|
|
179
|
-
text: html,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
100
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
182
101
|
};
|
|
183
102
|
}
|
|
184
|
-
|
|
103
|
+
// Widget Details
|
|
104
|
+
if (uri.startsWith('ui://flowengine/widget/')) {
|
|
185
105
|
const widgetId = uri.split('/').pop() || '';
|
|
186
106
|
const widget = await ensureClient().getWidget(widgetId);
|
|
187
107
|
const html = renderWidgetDetails(widget);
|
|
188
108
|
return {
|
|
189
|
-
contents: [
|
|
190
|
-
{
|
|
191
|
-
uri,
|
|
192
|
-
mimeType: 'text/html',
|
|
193
|
-
text: html,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
109
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
196
110
|
};
|
|
197
111
|
}
|
|
198
|
-
|
|
112
|
+
// Instance Manager
|
|
113
|
+
if (uri === 'ui://flowengine/instances') {
|
|
114
|
+
const instances = await ensureClient().getInstances();
|
|
115
|
+
const html = renderInstancesManager(instances);
|
|
116
|
+
return {
|
|
117
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Instance Details
|
|
121
|
+
if (uri.startsWith('ui://flowengine/instance/')) {
|
|
199
122
|
const instanceId = uri.split('/').pop() || '';
|
|
200
123
|
const instances = await ensureClient().getInstances();
|
|
201
124
|
const instance = instances.find((i) => i.id === instanceId);
|
|
@@ -205,122 +128,130 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
205
128
|
const status = await ensureClient().getInstanceStatus(instanceId);
|
|
206
129
|
const html = renderInstanceDetails(instance, status);
|
|
207
130
|
return {
|
|
208
|
-
contents: [
|
|
209
|
-
{
|
|
210
|
-
uri,
|
|
211
|
-
mimeType: 'text/html',
|
|
212
|
-
text: html,
|
|
213
|
-
},
|
|
214
|
-
],
|
|
131
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
215
132
|
};
|
|
216
133
|
}
|
|
217
|
-
throw new Error(`Unknown resource
|
|
134
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
218
135
|
}
|
|
219
136
|
catch (error) {
|
|
220
137
|
const html = renderError(error.message || 'An error occurred');
|
|
221
138
|
return {
|
|
222
|
-
contents: [
|
|
223
|
-
{
|
|
224
|
-
uri,
|
|
225
|
-
mimeType: 'text/html',
|
|
226
|
-
text: html,
|
|
227
|
-
},
|
|
228
|
-
],
|
|
139
|
+
contents: [{ uri, mimeType: 'text/html', text: html }],
|
|
229
140
|
};
|
|
230
141
|
}
|
|
231
142
|
});
|
|
232
143
|
/**
|
|
233
|
-
*
|
|
144
|
+
* Available Tools
|
|
234
145
|
*/
|
|
235
146
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
236
147
|
return {
|
|
237
148
|
tools: [
|
|
238
|
-
//
|
|
149
|
+
// Instance Management Tools
|
|
239
150
|
{
|
|
240
|
-
name: '
|
|
241
|
-
description: '
|
|
151
|
+
name: 'flowengine_list_instances',
|
|
152
|
+
description: 'List all FlowEngine instances you have access to',
|
|
242
153
|
inputSchema: {
|
|
243
154
|
type: 'object',
|
|
244
|
-
properties: {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
enabled: {
|
|
250
|
-
type: 'boolean',
|
|
251
|
-
description: 'Whether to enable (true) or disable (false) the workflow',
|
|
252
|
-
},
|
|
155
|
+
properties: {},
|
|
156
|
+
},
|
|
157
|
+
_meta: {
|
|
158
|
+
ui: {
|
|
159
|
+
resourceUri: 'ui://flowengine/instances',
|
|
253
160
|
},
|
|
254
|
-
required: ['workflowId', 'enabled'],
|
|
255
161
|
},
|
|
256
162
|
},
|
|
257
163
|
{
|
|
258
|
-
name: '
|
|
259
|
-
description: '
|
|
164
|
+
name: 'flowengine_get_instance_status',
|
|
165
|
+
description: 'Get health and status information for a specific instance',
|
|
260
166
|
inputSchema: {
|
|
261
167
|
type: 'object',
|
|
262
168
|
properties: {
|
|
263
169
|
instanceId: {
|
|
264
170
|
type: 'string',
|
|
265
|
-
description: '
|
|
171
|
+
description: 'The instance ID to check',
|
|
266
172
|
},
|
|
267
173
|
},
|
|
174
|
+
required: ['instanceId'],
|
|
268
175
|
},
|
|
269
176
|
},
|
|
270
177
|
{
|
|
271
|
-
name: '
|
|
272
|
-
description: '
|
|
178
|
+
name: 'flowengine_create_instance',
|
|
179
|
+
description: 'Provision a new FlowEngine instance for a client',
|
|
273
180
|
inputSchema: {
|
|
274
181
|
type: 'object',
|
|
275
182
|
properties: {
|
|
276
|
-
|
|
277
|
-
type: '
|
|
278
|
-
description: '
|
|
183
|
+
data: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
description: 'Instance configuration with client info and settings',
|
|
279
186
|
},
|
|
280
187
|
},
|
|
281
|
-
required: ['
|
|
188
|
+
required: ['data'],
|
|
282
189
|
},
|
|
283
190
|
},
|
|
284
|
-
// Instance tools
|
|
285
191
|
{
|
|
286
|
-
name: '
|
|
287
|
-
description: '
|
|
192
|
+
name: 'flowengine_update_instance',
|
|
193
|
+
description: 'Update instance settings and configuration',
|
|
288
194
|
inputSchema: {
|
|
289
195
|
type: 'object',
|
|
290
|
-
properties: {
|
|
196
|
+
properties: {
|
|
197
|
+
data: {
|
|
198
|
+
type: 'object',
|
|
199
|
+
description: 'Updated instance configuration',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
required: ['data'],
|
|
291
203
|
},
|
|
292
204
|
},
|
|
293
205
|
{
|
|
294
|
-
name: '
|
|
295
|
-
description: '
|
|
206
|
+
name: 'flowengine_delete_instance',
|
|
207
|
+
description: 'Permanently delete a FlowEngine instance',
|
|
296
208
|
inputSchema: {
|
|
297
209
|
type: 'object',
|
|
298
210
|
properties: {
|
|
299
211
|
instanceId: {
|
|
300
212
|
type: 'string',
|
|
301
|
-
description: 'The instance ID',
|
|
213
|
+
description: 'The instance ID to delete',
|
|
302
214
|
},
|
|
303
215
|
},
|
|
304
216
|
required: ['instanceId'],
|
|
305
217
|
},
|
|
306
218
|
},
|
|
307
|
-
//
|
|
219
|
+
// Portal Tools
|
|
220
|
+
{
|
|
221
|
+
name: 'flowengine_list_portals',
|
|
222
|
+
description: 'List all client portals and their access URLs',
|
|
223
|
+
inputSchema: {
|
|
224
|
+
type: 'object',
|
|
225
|
+
properties: {},
|
|
226
|
+
},
|
|
227
|
+
_meta: {
|
|
228
|
+
ui: {
|
|
229
|
+
resourceUri: 'ui://flowengine/portals',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
// UI Component Tools (AI FlowBuilder)
|
|
308
234
|
{
|
|
309
|
-
name: '
|
|
310
|
-
description: 'List all forms, chatbots,
|
|
235
|
+
name: 'flowengine_list_components',
|
|
236
|
+
description: 'List all UI components (forms, chatbots, widgets)',
|
|
311
237
|
inputSchema: {
|
|
312
238
|
type: 'object',
|
|
313
239
|
properties: {
|
|
314
240
|
instanceId: {
|
|
315
241
|
type: 'string',
|
|
316
|
-
description: 'Optional instance ID
|
|
242
|
+
description: 'Optional: Filter by instance ID',
|
|
317
243
|
},
|
|
318
244
|
},
|
|
319
245
|
},
|
|
246
|
+
_meta: {
|
|
247
|
+
ui: {
|
|
248
|
+
resourceUri: 'ui://flowengine/ui-builder',
|
|
249
|
+
},
|
|
250
|
+
},
|
|
320
251
|
},
|
|
321
252
|
{
|
|
322
253
|
name: 'flowengine_get_component',
|
|
323
|
-
description: 'Get
|
|
254
|
+
description: 'Get detailed configuration for a specific UI component',
|
|
324
255
|
inputSchema: {
|
|
325
256
|
type: 'object',
|
|
326
257
|
properties: {
|
|
@@ -332,141 +263,144 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
332
263
|
required: ['componentId'],
|
|
333
264
|
},
|
|
334
265
|
},
|
|
335
|
-
// Portal tools
|
|
336
|
-
{
|
|
337
|
-
name: 'flowengine_list_portals',
|
|
338
|
-
description: 'List all client portals',
|
|
339
|
-
inputSchema: {
|
|
340
|
-
type: 'object',
|
|
341
|
-
properties: {},
|
|
342
|
-
},
|
|
343
|
-
},
|
|
344
|
-
// Template tools
|
|
345
266
|
{
|
|
346
|
-
name: '
|
|
347
|
-
description: '
|
|
267
|
+
name: 'flowengine_create_component',
|
|
268
|
+
description: 'Create a new UI component using AI FlowBuilder (form, chatbot, or widget)',
|
|
348
269
|
inputSchema: {
|
|
349
270
|
type: 'object',
|
|
350
|
-
properties: {
|
|
271
|
+
properties: {
|
|
272
|
+
data: {
|
|
273
|
+
type: 'object',
|
|
274
|
+
description: 'Component configuration with type, name, and settings',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
required: ['data'],
|
|
351
278
|
},
|
|
352
279
|
},
|
|
353
280
|
{
|
|
354
|
-
name: '
|
|
355
|
-
description: '
|
|
281
|
+
name: 'flowengine_update_component',
|
|
282
|
+
description: 'Update an existing UI component configuration',
|
|
356
283
|
inputSchema: {
|
|
357
284
|
type: 'object',
|
|
358
285
|
properties: {
|
|
359
|
-
|
|
286
|
+
componentId: {
|
|
360
287
|
type: 'string',
|
|
361
|
-
description: 'The
|
|
288
|
+
description: 'The component ID to update',
|
|
362
289
|
},
|
|
363
|
-
|
|
364
|
-
type: '
|
|
365
|
-
description: '
|
|
290
|
+
data: {
|
|
291
|
+
type: 'object',
|
|
292
|
+
description: 'Updated component configuration',
|
|
366
293
|
},
|
|
367
294
|
},
|
|
368
|
-
required: ['
|
|
295
|
+
required: ['componentId', 'data'],
|
|
369
296
|
},
|
|
370
297
|
},
|
|
371
298
|
{
|
|
372
|
-
name: '
|
|
373
|
-
description: '
|
|
299
|
+
name: 'flowengine_delete_component',
|
|
300
|
+
description: 'Delete a UI component',
|
|
374
301
|
inputSchema: {
|
|
375
302
|
type: 'object',
|
|
376
303
|
properties: {
|
|
377
|
-
|
|
378
|
-
type: 'string',
|
|
379
|
-
description: 'The instance ID to create the workflow in',
|
|
380
|
-
},
|
|
381
|
-
workflowJSON: {
|
|
382
|
-
type: 'object',
|
|
383
|
-
description: 'The workflow JSON definition',
|
|
384
|
-
},
|
|
385
|
-
workflowTitle: {
|
|
304
|
+
componentId: {
|
|
386
305
|
type: 'string',
|
|
387
|
-
description: '
|
|
306
|
+
description: 'The component ID to delete',
|
|
388
307
|
},
|
|
389
308
|
},
|
|
390
|
-
required: ['
|
|
309
|
+
required: ['componentId'],
|
|
391
310
|
},
|
|
392
311
|
},
|
|
393
312
|
],
|
|
394
313
|
};
|
|
395
314
|
});
|
|
396
315
|
/**
|
|
397
|
-
* Handle
|
|
316
|
+
* Handle Tool Calls
|
|
398
317
|
*/
|
|
399
318
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
400
319
|
const { name, arguments: args } = request.params;
|
|
401
320
|
try {
|
|
402
321
|
switch (name) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
const workflowId = args.workflowId;
|
|
407
|
-
const enabled = args.enabled;
|
|
408
|
-
const result = await ensureClient().toggleWorkflow(workflowId, enabled);
|
|
322
|
+
// Instance Management
|
|
323
|
+
case 'flowengine_list_instances': {
|
|
324
|
+
const instances = await ensureClient().getInstances();
|
|
409
325
|
return {
|
|
410
326
|
content: [
|
|
411
327
|
{
|
|
412
328
|
type: 'text',
|
|
413
|
-
text:
|
|
329
|
+
text: JSON.stringify(instances, null, 2),
|
|
414
330
|
},
|
|
415
331
|
],
|
|
416
332
|
};
|
|
417
333
|
}
|
|
418
|
-
case '
|
|
419
|
-
|
|
420
|
-
|
|
334
|
+
case 'flowengine_get_instance_status': {
|
|
335
|
+
if (!args)
|
|
336
|
+
throw new Error('Missing arguments');
|
|
337
|
+
const instanceId = args.instanceId;
|
|
338
|
+
const status = await ensureClient().getInstanceStatus(instanceId);
|
|
421
339
|
return {
|
|
422
340
|
content: [
|
|
423
341
|
{
|
|
424
342
|
type: 'text',
|
|
425
|
-
text: JSON.stringify(
|
|
343
|
+
text: JSON.stringify(status, null, 2),
|
|
426
344
|
},
|
|
427
345
|
],
|
|
428
346
|
};
|
|
429
347
|
}
|
|
430
|
-
case '
|
|
348
|
+
case 'flowengine_create_instance': {
|
|
431
349
|
if (!args)
|
|
432
350
|
throw new Error('Missing arguments');
|
|
433
|
-
const
|
|
434
|
-
const
|
|
351
|
+
const data = args.data;
|
|
352
|
+
const result = await ensureClient().provisionInstance(data);
|
|
435
353
|
return {
|
|
436
354
|
content: [
|
|
437
355
|
{
|
|
438
356
|
type: 'text',
|
|
439
|
-
text:
|
|
357
|
+
text: `Instance created successfully. ID: ${result.instanceId || result.id || 'N/A'}`,
|
|
440
358
|
},
|
|
441
359
|
],
|
|
442
360
|
};
|
|
443
361
|
}
|
|
444
|
-
case '
|
|
445
|
-
|
|
362
|
+
case 'flowengine_update_instance': {
|
|
363
|
+
if (!args)
|
|
364
|
+
throw new Error('Missing arguments');
|
|
365
|
+
const data = args.data;
|
|
366
|
+
await ensureClient().updateInstance(data);
|
|
446
367
|
return {
|
|
447
368
|
content: [
|
|
448
369
|
{
|
|
449
370
|
type: 'text',
|
|
450
|
-
text:
|
|
371
|
+
text: 'Instance updated successfully',
|
|
451
372
|
},
|
|
452
373
|
],
|
|
453
374
|
};
|
|
454
375
|
}
|
|
455
|
-
case '
|
|
376
|
+
case 'flowengine_delete_instance': {
|
|
456
377
|
if (!args)
|
|
457
378
|
throw new Error('Missing arguments');
|
|
458
379
|
const instanceId = args.instanceId;
|
|
459
|
-
|
|
380
|
+
await ensureClient().deleteInstance(instanceId);
|
|
460
381
|
return {
|
|
461
382
|
content: [
|
|
462
383
|
{
|
|
463
384
|
type: 'text',
|
|
464
|
-
text:
|
|
385
|
+
text: 'Instance deleted successfully',
|
|
465
386
|
},
|
|
466
387
|
],
|
|
467
388
|
};
|
|
468
389
|
}
|
|
469
|
-
|
|
390
|
+
// Portals
|
|
391
|
+
case 'flowengine_list_portals': {
|
|
392
|
+
const portals = await ensureClient().getClientInstances();
|
|
393
|
+
return {
|
|
394
|
+
content: [
|
|
395
|
+
{
|
|
396
|
+
type: 'text',
|
|
397
|
+
text: JSON.stringify(portals, null, 2),
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
// UI Components (AI FlowBuilder)
|
|
403
|
+
case 'flowengine_list_components': {
|
|
470
404
|
const instanceId = args ? args.instanceId : undefined;
|
|
471
405
|
const widgets = await ensureClient().getWidgets(instanceId);
|
|
472
406
|
return {
|
|
@@ -492,59 +426,45 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
492
426
|
],
|
|
493
427
|
};
|
|
494
428
|
}
|
|
495
|
-
case '
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
type: 'text',
|
|
501
|
-
text: JSON.stringify(portals, null, 2),
|
|
502
|
-
},
|
|
503
|
-
],
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
case 'flowengine_list_templates': {
|
|
507
|
-
const templates = await ensureClient().listTemplates();
|
|
429
|
+
case 'flowengine_create_component': {
|
|
430
|
+
if (!args)
|
|
431
|
+
throw new Error('Missing arguments');
|
|
432
|
+
const data = args.data;
|
|
433
|
+
const result = await ensureClient().createWidget(data);
|
|
508
434
|
return {
|
|
509
435
|
content: [
|
|
510
436
|
{
|
|
511
437
|
type: 'text',
|
|
512
|
-
text:
|
|
438
|
+
text: `Component created successfully. ID: ${result.id || result.widgetId || 'N/A'}`,
|
|
513
439
|
},
|
|
514
440
|
],
|
|
515
441
|
};
|
|
516
442
|
}
|
|
517
|
-
case '
|
|
443
|
+
case 'flowengine_update_component': {
|
|
518
444
|
if (!args)
|
|
519
445
|
throw new Error('Missing arguments');
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
|
|
446
|
+
const componentId = args.componentId;
|
|
447
|
+
const data = args.data;
|
|
448
|
+
await ensureClient().updateWidget(componentId, data);
|
|
523
449
|
return {
|
|
524
450
|
content: [
|
|
525
451
|
{
|
|
526
452
|
type: 'text',
|
|
527
|
-
text:
|
|
453
|
+
text: 'Component updated successfully',
|
|
528
454
|
},
|
|
529
455
|
],
|
|
530
456
|
};
|
|
531
457
|
}
|
|
532
|
-
case '
|
|
458
|
+
case 'flowengine_delete_component': {
|
|
533
459
|
if (!args)
|
|
534
460
|
throw new Error('Missing arguments');
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
const workflowTitle = args.workflowTitle;
|
|
538
|
-
const result = await ensureClient().importWorkflowToInstance({
|
|
539
|
-
instanceId,
|
|
540
|
-
workflowJSON,
|
|
541
|
-
workflowTitle,
|
|
542
|
-
});
|
|
461
|
+
const componentId = args.componentId;
|
|
462
|
+
await ensureClient().deleteWidget(componentId);
|
|
543
463
|
return {
|
|
544
464
|
content: [
|
|
545
465
|
{
|
|
546
466
|
type: 'text',
|
|
547
|
-
text:
|
|
467
|
+
text: 'Component deleted successfully',
|
|
548
468
|
},
|
|
549
469
|
],
|
|
550
470
|
};
|
|
@@ -566,82 +486,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
566
486
|
}
|
|
567
487
|
});
|
|
568
488
|
/**
|
|
569
|
-
*
|
|
570
|
-
*/
|
|
571
|
-
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
572
|
-
return {
|
|
573
|
-
prompts: [
|
|
574
|
-
{
|
|
575
|
-
name: 'check_workflow_status',
|
|
576
|
-
description: 'Check the status of your workflows',
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
name: 'view_recent_executions',
|
|
580
|
-
description: 'View recent workflow executions',
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
name: 'manage_portals',
|
|
584
|
-
description: 'Manage your client portals',
|
|
585
|
-
},
|
|
586
|
-
],
|
|
587
|
-
};
|
|
588
|
-
});
|
|
589
|
-
/**
|
|
590
|
-
* Handle prompt requests
|
|
591
|
-
*/
|
|
592
|
-
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
593
|
-
const { name } = request.params;
|
|
594
|
-
switch (name) {
|
|
595
|
-
case 'check_workflow_status':
|
|
596
|
-
return {
|
|
597
|
-
description: 'Check the status of your workflows',
|
|
598
|
-
messages: [
|
|
599
|
-
{
|
|
600
|
-
role: 'user',
|
|
601
|
-
content: {
|
|
602
|
-
type: 'text',
|
|
603
|
-
text: 'Please show me the status of all my workflows and highlight any that are inactive or having issues.',
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
],
|
|
607
|
-
};
|
|
608
|
-
case 'view_recent_executions':
|
|
609
|
-
return {
|
|
610
|
-
description: 'View recent workflow executions',
|
|
611
|
-
messages: [
|
|
612
|
-
{
|
|
613
|
-
role: 'user',
|
|
614
|
-
content: {
|
|
615
|
-
type: 'text',
|
|
616
|
-
text: 'Show me the most recent workflow executions and highlight any failures.',
|
|
617
|
-
},
|
|
618
|
-
},
|
|
619
|
-
],
|
|
620
|
-
};
|
|
621
|
-
case 'manage_portals':
|
|
622
|
-
return {
|
|
623
|
-
description: 'Manage your client portals',
|
|
624
|
-
messages: [
|
|
625
|
-
{
|
|
626
|
-
role: 'user',
|
|
627
|
-
content: {
|
|
628
|
-
type: 'text',
|
|
629
|
-
text: 'Show me all my client portals and their current status.',
|
|
630
|
-
},
|
|
631
|
-
},
|
|
632
|
-
],
|
|
633
|
-
};
|
|
634
|
-
default:
|
|
635
|
-
throw new Error(`Unknown prompt: ${name}`);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
/**
|
|
639
|
-
* Start the server
|
|
489
|
+
* Start Server
|
|
640
490
|
*/
|
|
641
491
|
async function main() {
|
|
642
492
|
const transport = new StdioServerTransport();
|
|
643
493
|
await server.connect(transport);
|
|
644
|
-
console.error('FlowEngine MCP
|
|
494
|
+
console.error('FlowEngine MCP Server running');
|
|
645
495
|
}
|
|
646
496
|
main().catch((error) => {
|
|
647
497
|
console.error('Fatal error:', error);
|