@prompteryx/mcp-server 1.0.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 +271 -0
- package/dist/auth/api-key-auth.d.ts +51 -0
- package/dist/auth/api-key-auth.d.ts.map +1 -0
- package/dist/auth/api-key-auth.js +50 -0
- package/dist/auth/api-key-auth.js.map +1 -0
- package/dist/auth/usage-enforcer.d.ts +40 -0
- package/dist/auth/usage-enforcer.d.ts.map +1 -0
- package/dist/auth/usage-enforcer.js +134 -0
- package/dist/auth/usage-enforcer.js.map +1 -0
- package/dist/execution/cloud-executor.d.ts +16 -0
- package/dist/execution/cloud-executor.d.ts.map +1 -0
- package/dist/execution/cloud-executor.js +225 -0
- package/dist/execution/cloud-executor.js.map +1 -0
- package/dist/execution/integration-executor.d.ts +18 -0
- package/dist/execution/integration-executor.d.ts.map +1 -0
- package/dist/execution/integration-executor.js +101 -0
- package/dist/execution/integration-executor.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/workflow-resources.d.ts +16 -0
- package/dist/resources/workflow-resources.d.ts.map +1 -0
- package/dist/resources/workflow-resources.js +79 -0
- package/dist/resources/workflow-resources.js.map +1 -0
- package/dist/server.d.ts +28 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +104 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/ai-browser-tools.d.ts +21 -0
- package/dist/tools/ai-browser-tools.d.ts.map +1 -0
- package/dist/tools/ai-browser-tools.js +88 -0
- package/dist/tools/ai-browser-tools.js.map +1 -0
- package/dist/tools/browser-session-manager.d.ts +75 -0
- package/dist/tools/browser-session-manager.d.ts.map +1 -0
- package/dist/tools/browser-session-manager.js +206 -0
- package/dist/tools/browser-session-manager.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +20 -0
- package/dist/tools/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser-tools.js +270 -0
- package/dist/tools/browser-tools.js.map +1 -0
- package/dist/tools/data-tools.d.ts +9 -0
- package/dist/tools/data-tools.d.ts.map +1 -0
- package/dist/tools/data-tools.js +110 -0
- package/dist/tools/data-tools.js.map +1 -0
- package/dist/tools/integration-tools.d.ts +29 -0
- package/dist/tools/integration-tools.d.ts.map +1 -0
- package/dist/tools/integration-tools.js +214 -0
- package/dist/tools/integration-tools.js.map +1 -0
- package/dist/tools/workflow-builder-tools.d.ts +20 -0
- package/dist/tools/workflow-builder-tools.d.ts.map +1 -0
- package/dist/tools/workflow-builder-tools.js +95 -0
- package/dist/tools/workflow-builder-tools.js.map +1 -0
- package/dist/tools/workflow-tools.d.ts +16 -0
- package/dist/tools/workflow-tools.d.ts.map +1 -0
- package/dist/tools/workflow-tools.js +128 -0
- package/dist/tools/workflow-tools.js.map +1 -0
- package/dist/utils/node-config-loader.d.ts +54 -0
- package/dist/utils/node-config-loader.d.ts.map +1 -0
- package/dist/utils/node-config-loader.js +105 -0
- package/dist/utils/node-config-loader.js.map +1 -0
- package/dist/utils/output-formatter.d.ts +37 -0
- package/dist/utils/output-formatter.d.ts.map +1 -0
- package/dist/utils/output-formatter.js +62 -0
- package/dist/utils/output-formatter.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Tools (Dynamic Registry)
|
|
3
|
+
*
|
|
4
|
+
* Auto-generates MCP tools from NODE_CONFIGS integration entries.
|
|
5
|
+
* When new integration nodes are added to the platform, they
|
|
6
|
+
* automatically appear as MCP tools—no MCP code changes needed.
|
|
7
|
+
*
|
|
8
|
+
* Only registers tools for services where the user has valid credentials.
|
|
9
|
+
*/
|
|
10
|
+
import { enforceUsageLimits, recordUsage, formatUsageRemaining } from '../auth/usage-enforcer.js';
|
|
11
|
+
import { executeIntegration } from '../execution/integration-executor.js';
|
|
12
|
+
import { fetchIntegrationConfigs, buildToolSchema, nodeTypeToToolName, } from '../utils/node-config-loader.js';
|
|
13
|
+
import { formatError } from '../utils/output-formatter.js';
|
|
14
|
+
/**
|
|
15
|
+
* Known service→connectorId mappings.
|
|
16
|
+
* Used to filter tools based on the user's connected credentials.
|
|
17
|
+
*/
|
|
18
|
+
const SERVICE_CONNECTOR_MAP = {
|
|
19
|
+
gmail: 'gmail',
|
|
20
|
+
'google-sheets': 'google-sheets',
|
|
21
|
+
'google-calendar': 'google-calendar',
|
|
22
|
+
'google-docs': 'google-docs',
|
|
23
|
+
'google-drive': 'google-drive',
|
|
24
|
+
slack: 'slack',
|
|
25
|
+
telegram: 'telegram',
|
|
26
|
+
whatsapp: 'whatsapp',
|
|
27
|
+
facebook: 'facebook',
|
|
28
|
+
instagram: 'instagram',
|
|
29
|
+
youtube: 'youtube',
|
|
30
|
+
wordpress: 'wordpress',
|
|
31
|
+
airtable: 'airtable',
|
|
32
|
+
notion: 'notion',
|
|
33
|
+
stripe: 'stripe',
|
|
34
|
+
'microsoft-outlook': 'microsoft-outlook',
|
|
35
|
+
'microsoft-excel': 'microsoft-excel',
|
|
36
|
+
'microsoft-word': 'microsoft-word',
|
|
37
|
+
'microsoft-sharepoint': 'microsoft-sharepoint',
|
|
38
|
+
'microsoft-teams': 'microsoft-teams',
|
|
39
|
+
openai: 'openai',
|
|
40
|
+
anthropic: 'anthropic',
|
|
41
|
+
gemini: 'gemini',
|
|
42
|
+
elevenlabs: 'elevenlabs',
|
|
43
|
+
};
|
|
44
|
+
function getServiceFromNodeType(nodeType) {
|
|
45
|
+
for (const svc of Object.keys(SERVICE_CONNECTOR_MAP)) {
|
|
46
|
+
if (nodeType.startsWith(svc))
|
|
47
|
+
return svc;
|
|
48
|
+
}
|
|
49
|
+
return nodeType.split('-')[0];
|
|
50
|
+
}
|
|
51
|
+
function hasCredentialForService(credentials, service) {
|
|
52
|
+
const connectorId = SERVICE_CONNECTOR_MAP[service];
|
|
53
|
+
if (!connectorId)
|
|
54
|
+
return true; // Unknown services: don't filter out
|
|
55
|
+
return credentials.some((c) => c.connectorId === connectorId && c.isValid);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Registers integration tools dynamically.
|
|
59
|
+
*
|
|
60
|
+
* This is called once during server setup. It registers tools based on:
|
|
61
|
+
* 1. Available integration configs from the platform
|
|
62
|
+
* 2. User's connected OAuth credentials
|
|
63
|
+
*
|
|
64
|
+
* For the MCP protocol, tools are registered statically at connection
|
|
65
|
+
* init, so we scope to all service types the user has credentials for.
|
|
66
|
+
*/
|
|
67
|
+
export async function registerIntegrationTools(server, ctx) {
|
|
68
|
+
const auth = ctx.getAuth();
|
|
69
|
+
const credentials = auth.credentials ?? [];
|
|
70
|
+
// Fetch the integration configs from the platform
|
|
71
|
+
let configs = await fetchIntegrationConfigs(ctx.apiKey, ctx.apiUrl);
|
|
72
|
+
// If the API doesn't return configs yet, use a hardcoded fallback set
|
|
73
|
+
if (configs.length === 0) {
|
|
74
|
+
configs = getBuiltinIntegrationConfigs();
|
|
75
|
+
}
|
|
76
|
+
// Filter: only register tools where the user has credentials
|
|
77
|
+
const eligibleConfigs = configs.filter((config) => {
|
|
78
|
+
const service = getServiceFromNodeType(config.type);
|
|
79
|
+
return hasCredentialForService(credentials, service);
|
|
80
|
+
});
|
|
81
|
+
let registered = 0;
|
|
82
|
+
for (const config of eligibleConfigs) {
|
|
83
|
+
const toolName = nodeTypeToToolName(config.type);
|
|
84
|
+
const description = config.description || `${config.label} integration`;
|
|
85
|
+
// Build Zod schema from the config's param definitions
|
|
86
|
+
let schema;
|
|
87
|
+
try {
|
|
88
|
+
schema = buildToolSchema(config);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Skip configs that can't produce a valid schema
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
server.tool(toolName, description, schema.shape, async (params) => {
|
|
95
|
+
const check = enforceUsageLimits(ctx.getAuth(), 'integration');
|
|
96
|
+
if (!check.allowed) {
|
|
97
|
+
return formatError(check.reason, undefined, { usageRemaining: formatUsageRemaining(ctx.getAuth()) });
|
|
98
|
+
}
|
|
99
|
+
const result = await executeIntegration({
|
|
100
|
+
apiKey: ctx.apiKey,
|
|
101
|
+
apiUrl: ctx.apiUrl,
|
|
102
|
+
nodeType: config.type,
|
|
103
|
+
params,
|
|
104
|
+
credentialId: params.credentialId,
|
|
105
|
+
});
|
|
106
|
+
// Record execution
|
|
107
|
+
await recordUsage(ctx.apiKey, ctx.apiUrl, { executionCount: 1 });
|
|
108
|
+
return result;
|
|
109
|
+
});
|
|
110
|
+
registered++;
|
|
111
|
+
}
|
|
112
|
+
return registered;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Fallback: minimal set of integration configs if the API isn't reachable.
|
|
116
|
+
* These cover the most common operations users expect.
|
|
117
|
+
*/
|
|
118
|
+
function getBuiltinIntegrationConfigs() {
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
type: 'gmail-message-send',
|
|
122
|
+
label: 'Gmail: Send Email',
|
|
123
|
+
description: 'Send an email via Gmail. Supports HTML body, CC, BCC, and attachments.',
|
|
124
|
+
category: 'Integrations',
|
|
125
|
+
credentials: ['gmail'],
|
|
126
|
+
defaultParams: {},
|
|
127
|
+
paramSchema: {
|
|
128
|
+
to: { type: 'string', label: 'To', description: 'Recipient email address', required: true },
|
|
129
|
+
subject: { type: 'string', label: 'Subject', description: 'Email subject line', required: true },
|
|
130
|
+
body: { type: 'textarea', label: 'Body', description: 'Email body (plain text or HTML)' },
|
|
131
|
+
cc: { type: 'string', label: 'CC', description: 'CC recipients (comma-separated)' },
|
|
132
|
+
bcc: { type: 'string', label: 'BCC', description: 'BCC recipients (comma-separated)' },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'gmail-message-list',
|
|
137
|
+
label: 'Gmail: List Emails',
|
|
138
|
+
description: 'Search and list emails from your Gmail inbox.',
|
|
139
|
+
category: 'Integrations',
|
|
140
|
+
credentials: ['gmail'],
|
|
141
|
+
defaultParams: {},
|
|
142
|
+
paramSchema: {
|
|
143
|
+
query: { type: 'string', label: 'Search Query', description: 'Gmail search query (e.g. "is:unread from:user@example.com")' },
|
|
144
|
+
maxResults: { type: 'number', label: 'Max Results', description: 'Maximum emails to return', default: 10 },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'google-sheets-row-append',
|
|
149
|
+
label: 'Google Sheets: Append Row',
|
|
150
|
+
description: 'Append a row of data to a Google Sheets spreadsheet.',
|
|
151
|
+
category: 'Integrations',
|
|
152
|
+
credentials: ['google-sheets'],
|
|
153
|
+
defaultParams: {},
|
|
154
|
+
paramSchema: {
|
|
155
|
+
spreadsheetId: { type: 'string', label: 'Spreadsheet ID', description: 'Google Sheets spreadsheet ID', required: true },
|
|
156
|
+
sheetName: { type: 'string', label: 'Sheet Name', description: 'Tab/sheet name', default: 'Sheet1' },
|
|
157
|
+
values: { type: 'json', label: 'Row Values', description: 'Array of cell values to append', required: true },
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: 'google-sheets-data-read',
|
|
162
|
+
label: 'Google Sheets: Read Data',
|
|
163
|
+
description: 'Read data from a Google Sheets spreadsheet.',
|
|
164
|
+
category: 'Integrations',
|
|
165
|
+
credentials: ['google-sheets'],
|
|
166
|
+
defaultParams: {},
|
|
167
|
+
paramSchema: {
|
|
168
|
+
spreadsheetId: { type: 'string', label: 'Spreadsheet ID', description: 'Google Sheets spreadsheet ID', required: true },
|
|
169
|
+
range: { type: 'string', label: 'Range', description: 'Cell range (e.g. "A1:D10")', default: 'A:Z' },
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
type: 'slack-message-send',
|
|
174
|
+
label: 'Slack: Send Message',
|
|
175
|
+
description: 'Send a message to a Slack channel or user.',
|
|
176
|
+
category: 'Integrations',
|
|
177
|
+
credentials: ['slack'],
|
|
178
|
+
defaultParams: {},
|
|
179
|
+
paramSchema: {
|
|
180
|
+
channel: { type: 'string', label: 'Channel', description: 'Channel name or ID (e.g. "#general" or "C01234567")', required: true },
|
|
181
|
+
text: { type: 'textarea', label: 'Message', description: 'Message text (supports Slack markdown)', required: true },
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
type: 'google-calendar-event-create',
|
|
186
|
+
label: 'Google Calendar: Create Event',
|
|
187
|
+
description: 'Create a new event on Google Calendar.',
|
|
188
|
+
category: 'Integrations',
|
|
189
|
+
credentials: ['google-calendar'],
|
|
190
|
+
defaultParams: {},
|
|
191
|
+
paramSchema: {
|
|
192
|
+
summary: { type: 'string', label: 'Title', description: 'Event title', required: true },
|
|
193
|
+
start: { type: 'string', label: 'Start', description: 'Start time (ISO 8601)', required: true },
|
|
194
|
+
end: { type: 'string', label: 'End', description: 'End time (ISO 8601)', required: true },
|
|
195
|
+
description: { type: 'textarea', label: 'Description', description: 'Event description' },
|
|
196
|
+
location: { type: 'string', label: 'Location', description: 'Event location' },
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'notion-page-create',
|
|
201
|
+
label: 'Notion: Create Page',
|
|
202
|
+
description: 'Create a new page in a Notion database.',
|
|
203
|
+
category: 'Integrations',
|
|
204
|
+
credentials: ['notion'],
|
|
205
|
+
defaultParams: {},
|
|
206
|
+
paramSchema: {
|
|
207
|
+
databaseId: { type: 'string', label: 'Database ID', description: 'Notion database ID', required: true },
|
|
208
|
+
properties: { type: 'json', label: 'Properties', description: 'Page properties as JSON object', required: true },
|
|
209
|
+
content: { type: 'textarea', label: 'Content', description: 'Page body content (markdown)' },
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=integration-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-tools.js","sourceRoot":"","sources":["../../src/tools/integration-tools.ts"],"names":[],"mappings":"AAAA;;;;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AAE,QAAQ,EAAE,IAAI,EAAE;gBAChH,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,8BAA8B,EAAE;aAC7F;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Builder Tools (Unique Feature)
|
|
3
|
+
*
|
|
4
|
+
* Allows building visual Prompteryx workflows from within an MCP client.
|
|
5
|
+
* No other MCP server offers this capability.
|
|
6
|
+
*
|
|
7
|
+
* Tools:
|
|
8
|
+
* - workflow_add_node: Add a node to an existing workflow
|
|
9
|
+
* - workflow_record_actions: Start/stop/save browser action recording
|
|
10
|
+
*/
|
|
11
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
|
+
import type { AuthContext } from '../auth/api-key-auth.js';
|
|
13
|
+
interface WorkflowBuilderContext {
|
|
14
|
+
getAuth: () => AuthContext;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
apiUrl: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function registerWorkflowBuilderTools(server: McpServer, ctx: WorkflowBuilderContext): void;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=workflow-builder-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-builder-tools.d.ts","sourceRoot":"","sources":["../../src/tools/workflow-builder-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,WAAW,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAoBD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,sBAAsB,QAmF1F"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Builder Tools (Unique Feature)
|
|
3
|
+
*
|
|
4
|
+
* Allows building visual Prompteryx workflows from within an MCP client.
|
|
5
|
+
* No other MCP server offers this capability.
|
|
6
|
+
*
|
|
7
|
+
* Tools:
|
|
8
|
+
* - workflow_add_node: Add a node to an existing workflow
|
|
9
|
+
* - workflow_record_actions: Start/stop/save browser action recording
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { getTierFeatures } from '../auth/usage-enforcer.js';
|
|
13
|
+
import { formatSuccess, formatError } from '../utils/output-formatter.js';
|
|
14
|
+
async function apiCall(ctx, method, path, body) {
|
|
15
|
+
const res = await fetch(`${ctx.apiUrl}${path}`, {
|
|
16
|
+
method,
|
|
17
|
+
headers: {
|
|
18
|
+
'X-API-Key': ctx.apiKey,
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
22
|
+
});
|
|
23
|
+
const data = await res.json().catch(() => ({}));
|
|
24
|
+
return { ok: res.ok, status: res.status, data };
|
|
25
|
+
}
|
|
26
|
+
export function registerWorkflowBuilderTools(server, ctx) {
|
|
27
|
+
// workflow_add_node
|
|
28
|
+
server.tool('workflow_add_node', 'Add a node to an existing Prompteryx workflow. Specify the node type, parameters, and optionally which node to connect after.', {
|
|
29
|
+
workflowId: z.string().describe('The workflow ID to add the node to'),
|
|
30
|
+
nodeType: z.string().describe('Node type (e.g. "click", "fill", "gmail-message-send")'),
|
|
31
|
+
label: z.string().describe('Display label for this step'),
|
|
32
|
+
params: z.record(z.any()).describe('Node parameters'),
|
|
33
|
+
afterNodeId: z.string().optional().describe('Connect this node after the specified node ID'),
|
|
34
|
+
}, async (params) => {
|
|
35
|
+
const features = getTierFeatures(ctx.getAuth().subscriptionTier);
|
|
36
|
+
if (!features.workflowCreate) {
|
|
37
|
+
return formatError('Workflow editing requires Starter plan or higher.');
|
|
38
|
+
}
|
|
39
|
+
const { ok, data } = await apiCall(ctx, 'POST', `/api/v1/workflows/${params.workflowId}/nodes`, {
|
|
40
|
+
nodeType: params.nodeType,
|
|
41
|
+
label: params.label,
|
|
42
|
+
params: params.params,
|
|
43
|
+
afterNodeId: params.afterNodeId,
|
|
44
|
+
});
|
|
45
|
+
if (!ok)
|
|
46
|
+
return formatError(data.error?.message ?? 'Failed to add node');
|
|
47
|
+
return formatSuccess({
|
|
48
|
+
added: true,
|
|
49
|
+
nodeId: data.data?.nodeId ?? data.nodeId,
|
|
50
|
+
workflowId: params.workflowId,
|
|
51
|
+
editUrl: `${ctx.apiUrl}/studio?workflow=${params.workflowId}`,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
// workflow_record_actions
|
|
55
|
+
server.tool('workflow_record_actions', 'Record browser actions during a session and save them as a reusable Prompteryx workflow. Actions: "start" begins recording, "stop" ends recording and shows a summary, "save" saves the recorded actions as a workflow.', {
|
|
56
|
+
action: z.enum(['start', 'stop', 'save']).describe('"start" to begin recording, "stop" to end and see summary, "save" to save as a workflow'),
|
|
57
|
+
workflowName: z.string().optional().describe('Name for the saved workflow (required for "save" action)'),
|
|
58
|
+
}, async (params) => {
|
|
59
|
+
const features = getTierFeatures(ctx.getAuth().subscriptionTier);
|
|
60
|
+
if (!features.recordToWorkflow) {
|
|
61
|
+
return formatError('Action recording requires Starter plan or higher.');
|
|
62
|
+
}
|
|
63
|
+
const { ok, data } = await apiCall(ctx, 'POST', '/api/v1/recordings', {
|
|
64
|
+
action: params.action,
|
|
65
|
+
workflowName: params.workflowName,
|
|
66
|
+
});
|
|
67
|
+
if (!ok)
|
|
68
|
+
return formatError(data.error?.message ?? `Recording ${params.action} failed`);
|
|
69
|
+
switch (params.action) {
|
|
70
|
+
case 'start':
|
|
71
|
+
return formatSuccess({
|
|
72
|
+
recording: true,
|
|
73
|
+
message: 'Recording started. Perform browser actions, then call workflow_record_actions with action "stop".',
|
|
74
|
+
});
|
|
75
|
+
case 'stop':
|
|
76
|
+
return formatSuccess({
|
|
77
|
+
recording: false,
|
|
78
|
+
actionsRecorded: data.data?.actionsCount ?? 0,
|
|
79
|
+
actions: data.data?.actions ?? [],
|
|
80
|
+
message: 'Recording stopped. Call workflow_record_actions with action "save" and a workflowName to save.',
|
|
81
|
+
});
|
|
82
|
+
case 'save':
|
|
83
|
+
return formatSuccess({
|
|
84
|
+
saved: true,
|
|
85
|
+
workflowId: data.data?.workflowId ?? data.workflowId,
|
|
86
|
+
name: params.workflowName,
|
|
87
|
+
message: 'Recorded actions saved as a workflow. Run it anytime with workflow_execute — no AI costs!',
|
|
88
|
+
editUrl: `${ctx.apiUrl}/studio?workflow=${data.data?.workflowId ?? data.workflowId}`,
|
|
89
|
+
});
|
|
90
|
+
default:
|
|
91
|
+
return formatError('Invalid action. Use "start", "stop", or "save".');
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=workflow-builder-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-builder-tools.js","sourceRoot":"","sources":["../../src/tools/workflow-builder-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQ1E,KAAK,UAAU,OAAO,CACpB,GAA2B,EAC3B,MAAc,EACd,IAAY,EACZ,IAAU;IAEV,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE;QAC9C,MAAM;QACN,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,CAAC,MAAM;YACvB,cAAc,EAAE,kBAAkB;SACnC;QACD,GAA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BAAoB,EAAE;YACpE,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE;YAAE,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,aAAa,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;QAExF,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,OAAO;gBACV,OAAO,aAAa,CAAC;oBACnB,SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,mGAAmG;iBAC7G,CAAC,CAAC;YACL,KAAK,MAAM;gBACT,OAAO,aAAa,CAAC;oBACnB,SAAS,EAAE,KAAK;oBAChB,eAAe,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,IAAI,CAAC;oBAC7C,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;oBACjC,OAAO,EAAE,gGAAgG;iBAC1G,CAAC,CAAC;YACL,KAAK,MAAM;gBACT,OAAO,aAAa,CAAC;oBACnB,KAAK,EAAE,IAAI;oBACX,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC,UAAU;oBACpD,IAAI,EAAE,MAAM,CAAC,YAAY;oBACzB,OAAO,EAAE,2FAA2F;oBACpG,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,oBAAoB,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE;iBACrF,CAAC,CAAC;YACL;gBACE,OAAO,WAAW,CAAC,iDAAiD,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Tools
|
|
3
|
+
*
|
|
4
|
+
* CRUD and execution tools for Prompteryx visual workflows.
|
|
5
|
+
* Calls the platform's REST API for all operations.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
import type { AuthContext } from '../auth/api-key-auth.js';
|
|
9
|
+
interface WorkflowToolsContext {
|
|
10
|
+
getAuth: () => AuthContext;
|
|
11
|
+
apiKey: string;
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function registerWorkflowTools(server: McpServer, ctx: WorkflowToolsContext): void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=workflow-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-tools.d.ts","sourceRoot":"","sources":["../../src/tools/workflow-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,WAAW,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAoBD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,oBAAoB,QAwIjF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Tools
|
|
3
|
+
*
|
|
4
|
+
* CRUD and execution tools for Prompteryx visual workflows.
|
|
5
|
+
* Calls the platform's REST API for all operations.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { enforceUsageLimits, recordUsage, formatUsageRemaining } from '../auth/usage-enforcer.js';
|
|
9
|
+
import { formatSuccess, formatError } from '../utils/output-formatter.js';
|
|
10
|
+
async function apiCall(ctx, method, path, body) {
|
|
11
|
+
const res = await fetch(`${ctx.apiUrl}${path}`, {
|
|
12
|
+
method,
|
|
13
|
+
headers: {
|
|
14
|
+
'X-API-Key': ctx.apiKey,
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
},
|
|
17
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
18
|
+
});
|
|
19
|
+
const data = await res.json().catch(() => ({}));
|
|
20
|
+
return { ok: res.ok, status: res.status, data };
|
|
21
|
+
}
|
|
22
|
+
export function registerWorkflowTools(server, ctx) {
|
|
23
|
+
// workflow_list
|
|
24
|
+
server.tool('workflow_list', 'List all your saved Prompteryx workflows.', {}, async () => {
|
|
25
|
+
const auth = ctx.getAuth();
|
|
26
|
+
const workflows = auth.workflows ?? [];
|
|
27
|
+
if (workflows.length === 0) {
|
|
28
|
+
return formatSuccess({ workflows: [], message: 'No workflows found. Create one with workflow_create.' });
|
|
29
|
+
}
|
|
30
|
+
return formatSuccess({
|
|
31
|
+
workflows: workflows.map((w) => ({
|
|
32
|
+
id: w.id,
|
|
33
|
+
name: w.name,
|
|
34
|
+
description: w.description,
|
|
35
|
+
nodeCount: w.nodeCount,
|
|
36
|
+
lastRun: w.lastRun,
|
|
37
|
+
})),
|
|
38
|
+
count: workflows.length,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
// workflow_get
|
|
42
|
+
server.tool('workflow_get', 'Get details of a specific workflow including its nodes and configuration.', { workflowId: z.string().describe('The workflow ID') }, async ({ workflowId }) => {
|
|
43
|
+
const { ok, data } = await apiCall(ctx, 'GET', `/api/v1/workflows/${workflowId}`);
|
|
44
|
+
if (!ok)
|
|
45
|
+
return formatError(data.error?.message ?? 'Failed to fetch workflow');
|
|
46
|
+
return formatSuccess(data.data ?? data);
|
|
47
|
+
});
|
|
48
|
+
// workflow_execute
|
|
49
|
+
server.tool('workflow_execute', 'Execute a saved Prompteryx workflow by ID. Returns execution results when complete.', {
|
|
50
|
+
workflowId: z.string().describe('The workflow ID to execute'),
|
|
51
|
+
variables: z.record(z.any()).optional().describe('Variables to pass to the workflow'),
|
|
52
|
+
runMode: z.enum(['visible', 'headless']).optional().describe('Browser visibility mode'),
|
|
53
|
+
timeout: z.number().optional().describe('Execution timeout in ms (default: 300000)'),
|
|
54
|
+
}, async (params) => {
|
|
55
|
+
const check = enforceUsageLimits(ctx.getAuth(), 'workflow');
|
|
56
|
+
if (!check.allowed) {
|
|
57
|
+
return formatError(check.reason, undefined, { usageRemaining: formatUsageRemaining(ctx.getAuth()) });
|
|
58
|
+
}
|
|
59
|
+
const { ok, data } = await apiCall(ctx, 'POST', `/api/v1/workflows/${params.workflowId}/execute`, {
|
|
60
|
+
variables: params.variables,
|
|
61
|
+
options: {
|
|
62
|
+
runMode: params.runMode ?? 'headless',
|
|
63
|
+
timeout: params.timeout ?? 300000,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
if (!ok)
|
|
67
|
+
return formatError(data.error?.message ?? 'Workflow execution failed');
|
|
68
|
+
// Record execution
|
|
69
|
+
await recordUsage(ctx.apiKey, ctx.apiUrl, { executionCount: 1 });
|
|
70
|
+
return formatSuccess({
|
|
71
|
+
executionId: data.data?.executionId ?? data.executionId,
|
|
72
|
+
status: data.data?.status ?? 'completed',
|
|
73
|
+
results: data.data?.results ?? data.results,
|
|
74
|
+
message: 'Workflow executed successfully',
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
// workflow_create
|
|
78
|
+
server.tool('workflow_create', 'Create a new Prompteryx workflow. You can either provide explicit nodes or describe what you want and AI will design it.', {
|
|
79
|
+
name: z.string().describe('Name for the workflow'),
|
|
80
|
+
description: z.string().optional().describe('Description of what the workflow does'),
|
|
81
|
+
nodes: z.array(z.object({
|
|
82
|
+
type: z.string().describe('Node type (e.g. "open-page", "click", "gmail-message-send")'),
|
|
83
|
+
label: z.string().describe('Display label for this step'),
|
|
84
|
+
params: z.record(z.any()).describe('Node parameters'),
|
|
85
|
+
})).optional().describe('Explicit node definitions'),
|
|
86
|
+
buildFromDescription: z.string().optional().describe('Natural language description — AI will design the workflow'),
|
|
87
|
+
}, async (params) => {
|
|
88
|
+
const features = ctx.getAuth().subscriptionTier;
|
|
89
|
+
if (features === 'free') {
|
|
90
|
+
return formatError('Workflow creation requires a Starter plan or higher. Upgrade at prompteryx.ai/pricing.');
|
|
91
|
+
}
|
|
92
|
+
if (params.buildFromDescription) {
|
|
93
|
+
const { ok, data } = await apiCall(ctx, 'POST', '/api/ai-workflow', {
|
|
94
|
+
description: params.buildFromDescription,
|
|
95
|
+
workflowName: params.name,
|
|
96
|
+
});
|
|
97
|
+
if (!ok)
|
|
98
|
+
return formatError(data.error?.message ?? 'AI workflow builder failed');
|
|
99
|
+
return formatSuccess({
|
|
100
|
+
workflowId: data.data?.workflowId ?? data.workflowId,
|
|
101
|
+
name: params.name,
|
|
102
|
+
message: 'Workflow created by AI. View and edit it in the Prompteryx Visual Studio.',
|
|
103
|
+
editUrl: `${ctx.apiUrl}/studio?workflow=${data.data?.workflowId ?? data.workflowId}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const { ok, data } = await apiCall(ctx, 'POST', '/api/v1/workflows', {
|
|
107
|
+
name: params.name,
|
|
108
|
+
description: params.description,
|
|
109
|
+
nodes: params.nodes,
|
|
110
|
+
});
|
|
111
|
+
if (!ok)
|
|
112
|
+
return formatError(data.error?.message ?? 'Workflow creation failed');
|
|
113
|
+
return formatSuccess({
|
|
114
|
+
workflowId: data.data?.workflowId ?? data.workflowId,
|
|
115
|
+
name: params.name,
|
|
116
|
+
message: 'Workflow created. You can execute it with workflow_execute or edit it in the Visual Studio.',
|
|
117
|
+
editUrl: `${ctx.apiUrl}/studio?workflow=${data.data?.workflowId ?? data.workflowId}`,
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
// workflow_delete
|
|
121
|
+
server.tool('workflow_delete', 'Delete a workflow from your account.', { workflowId: z.string().describe('The workflow ID to delete') }, async ({ workflowId }) => {
|
|
122
|
+
const { ok, data } = await apiCall(ctx, 'DELETE', `/api/v1/workflows/${workflowId}`);
|
|
123
|
+
if (!ok)
|
|
124
|
+
return formatError(data.error?.message ?? 'Failed to delete workflow');
|
|
125
|
+
return formatSuccess({ deleted: true, workflowId });
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=workflow-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-tools.js","sourceRoot":"","sources":["../../src/tools/workflow-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQ1E,KAAK,UAAU,OAAO,CACpB,GAAyB,EACzB,MAAc,EACd,IAAY,EACZ,IAAU;IAEV,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE;QAC9C,MAAM;QACN,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,CAAC,MAAM;YACvB,cAAc,EAAE,kBAAkB;SACnC;QACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,GAAyB;IAEhF,gBAAgB;IAChB,MAAM,CAAC,IAAI,CACT,eAAe,EACf,2CAA2C,EAC3C,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,I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EAAE,GAAG,GAAG,CAAC,MAAM,oBAAoB,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE;SACrF,CAAC,CAAC;IACL,CAAC,CACF,CAAC;IAEF,kBAAkB;IAClB,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,sCAAsC,EACtC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,EAChE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,UAAU,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,EAAE;YAAE,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,2BAA2B,CAAC,CAAC;QAChF,OAAO,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACtD,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Config → Zod Schema Converter
|
|
3
|
+
*
|
|
4
|
+
* Converts Prompteryx ParamDefinition objects from NODE_CONFIGS into
|
|
5
|
+
* Zod schemas suitable for MCP tool registration.
|
|
6
|
+
* Fetches configs from the platform API so the MCP server
|
|
7
|
+
* stays in sync without bundling the full config.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export interface ParamDef {
|
|
11
|
+
type: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
displayName?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
default?: any;
|
|
17
|
+
options?: Array<{
|
|
18
|
+
label?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
value: any;
|
|
21
|
+
}>;
|
|
22
|
+
min?: number;
|
|
23
|
+
max?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface IntegrationNodeConfig {
|
|
26
|
+
type: string;
|
|
27
|
+
label: string;
|
|
28
|
+
description: string;
|
|
29
|
+
category: string;
|
|
30
|
+
credentials?: string[];
|
|
31
|
+
paramSchema: Record<string, ParamDef>;
|
|
32
|
+
defaultParams: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetches integration node configs from the platform API.
|
|
36
|
+
* Falls back to empty array if unavailable.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchIntegrationConfigs(apiKey: string, apiUrl: string): Promise<IntegrationNodeConfig[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a ParamDefinition from NODE_CONFIGS into a Zod schema.
|
|
41
|
+
* Handles string, number, boolean, select, textarea, json, etc.
|
|
42
|
+
*/
|
|
43
|
+
export declare function paramDefToZod(name: string, def: ParamDef): z.ZodTypeAny;
|
|
44
|
+
/**
|
|
45
|
+
* Builds a Zod object schema from an integration node's paramSchema.
|
|
46
|
+
* Filters out display-only params (notice, heading) and internal params.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildToolSchema(config: IntegrationNodeConfig): z.ZodObject<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Generates a clean MCP tool name from a node type.
|
|
51
|
+
* e.g. "gmail-message-send" → "gmail_message_send"
|
|
52
|
+
*/
|
|
53
|
+
export declare function nodeTypeToToolName(type: string): string;
|
|
54
|
+
//# sourceMappingURL=node-config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/node-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAA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