@daxaur/ctrl-mcp 0.1.4 → 0.1.6
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/dist/blocks.d.ts +269 -70
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +202 -38
- package/dist/blocks.js.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +15 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +170 -0
- package/dist/install.js.map +1 -0
- package/dist/tools/create-workflow.d.ts +8 -68
- package/dist/tools/create-workflow.d.ts.map +1 -1
- package/dist/tools/get-block-catalog.d.ts +49 -0
- package/dist/tools/get-block-catalog.d.ts.map +1 -0
- package/dist/tools/get-block-catalog.js +84 -0
- package/dist/tools/get-block-catalog.js.map +1 -0
- package/package.json +1 -1
package/dist/blocks.d.ts
CHANGED
|
@@ -1,101 +1,300 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Block catalog schemas — mirrors
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Block catalog schemas — mirrors only the LIVE production blocks visible in
|
|
3
|
+
* ctrl.build/terminal. Anything marked hidden in block-definitions.ts, or
|
|
4
|
+
* defined there without a keeper executor, is intentionally excluded.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Live block count: 9 triggers · 5 actions · 4 conditions · 3 utilities = 21.
|
|
7
|
+
*
|
|
8
|
+
* NOT exposed (and why):
|
|
9
|
+
* - limitless.* + polymarket.* — hidden in block-definitions.ts
|
|
10
|
+
* - social.farcaster_cast — hidden, NEYNAR_API_KEY not in prod
|
|
11
|
+
* - signal.aixbt_mention — hidden, cookie.fun mirror not wired
|
|
12
|
+
* - cond.yield_threshold — hidden, no DefiLlama eval
|
|
13
|
+
* - util.stop / util.snapshot — no keeper case, silently no-op
|
|
14
|
+
*
|
|
15
|
+
* Keep in sync with main repo. Agents can call ctrl_get_block_catalog for the
|
|
16
|
+
* live list if this falls behind.
|
|
7
17
|
*/
|
|
8
18
|
import { z } from 'zod';
|
|
9
19
|
export declare const TRIGGER_TYPES: readonly ["time.interval", "trigger.manual", "price.above", "price.below", "price.change", "pool.created", "watch.whale", "event.transfer", "event.balance"];
|
|
10
20
|
export declare const ACTION_TYPES: readonly ["cypher.swap", "read.balance", "notify.telegram", "notify.discord", "util.webhook"];
|
|
11
21
|
export declare const CONDITION_TYPES: readonly ["cond.price", "cond.balance", "cond.allowed_weekdays", "cond.time_window"];
|
|
12
|
-
export declare const UTILITY_TYPES: readonly ["util.delay", "util.note", "util.log"
|
|
22
|
+
export declare const UTILITY_TYPES: readonly ["util.delay", "util.note", "util.log"];
|
|
13
23
|
export type TriggerType = (typeof TRIGGER_TYPES)[number];
|
|
14
24
|
export type ActionType = (typeof ACTION_TYPES)[number];
|
|
15
25
|
export type ConditionType = (typeof CONDITION_TYPES)[number];
|
|
16
26
|
export type UtilityType = (typeof UTILITY_TYPES)[number];
|
|
17
|
-
|
|
18
|
-
export declare const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
export type BlockType = TriggerType | ActionType | ConditionType | UtilityType;
|
|
28
|
+
export declare const BLOCK_CONFIG_SCHEMAS: {
|
|
29
|
+
readonly 'time.interval': z.ZodObject<{
|
|
30
|
+
minutes: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
minutes: number;
|
|
33
|
+
}, {
|
|
34
|
+
minutes: number;
|
|
35
|
+
}>;
|
|
36
|
+
readonly 'trigger.manual': z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
37
|
+
readonly 'price.above': z.ZodObject<{
|
|
38
|
+
token: z.ZodString;
|
|
39
|
+
threshold: z.ZodNumber;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
token: string;
|
|
42
|
+
threshold: number;
|
|
43
|
+
}, {
|
|
44
|
+
token: string;
|
|
45
|
+
threshold: number;
|
|
46
|
+
}>;
|
|
47
|
+
readonly 'price.below': z.ZodObject<{
|
|
48
|
+
token: z.ZodString;
|
|
49
|
+
threshold: z.ZodNumber;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
token: string;
|
|
52
|
+
threshold: number;
|
|
53
|
+
}, {
|
|
54
|
+
token: string;
|
|
55
|
+
threshold: number;
|
|
56
|
+
}>;
|
|
57
|
+
readonly 'price.change': z.ZodObject<{
|
|
58
|
+
token: z.ZodString;
|
|
59
|
+
percentChange: z.ZodNumber;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
token: string;
|
|
62
|
+
percentChange: number;
|
|
63
|
+
}, {
|
|
64
|
+
token: string;
|
|
65
|
+
percentChange: number;
|
|
66
|
+
}>;
|
|
67
|
+
readonly 'pool.created': z.ZodObject<{
|
|
68
|
+
launchpad: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "clanker", "flaunch", "zora", "bankr"]>>>;
|
|
69
|
+
quoteToken: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "WETH", "USDC"]>>>;
|
|
70
|
+
minLiquidity: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
71
|
+
maxFdv: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
safetyEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
keywordIncludes: z.ZodOptional<z.ZodString>;
|
|
74
|
+
keywordExcludes: z.ZodOptional<z.ZodString>;
|
|
75
|
+
keywordMatchMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "all"]>>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
launchpad: "any" | "clanker" | "flaunch" | "zora" | "bankr";
|
|
78
|
+
quoteToken: "any" | "WETH" | "USDC";
|
|
79
|
+
minLiquidity: number;
|
|
80
|
+
keywordMatchMode: "any" | "all";
|
|
81
|
+
maxFdv?: number | undefined;
|
|
82
|
+
safetyEnabled?: boolean | undefined;
|
|
83
|
+
keywordIncludes?: string | undefined;
|
|
84
|
+
keywordExcludes?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
launchpad?: "any" | "clanker" | "flaunch" | "zora" | "bankr" | undefined;
|
|
87
|
+
quoteToken?: "any" | "WETH" | "USDC" | undefined;
|
|
88
|
+
minLiquidity?: number | undefined;
|
|
89
|
+
maxFdv?: number | undefined;
|
|
90
|
+
safetyEnabled?: boolean | undefined;
|
|
91
|
+
keywordIncludes?: string | undefined;
|
|
92
|
+
keywordExcludes?: string | undefined;
|
|
93
|
+
keywordMatchMode?: "any" | "all" | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
readonly 'watch.whale': z.ZodObject<{
|
|
96
|
+
address: z.ZodString;
|
|
97
|
+
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
98
|
+
minAmount: z.ZodNumber;
|
|
99
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "incoming", "outgoing"]>>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
token: string;
|
|
102
|
+
address: string;
|
|
103
|
+
minAmount: number;
|
|
104
|
+
direction: "any" | "incoming" | "outgoing";
|
|
105
|
+
}, {
|
|
106
|
+
address: string;
|
|
107
|
+
minAmount: number;
|
|
108
|
+
token?: string | undefined;
|
|
109
|
+
direction?: "any" | "incoming" | "outgoing" | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
readonly 'event.transfer': z.ZodObject<{
|
|
112
|
+
tokenAddress: z.ZodString;
|
|
113
|
+
minAmount: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
114
|
+
fromAddress: z.ZodOptional<z.ZodString>;
|
|
115
|
+
toAddress: z.ZodOptional<z.ZodString>;
|
|
116
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "incoming", "outgoing"]>>>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
minAmount: number;
|
|
119
|
+
direction: "any" | "incoming" | "outgoing";
|
|
120
|
+
tokenAddress: string;
|
|
121
|
+
fromAddress?: string | undefined;
|
|
122
|
+
toAddress?: string | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
tokenAddress: string;
|
|
125
|
+
minAmount?: number | undefined;
|
|
126
|
+
direction?: "any" | "incoming" | "outgoing" | undefined;
|
|
127
|
+
fromAddress?: string | undefined;
|
|
128
|
+
toAddress?: string | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
readonly 'event.balance': z.ZodObject<{
|
|
131
|
+
token: z.ZodString;
|
|
132
|
+
condition: z.ZodEnum<[">=", "<=", ">", "<"]>;
|
|
133
|
+
threshold: z.ZodNumber;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
token: string;
|
|
136
|
+
threshold: number;
|
|
137
|
+
condition: ">=" | "<=" | ">" | "<";
|
|
138
|
+
}, {
|
|
139
|
+
token: string;
|
|
140
|
+
threshold: number;
|
|
141
|
+
condition: ">=" | "<=" | ">" | "<";
|
|
142
|
+
}>;
|
|
143
|
+
readonly 'cypher.swap': z.ZodObject<{
|
|
144
|
+
tokenIn: z.ZodString;
|
|
145
|
+
tokenOut: z.ZodString;
|
|
146
|
+
amount: z.ZodNumber;
|
|
147
|
+
amountMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fixed", "percent"]>>>;
|
|
148
|
+
slippage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
149
|
+
autoSellEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
150
|
+
autoSellMultiplier: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
151
|
+
autoSellPercent: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
tokenIn: string;
|
|
154
|
+
tokenOut: string;
|
|
155
|
+
amount: number;
|
|
156
|
+
amountMode: "fixed" | "percent";
|
|
157
|
+
slippage: number;
|
|
158
|
+
autoSellEnabled: boolean;
|
|
159
|
+
autoSellMultiplier: number;
|
|
160
|
+
autoSellPercent: number;
|
|
161
|
+
}, {
|
|
162
|
+
tokenIn: string;
|
|
163
|
+
tokenOut: string;
|
|
164
|
+
amount: number;
|
|
165
|
+
amountMode?: "fixed" | "percent" | undefined;
|
|
166
|
+
slippage?: number | undefined;
|
|
167
|
+
autoSellEnabled?: boolean | undefined;
|
|
168
|
+
autoSellMultiplier?: number | undefined;
|
|
169
|
+
autoSellPercent?: number | undefined;
|
|
170
|
+
}>;
|
|
171
|
+
readonly 'read.balance': z.ZodObject<{
|
|
172
|
+
token: z.ZodString;
|
|
173
|
+
walletAddress: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
token: string;
|
|
176
|
+
walletAddress?: string | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
token: string;
|
|
179
|
+
walletAddress?: string | undefined;
|
|
180
|
+
}>;
|
|
181
|
+
readonly 'notify.telegram': z.ZodObject<{
|
|
182
|
+
message: z.ZodString;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
message: string;
|
|
185
|
+
}, {
|
|
186
|
+
message: string;
|
|
187
|
+
}>;
|
|
188
|
+
readonly 'notify.discord': z.ZodObject<{
|
|
189
|
+
webhookUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
190
|
+
message: z.ZodString;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
message: string;
|
|
193
|
+
webhookUrl: string;
|
|
194
|
+
}, {
|
|
195
|
+
message: string;
|
|
196
|
+
webhookUrl: string;
|
|
197
|
+
}>;
|
|
198
|
+
readonly 'util.webhook': z.ZodObject<{
|
|
199
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
200
|
+
payload: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
url: string;
|
|
203
|
+
payload?: string | undefined;
|
|
204
|
+
}, {
|
|
205
|
+
url: string;
|
|
206
|
+
payload?: string | undefined;
|
|
207
|
+
}>;
|
|
208
|
+
readonly 'cond.price': z.ZodObject<{
|
|
209
|
+
token: z.ZodString;
|
|
210
|
+
operator: z.ZodEnum<[">", "<"]>;
|
|
211
|
+
threshold: z.ZodNumber;
|
|
24
212
|
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
|
|
26
|
-
|
|
213
|
+
token: string;
|
|
214
|
+
threshold: number;
|
|
215
|
+
operator: ">" | "<";
|
|
27
216
|
}, {
|
|
28
|
-
|
|
29
|
-
|
|
217
|
+
token: string;
|
|
218
|
+
threshold: number;
|
|
219
|
+
operator: ">" | "<";
|
|
30
220
|
}>;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
221
|
+
readonly 'cond.balance': z.ZodObject<{
|
|
222
|
+
token: z.ZodString;
|
|
223
|
+
operator: z.ZodEnum<[">=", "<", ">", "<="]>;
|
|
224
|
+
minBalance: z.ZodNumber;
|
|
34
225
|
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
|
|
36
|
-
|
|
226
|
+
token: string;
|
|
227
|
+
operator: ">=" | "<=" | ">" | "<";
|
|
228
|
+
minBalance: number;
|
|
37
229
|
}, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
230
|
+
token: string;
|
|
231
|
+
operator: ">=" | "<=" | ">" | "<";
|
|
232
|
+
minBalance: number;
|
|
233
|
+
}>;
|
|
234
|
+
readonly 'cond.allowed_weekdays': z.ZodObject<{
|
|
235
|
+
weekdays: z.ZodArray<z.ZodNumber, "many">;
|
|
43
236
|
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
|
|
45
|
-
config?: Record<string, any> | undefined;
|
|
237
|
+
weekdays: number[];
|
|
46
238
|
}, {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
239
|
+
weekdays: number[];
|
|
240
|
+
}>;
|
|
241
|
+
readonly 'cond.time_window': z.ZodObject<{
|
|
242
|
+
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["during", "skip"]>>>;
|
|
243
|
+
startUTC: z.ZodDefault<z.ZodString>;
|
|
244
|
+
endUTC: z.ZodDefault<z.ZodString>;
|
|
52
245
|
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
|
|
54
|
-
|
|
246
|
+
mode: "during" | "skip";
|
|
247
|
+
startUTC: string;
|
|
248
|
+
endUTC: string;
|
|
55
249
|
}, {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
250
|
+
mode?: "during" | "skip" | undefined;
|
|
251
|
+
startUTC?: string | undefined;
|
|
252
|
+
endUTC?: string | undefined;
|
|
253
|
+
}>;
|
|
254
|
+
readonly 'util.delay': z.ZodObject<{
|
|
255
|
+
seconds: z.ZodNumber;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
seconds: number;
|
|
258
|
+
}, {
|
|
259
|
+
seconds: number;
|
|
260
|
+
}>;
|
|
261
|
+
readonly 'util.note': z.ZodObject<{
|
|
262
|
+
note: z.ZodOptional<z.ZodString>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
note?: string | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
note?: string | undefined;
|
|
267
|
+
}>;
|
|
268
|
+
readonly 'util.log': z.ZodObject<{
|
|
269
|
+
level: z.ZodDefault<z.ZodOptional<z.ZodEnum<["info", "success", "warn", "error"]>>>;
|
|
270
|
+
message: z.ZodString;
|
|
271
|
+
}, "strip", z.ZodTypeAny, {
|
|
272
|
+
message: string;
|
|
273
|
+
level: "info" | "success" | "warn" | "error";
|
|
274
|
+
}, {
|
|
275
|
+
message: string;
|
|
276
|
+
level?: "info" | "success" | "warn" | "error" | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
};
|
|
279
|
+
export type BlockConfigSchemas = typeof BLOCK_CONFIG_SCHEMAS;
|
|
280
|
+
/** A workflow = trigger + ordered chain of action/condition/utility blocks. */
|
|
281
|
+
export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
282
|
+
name: z.ZodString;
|
|
283
|
+
description: z.ZodOptional<z.ZodString>;
|
|
284
|
+
trigger: z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>;
|
|
285
|
+
chain: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>, z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>, z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>]>, "many">;
|
|
59
286
|
}, "strip", z.ZodTypeAny, {
|
|
60
287
|
name: string;
|
|
61
|
-
|
|
62
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
63
|
-
config?: Record<string, any> | undefined;
|
|
64
|
-
};
|
|
65
|
-
chain: ({
|
|
66
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
67
|
-
config?: Record<string, any> | undefined;
|
|
68
|
-
} | {
|
|
69
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
70
|
-
config?: Record<string, any> | undefined;
|
|
71
|
-
} | {
|
|
72
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
73
|
-
config?: Record<string, any> | undefined;
|
|
74
|
-
})[];
|
|
288
|
+
chain: any[];
|
|
75
289
|
description?: string | undefined;
|
|
290
|
+
trigger?: any;
|
|
76
291
|
}, {
|
|
77
292
|
name: string;
|
|
78
|
-
|
|
79
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
80
|
-
config?: Record<string, any> | undefined;
|
|
81
|
-
};
|
|
82
|
-
chain: ({
|
|
83
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
84
|
-
config?: Record<string, any> | undefined;
|
|
85
|
-
} | {
|
|
86
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
87
|
-
config?: Record<string, any> | undefined;
|
|
88
|
-
} | {
|
|
89
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
90
|
-
config?: Record<string, any> | undefined;
|
|
91
|
-
})[];
|
|
293
|
+
chain: any[];
|
|
92
294
|
description?: string | undefined;
|
|
295
|
+
trigger?: any;
|
|
93
296
|
}>;
|
|
94
297
|
export type WorkflowDefinition = z.infer<typeof WorkflowDefinitionSchema>;
|
|
95
|
-
/**
|
|
96
|
-
* Convert a simple {trigger, chain} schema into CTRL's internal
|
|
97
|
-
* {nodes, edges} shape used by the canvas + keeper.
|
|
98
|
-
*/
|
|
99
298
|
export declare function compileToWorkflowData(def: WorkflowDefinition): {
|
|
100
299
|
nodes: Array<{
|
|
101
300
|
id: string;
|
package/dist/blocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,aAAa,8JAUhB,CAAA;AAEV,eAAO,MAAM,YAAY,+FAMf,CAAA;AAEV,eAAO,MAAM,eAAe,sFAKlB,CAAA;AAEV,eAAO,MAAM,aAAa,kDAIhB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa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AE,MAAM,CAAA;SAAE,CAAA;KACnC,CAAC,CAAA;IACF,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7D,CAsCA"}
|
package/dist/blocks.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Block catalog schemas — mirrors
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Block catalog schemas — mirrors only the LIVE production blocks visible in
|
|
3
|
+
* ctrl.build/terminal. Anything marked hidden in block-definitions.ts, or
|
|
4
|
+
* defined there without a keeper executor, is intentionally excluded.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Live block count: 9 triggers · 5 actions · 4 conditions · 3 utilities = 21.
|
|
7
|
+
*
|
|
8
|
+
* NOT exposed (and why):
|
|
9
|
+
* - limitless.* + polymarket.* — hidden in block-definitions.ts
|
|
10
|
+
* - social.farcaster_cast — hidden, NEYNAR_API_KEY not in prod
|
|
11
|
+
* - signal.aixbt_mention — hidden, cookie.fun mirror not wired
|
|
12
|
+
* - cond.yield_threshold — hidden, no DefiLlama eval
|
|
13
|
+
* - util.stop / util.snapshot — no keeper case, silently no-op
|
|
14
|
+
*
|
|
15
|
+
* Keep in sync with main repo. Agents can call ctrl_get_block_catalog for the
|
|
16
|
+
* live list if this falls behind.
|
|
7
17
|
*/
|
|
8
18
|
import { z } from 'zod';
|
|
19
|
+
// ─── Block id arrays ────────────────────────────────────────────────────────
|
|
9
20
|
export const TRIGGER_TYPES = [
|
|
10
21
|
'time.interval',
|
|
11
22
|
'trigger.manual',
|
|
@@ -34,64 +45,217 @@ export const UTILITY_TYPES = [
|
|
|
34
45
|
'util.delay',
|
|
35
46
|
'util.note',
|
|
36
47
|
'util.log',
|
|
37
|
-
'util.stop',
|
|
38
|
-
'util.snapshot',
|
|
39
48
|
];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
// ─── Reusable atoms ─────────────────────────────────────────────────────────
|
|
50
|
+
const tokenRef = z.string().min(1).describe('Token symbol (ETH/WETH/USDC) or 0x address');
|
|
51
|
+
const addressRef = z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe('0x address');
|
|
52
|
+
// ─── Trigger configs ────────────────────────────────────────────────────────
|
|
53
|
+
const TimeIntervalConfig = z.object({
|
|
54
|
+
minutes: z.number().positive(),
|
|
55
|
+
});
|
|
56
|
+
const ManualTriggerConfig = z.object({}).passthrough();
|
|
57
|
+
const PriceAboveConfig = z.object({
|
|
58
|
+
token: tokenRef,
|
|
59
|
+
threshold: z.number().min(0).describe('USD price'),
|
|
60
|
+
});
|
|
61
|
+
const PriceBelowConfig = z.object({
|
|
62
|
+
token: tokenRef,
|
|
63
|
+
threshold: z.number().min(0).describe('USD price'),
|
|
64
|
+
});
|
|
65
|
+
const PriceChangeConfig = z.object({
|
|
66
|
+
token: tokenRef,
|
|
67
|
+
percentChange: z.number().min(0.1).describe('Absolute percent move'),
|
|
68
|
+
});
|
|
69
|
+
const PoolCreatedConfig = z.object({
|
|
70
|
+
launchpad: z
|
|
71
|
+
.enum(['any', 'clanker', 'flaunch', 'zora', 'bankr'])
|
|
72
|
+
.optional()
|
|
73
|
+
.default('any')
|
|
74
|
+
.describe('Launchpad to watch. bankr = Doppler V4.'),
|
|
75
|
+
quoteToken: z.enum(['any', 'WETH', 'USDC']).optional().default('any'),
|
|
76
|
+
minLiquidity: z.number().min(0).optional().default(0).describe('Min pool liquidity in USD'),
|
|
77
|
+
maxFdv: z.number().min(0).optional().describe('Reject launches above this FDV (USD)'),
|
|
78
|
+
safetyEnabled: z
|
|
79
|
+
.boolean()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe('GoPlus honeypot + tax gate. Default ON for non-curated launchpads.'),
|
|
82
|
+
keywordIncludes: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('Comma-separated keywords token name/ticker must include'),
|
|
86
|
+
keywordExcludes: z.string().optional().describe('Comma-separated keywords that auto-reject'),
|
|
87
|
+
keywordMatchMode: z.enum(['any', 'all']).optional().default('any'),
|
|
88
|
+
});
|
|
89
|
+
const WatchWhaleConfig = z.object({
|
|
90
|
+
address: addressRef.describe('Wallet to watch'),
|
|
91
|
+
token: tokenRef.optional().default('ETH'),
|
|
92
|
+
minAmount: z.number().positive(),
|
|
93
|
+
direction: z.enum(['any', 'incoming', 'outgoing']).optional().default('any'),
|
|
94
|
+
});
|
|
95
|
+
const EventTransferConfig = z.object({
|
|
96
|
+
tokenAddress: addressRef,
|
|
97
|
+
minAmount: z.number().min(0).optional().default(0),
|
|
98
|
+
fromAddress: addressRef.optional(),
|
|
99
|
+
toAddress: addressRef.optional(),
|
|
100
|
+
direction: z.enum(['any', 'incoming', 'outgoing']).optional().default('any'),
|
|
101
|
+
});
|
|
102
|
+
const EventBalanceConfig = z.object({
|
|
103
|
+
token: tokenRef,
|
|
104
|
+
condition: z.enum(['>=', '<=', '>', '<']),
|
|
105
|
+
threshold: z.number(),
|
|
106
|
+
});
|
|
107
|
+
// ─── Action configs ─────────────────────────────────────────────────────────
|
|
108
|
+
const CypherSwapConfig = z.object({
|
|
109
|
+
tokenIn: z
|
|
110
|
+
.string()
|
|
111
|
+
.min(1)
|
|
112
|
+
.describe('Input token symbol/0x, or "{{trigger.tokenAddress}}" for dynamic sells'),
|
|
113
|
+
tokenOut: z
|
|
114
|
+
.string()
|
|
115
|
+
.min(1)
|
|
116
|
+
.describe('Output token symbol/0x, or "{{trigger.tokenAddress}}" for snipes'),
|
|
117
|
+
amount: z.number().positive().describe('Amount of tokenIn (or % of balance if amountMode=percent)'),
|
|
118
|
+
amountMode: z.enum(['fixed', 'percent']).optional().default('fixed'),
|
|
119
|
+
slippage: z.number().min(0.1).max(50).optional().default(15).describe('Slippage %'),
|
|
120
|
+
autoSellEnabled: z.boolean().optional().default(false),
|
|
121
|
+
autoSellMultiplier: z
|
|
122
|
+
.number()
|
|
123
|
+
.min(1.01)
|
|
124
|
+
.optional()
|
|
125
|
+
.default(2)
|
|
126
|
+
.describe('Auto-sell at N× entry price'),
|
|
127
|
+
autoSellPercent: z.number().min(1).max(100).optional().default(50).describe('% of position to sell'),
|
|
128
|
+
});
|
|
129
|
+
const ReadBalanceConfig = z.object({
|
|
130
|
+
token: tokenRef,
|
|
131
|
+
walletAddress: addressRef.optional().describe('Defaults to vault wallet'),
|
|
43
132
|
});
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
133
|
+
const NotifyTelegramConfig = z.object({
|
|
134
|
+
message: z
|
|
135
|
+
.string()
|
|
136
|
+
.min(1)
|
|
137
|
+
.max(4000)
|
|
138
|
+
.describe('Supports {{token}}, {{price}}, {{amount}}, {{txHash}}, {{trigger.*}} vars'),
|
|
139
|
+
});
|
|
140
|
+
const NotifyDiscordConfig = z.object({
|
|
141
|
+
webhookUrl: z
|
|
142
|
+
.string()
|
|
143
|
+
.url()
|
|
144
|
+
.refine((u) => u.startsWith('https://discord.com/api/webhooks/'), {
|
|
145
|
+
message: 'Must be a https://discord.com/api/webhooks/... URL',
|
|
146
|
+
}),
|
|
147
|
+
message: z.string().min(1).max(2000),
|
|
148
|
+
});
|
|
149
|
+
const UtilWebhookConfig = z.object({
|
|
150
|
+
url: z.string().url().refine((u) => u.startsWith('https://'), { message: 'HTTPS only' }),
|
|
151
|
+
payload: z.string().optional().describe('JSON string body; template vars supported'),
|
|
152
|
+
});
|
|
153
|
+
// ─── Condition configs ──────────────────────────────────────────────────────
|
|
154
|
+
const CondPriceConfig = z.object({
|
|
155
|
+
token: z.string().min(1),
|
|
156
|
+
operator: z.enum(['>', '<']),
|
|
157
|
+
threshold: z.number().min(0).describe('USD price'),
|
|
158
|
+
});
|
|
159
|
+
const CondBalanceConfig = z.object({
|
|
160
|
+
token: tokenRef,
|
|
161
|
+
operator: z.enum(['>=', '<', '>', '<=']),
|
|
162
|
+
minBalance: z.number(),
|
|
163
|
+
});
|
|
164
|
+
const CondWeekdaysConfig = z.object({
|
|
165
|
+
weekdays: z.array(z.number().int().min(1).max(7)).describe('ISO weekdays Mon=1..Sun=7'),
|
|
166
|
+
});
|
|
167
|
+
const HHMM = z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, { message: 'HH:MM 24h UTC' });
|
|
168
|
+
const CondTimeWindowConfig = z.object({
|
|
169
|
+
mode: z.enum(['during', 'skip']).optional().default('during'),
|
|
170
|
+
startUTC: HHMM.default('13:00'),
|
|
171
|
+
endUTC: HHMM.default('22:00'),
|
|
47
172
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
173
|
+
// ─── Utility configs ────────────────────────────────────────────────────────
|
|
174
|
+
const UtilDelayConfig = z.object({
|
|
175
|
+
seconds: z.number().positive(),
|
|
51
176
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
config: z.record(z.any()).optional(),
|
|
177
|
+
const UtilNoteConfig = z.object({
|
|
178
|
+
note: z.string().max(2000).optional(),
|
|
55
179
|
});
|
|
56
|
-
|
|
180
|
+
const UtilLogConfig = z.object({
|
|
181
|
+
level: z.enum(['info', 'success', 'warn', 'error']).optional().default('info'),
|
|
182
|
+
message: z.string().min(1).max(2000),
|
|
183
|
+
});
|
|
184
|
+
// ─── Master per-block schema map ────────────────────────────────────────────
|
|
185
|
+
export const BLOCK_CONFIG_SCHEMAS = {
|
|
186
|
+
'time.interval': TimeIntervalConfig,
|
|
187
|
+
'trigger.manual': ManualTriggerConfig,
|
|
188
|
+
'price.above': PriceAboveConfig,
|
|
189
|
+
'price.below': PriceBelowConfig,
|
|
190
|
+
'price.change': PriceChangeConfig,
|
|
191
|
+
'pool.created': PoolCreatedConfig,
|
|
192
|
+
'watch.whale': WatchWhaleConfig,
|
|
193
|
+
'event.transfer': EventTransferConfig,
|
|
194
|
+
'event.balance': EventBalanceConfig,
|
|
195
|
+
'cypher.swap': CypherSwapConfig,
|
|
196
|
+
'read.balance': ReadBalanceConfig,
|
|
197
|
+
'notify.telegram': NotifyTelegramConfig,
|
|
198
|
+
'notify.discord': NotifyDiscordConfig,
|
|
199
|
+
'util.webhook': UtilWebhookConfig,
|
|
200
|
+
'cond.price': CondPriceConfig,
|
|
201
|
+
'cond.balance': CondBalanceConfig,
|
|
202
|
+
'cond.allowed_weekdays': CondWeekdaysConfig,
|
|
203
|
+
'cond.time_window': CondTimeWindowConfig,
|
|
204
|
+
'util.delay': UtilDelayConfig,
|
|
205
|
+
'util.note': UtilNoteConfig,
|
|
206
|
+
'util.log': UtilLogConfig,
|
|
207
|
+
};
|
|
208
|
+
// ─── Discriminated-union blocks ─────────────────────────────────────────────
|
|
209
|
+
function typedBlockUnion(types) {
|
|
210
|
+
const variants = types.map((t) => z.object({
|
|
211
|
+
type: z.literal(t),
|
|
212
|
+
config: BLOCK_CONFIG_SCHEMAS[t].optional().default({}),
|
|
213
|
+
}));
|
|
214
|
+
return z.union(variants);
|
|
215
|
+
}
|
|
216
|
+
const TriggerBlock = typedBlockUnion(TRIGGER_TYPES);
|
|
217
|
+
const ActionBlock = typedBlockUnion(ACTION_TYPES);
|
|
218
|
+
const ConditionBlock = typedBlockUnion(CONDITION_TYPES);
|
|
219
|
+
const UtilityBlock = typedBlockUnion(UTILITY_TYPES);
|
|
220
|
+
const ChainBlock = z.union([ActionBlock, ConditionBlock, UtilityBlock]);
|
|
221
|
+
/** A workflow = trigger + ordered chain of action/condition/utility blocks. */
|
|
57
222
|
export const WorkflowDefinitionSchema = z.object({
|
|
58
223
|
name: z.string().min(1).max(120),
|
|
59
224
|
description: z.string().max(500).optional(),
|
|
60
|
-
trigger:
|
|
61
|
-
chain: z
|
|
62
|
-
.array(z.union([actionBlock, conditionBlock, utilityBlock]))
|
|
63
|
-
.min(1)
|
|
64
|
-
.max(20),
|
|
225
|
+
trigger: TriggerBlock,
|
|
226
|
+
chain: z.array(ChainBlock).min(1).max(20),
|
|
65
227
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
228
|
+
// ─── Compile to CTRL canvas {nodes, edges} ──────────────────────────────────
|
|
229
|
+
const ACTION_SET = new Set(ACTION_TYPES);
|
|
230
|
+
const CONDITION_SET = new Set(CONDITION_TYPES);
|
|
231
|
+
function classify(type) {
|
|
232
|
+
if (ACTION_SET.has(type))
|
|
233
|
+
return 'action';
|
|
234
|
+
if (CONDITION_SET.has(type))
|
|
235
|
+
return 'condition';
|
|
236
|
+
return 'utility';
|
|
237
|
+
}
|
|
70
238
|
export function compileToWorkflowData(def) {
|
|
71
239
|
const nodes = [];
|
|
72
240
|
const edges = [];
|
|
241
|
+
const trigger = def.trigger;
|
|
73
242
|
const triggerId = 'n0_trigger';
|
|
74
|
-
const [triggerCategory, triggerSubtype] = def.trigger.type.split('.');
|
|
75
243
|
nodes.push({
|
|
76
244
|
id: triggerId,
|
|
77
245
|
type: 'automation',
|
|
78
246
|
blockType: 'trigger',
|
|
79
|
-
blockSubtype:
|
|
80
|
-
data: { blockId:
|
|
247
|
+
blockSubtype: trigger.type,
|
|
248
|
+
data: { blockId: trigger.type, config: trigger.config ?? {} },
|
|
81
249
|
position: { x: 80, y: 80 },
|
|
82
250
|
});
|
|
83
251
|
let prevId = triggerId;
|
|
84
252
|
def.chain.forEach((block, idx) => {
|
|
85
|
-
const id = `n${idx + 1}_${block.type.replace(
|
|
86
|
-
const [category, subtype] = block.type.split('.');
|
|
87
|
-
const isAction = ACTION_TYPES.includes(block.type);
|
|
88
|
-
const isCondition = CONDITION_TYPES.includes(block.type);
|
|
89
|
-
const blockType = isAction ? 'action' : isCondition ? 'condition' : 'utility';
|
|
253
|
+
const id = `n${idx + 1}_${block.type.replace(/\./g, '_')}`;
|
|
90
254
|
nodes.push({
|
|
91
255
|
id,
|
|
92
256
|
type: 'automation',
|
|
93
|
-
blockType,
|
|
94
|
-
blockSubtype:
|
|
257
|
+
blockType: classify(block.type),
|
|
258
|
+
blockSubtype: block.type,
|
|
95
259
|
data: { blockId: block.type, config: block.config ?? {} },
|
|
96
260
|
position: { x: 80 + (idx + 1) * 320, y: 80 },
|
|
97
261
|
});
|
package/dist/blocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,eAAe;CACP,CAAA;AAEV,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;CACN,CAAA;AAEV,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY;IACZ,cAAc;IACd,uBAAuB;IACvB,kBAAkB;CACV,CAAA;AAEV,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,WAAW;IACX,UAAU;CACF,CAAA;AAQV,+EAA+E;AAE/E,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC,CAAA;AACzF,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAEjF,+EAA+E;AAE/E,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAA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CAAC,EAAE,CAAA;QAC1D,KAAK,CAAC,IAAI,CAAC;YACT,EAAE;YACF,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YAC/B,YAAY,EAAE,KAAK,CAAC,IAAI;YACxB,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE;YACzD,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;SAC7C,CAAC,CAAA;QACF,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;QACnE,MAAM,GAAG,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AACzB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { ACTIVATE_TOOL, handleActivate, } from './tools/activate-workflow.js';
|
|
|
22
22
|
import { FIRE_MANUAL_TOOL, handleFireManual } from './tools/fire-manual.js';
|
|
23
23
|
import { GET_EXECUTION_LOGS_TOOL, handleGetExecutionLogs, } from './tools/get-execution-logs.js';
|
|
24
24
|
import { VAULT_STATUS_TOOL, handleVaultStatus } from './tools/vault-status.js';
|
|
25
|
+
import { GET_BLOCK_CATALOG_TOOL, handleGetBlockCatalog, } from './tools/get-block-catalog.js';
|
|
25
26
|
import { CtrlApiError } from './client.js';
|
|
26
27
|
const server = new Server({
|
|
27
28
|
name: '@daxaur/ctrl-mcp',
|
|
@@ -33,6 +34,7 @@ const server = new Server({
|
|
|
33
34
|
});
|
|
34
35
|
const TOOLS = [
|
|
35
36
|
VAULT_STATUS_TOOL,
|
|
37
|
+
GET_BLOCK_CATALOG_TOOL,
|
|
36
38
|
CREATE_WORKFLOW_TOOL,
|
|
37
39
|
ACTIVATE_TOOL,
|
|
38
40
|
FIRE_MANUAL_TOOL,
|
|
@@ -40,6 +42,7 @@ const TOOLS = [
|
|
|
40
42
|
];
|
|
41
43
|
const HANDLERS = {
|
|
42
44
|
ctrl_get_vault_status: handleVaultStatus,
|
|
45
|
+
ctrl_get_block_catalog: handleGetBlockCatalog,
|
|
43
46
|
ctrl_create_workflow: handleCreateWorkflow,
|
|
44
47
|
ctrl_activate: handleActivate,
|
|
45
48
|
ctrl_fire_manual: handleFireManual,
|
|
@@ -83,6 +86,37 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
83
86
|
}
|
|
84
87
|
});
|
|
85
88
|
async function main() {
|
|
89
|
+
// Subcommand dispatch — `install [target]` writes the user's MCP client
|
|
90
|
+
// config for them so they don't have to hand-edit JSON. Default (no args)
|
|
91
|
+
// is the stdio MCP server itself.
|
|
92
|
+
const argv = process.argv.slice(2);
|
|
93
|
+
if (argv[0] === 'install') {
|
|
94
|
+
const { runInstall } = await import('./install.js');
|
|
95
|
+
await runInstall(argv.slice(1));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (argv[0] === '--version' || argv[0] === '-v') {
|
|
99
|
+
console.log('@daxaur/ctrl-mcp 0.1.5');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (argv[0] === '--help' || argv[0] === '-h') {
|
|
103
|
+
console.log([
|
|
104
|
+
'@daxaur/ctrl-mcp — Base MCP plugin for CTRL workflow automation',
|
|
105
|
+
'',
|
|
106
|
+
'Usage:',
|
|
107
|
+
' npx -y @daxaur/ctrl-mcp run as stdio MCP server (default — used by MCP clients)',
|
|
108
|
+
' npx -y @daxaur/ctrl-mcp install [claude|cursor|codex|all]',
|
|
109
|
+
' auto-configure your AI client',
|
|
110
|
+
' npx -y @daxaur/ctrl-mcp --version',
|
|
111
|
+
'',
|
|
112
|
+
'Env:',
|
|
113
|
+
' CTRL_API_KEY mint at https://ctrl.build/mcp',
|
|
114
|
+
'',
|
|
115
|
+
'Install in Claude Desktop:',
|
|
116
|
+
' CTRL_API_KEY=sk_ctrl_... npx -y @daxaur/ctrl-mcp install claude',
|
|
117
|
+
].join('\n'));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
86
120
|
const transport = new StdioServerTransport();
|
|
87
121
|
await server.connect(transport);
|
|
88
122
|
// Log to stderr so it doesn't corrupt the stdio protocol on stdout.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAA;AAED,MAAM,KAAK,GAAG;IACZ,iBAAiB;IACjB,oBAAoB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,CACT;YACE,iEAAiE;YACjE,EAAE;YACF,QAAQ;YACR,yGAAyG;YACzG,6DAA6D;YAC7D,+EAA+E;YAC/E,qCAAqC;YACrC,EAAE;YACF,MAAM;YACN,kDAAkD;YAClD,EAAE;YACF,4BAA4B;YAC5B,mEAAmE;SACpE,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAA;QACD,OAAM;IACR,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC/B,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAA;AAC7D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @daxaur/ctrl-mcp install — auto-configure Claude Desktop / Cursor / Codex.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* npx @daxaur/ctrl-mcp install claude # writes Claude Desktop config
|
|
6
|
+
* npx @daxaur/ctrl-mcp install cursor # writes Cursor mcp.json
|
|
7
|
+
* npx @daxaur/ctrl-mcp install codex # writes Codex config
|
|
8
|
+
* npx @daxaur/ctrl-mcp install all # writes any client whose config dir exists
|
|
9
|
+
*
|
|
10
|
+
* Reads existing config (if any), merges the `ctrl` entry under mcpServers
|
|
11
|
+
* (preserving other servers), writes it back. Prompts for CTRL_API_KEY if
|
|
12
|
+
* not in env. Idempotent — re-running just updates the entry.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runInstall(argv: string[]): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0JH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmD9D"}
|
package/dist/install.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @daxaur/ctrl-mcp install — auto-configure Claude Desktop / Cursor / Codex.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* npx @daxaur/ctrl-mcp install claude # writes Claude Desktop config
|
|
6
|
+
* npx @daxaur/ctrl-mcp install cursor # writes Cursor mcp.json
|
|
7
|
+
* npx @daxaur/ctrl-mcp install codex # writes Codex config
|
|
8
|
+
* npx @daxaur/ctrl-mcp install all # writes any client whose config dir exists
|
|
9
|
+
*
|
|
10
|
+
* Reads existing config (if any), merges the `ctrl` entry under mcpServers
|
|
11
|
+
* (preserving other servers), writes it back. Prompts for CTRL_API_KEY if
|
|
12
|
+
* not in env. Idempotent — re-running just updates the entry.
|
|
13
|
+
*/
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import os from 'node:os';
|
|
17
|
+
import readline from 'node:readline/promises';
|
|
18
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
19
|
+
function clientSpecs() {
|
|
20
|
+
const home = os.homedir();
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
id: 'claude',
|
|
24
|
+
label: 'Claude Desktop',
|
|
25
|
+
configPath: path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
|
|
26
|
+
schemaShape: 'mcpServers',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'cursor',
|
|
30
|
+
label: 'Cursor',
|
|
31
|
+
configPath: path.join(home, '.cursor', 'mcp.json'),
|
|
32
|
+
schemaShape: 'mcpServers',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'codex',
|
|
36
|
+
label: 'Codex',
|
|
37
|
+
configPath: path.join(home, '.config', 'openai-codex', 'mcp.json'),
|
|
38
|
+
schemaShape: 'mcpServers',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
async function promptForKey() {
|
|
43
|
+
const rl = readline.createInterface({ input, output });
|
|
44
|
+
try {
|
|
45
|
+
const answer = await rl.question('\nPaste your CTRL API key (mint at https://ctrl.build/mcp): ');
|
|
46
|
+
return answer.trim();
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
rl.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function mcpEntry(apiKey) {
|
|
53
|
+
return {
|
|
54
|
+
command: 'npx',
|
|
55
|
+
args: ['-y', '@daxaur/ctrl-mcp@latest'],
|
|
56
|
+
env: { CTRL_API_KEY: apiKey },
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function readConfig(p) {
|
|
60
|
+
if (!fs.existsSync(p))
|
|
61
|
+
return {};
|
|
62
|
+
try {
|
|
63
|
+
const raw = fs.readFileSync(p, 'utf8').trim();
|
|
64
|
+
if (!raw)
|
|
65
|
+
return {};
|
|
66
|
+
return JSON.parse(raw);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
throw new Error(`Could not parse ${p}: ${e instanceof Error ? e.message : String(e)}. Open it in a JSON validator and fix the syntax, then re-run.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function writeConfig(p, cfg) {
|
|
73
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
74
|
+
// Preserve a single trailing newline + 2-space indent (the convention every client uses).
|
|
75
|
+
fs.writeFileSync(p, JSON.stringify(cfg, null, 2) + '\n', 'utf8');
|
|
76
|
+
}
|
|
77
|
+
async function installOne(spec, apiKey, opts) {
|
|
78
|
+
const dir = path.dirname(spec.configPath);
|
|
79
|
+
const dirExists = fs.existsSync(dir);
|
|
80
|
+
if (!dirExists && opts.skipIfMissingDir) {
|
|
81
|
+
return {
|
|
82
|
+
client: spec.id,
|
|
83
|
+
label: spec.label,
|
|
84
|
+
path: spec.configPath,
|
|
85
|
+
action: 'skipped',
|
|
86
|
+
reason: `${dir} does not exist — ${spec.label} likely not installed on this machine`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const existed = fs.existsSync(spec.configPath);
|
|
90
|
+
const cfg = readConfig(spec.configPath);
|
|
91
|
+
const servers = (cfg.mcpServers || {});
|
|
92
|
+
const prevEntry = servers.ctrl;
|
|
93
|
+
const nextEntry = mcpEntry(apiKey);
|
|
94
|
+
if (prevEntry &&
|
|
95
|
+
JSON.stringify(prevEntry) === JSON.stringify(nextEntry)) {
|
|
96
|
+
return {
|
|
97
|
+
client: spec.id,
|
|
98
|
+
label: spec.label,
|
|
99
|
+
path: spec.configPath,
|
|
100
|
+
action: 'already-current',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
servers.ctrl = nextEntry;
|
|
104
|
+
cfg.mcpServers = servers;
|
|
105
|
+
writeConfig(spec.configPath, cfg);
|
|
106
|
+
return {
|
|
107
|
+
client: spec.id,
|
|
108
|
+
label: spec.label,
|
|
109
|
+
path: spec.configPath,
|
|
110
|
+
action: existed ? 'updated' : 'created',
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function logResult(r) {
|
|
114
|
+
const sym = r.action === 'created'
|
|
115
|
+
? '✓ created'
|
|
116
|
+
: r.action === 'updated'
|
|
117
|
+
? '✓ updated'
|
|
118
|
+
: r.action === 'already-current'
|
|
119
|
+
? '· already current'
|
|
120
|
+
: '· skipped';
|
|
121
|
+
console.log(`${sym} ${r.label.padEnd(16)} ${r.path}`);
|
|
122
|
+
if (r.reason)
|
|
123
|
+
console.log(` ${r.reason}`);
|
|
124
|
+
}
|
|
125
|
+
export async function runInstall(argv) {
|
|
126
|
+
const target = (argv[0] || 'all').toLowerCase();
|
|
127
|
+
const validClients = ['claude', 'cursor', 'codex'];
|
|
128
|
+
if (target !== 'all' && !validClients.includes(target)) {
|
|
129
|
+
console.error(`Unknown target: ${target}. Use one of: ${validClients.join(', ')}, all.`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
let apiKey = process.env.CTRL_API_KEY || '';
|
|
133
|
+
if (!apiKey) {
|
|
134
|
+
apiKey = await promptForKey();
|
|
135
|
+
}
|
|
136
|
+
if (!apiKey || !apiKey.startsWith('sk_ctrl_')) {
|
|
137
|
+
console.error(`\nMissing or malformed CTRL API key. Mint one at https://ctrl.build/mcp, then re-run.`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
const specs = clientSpecs();
|
|
141
|
+
const selected = target === 'all' ? specs : specs.filter((s) => s.id === target);
|
|
142
|
+
console.log(`\nInstalling @daxaur/ctrl-mcp into ${selected.length} client${selected.length === 1 ? '' : 's'}…\n`);
|
|
143
|
+
const results = [];
|
|
144
|
+
for (const spec of selected) {
|
|
145
|
+
try {
|
|
146
|
+
const r = await installOne(spec, apiKey, {
|
|
147
|
+
skipIfMissingDir: target === 'all',
|
|
148
|
+
});
|
|
149
|
+
results.push(r);
|
|
150
|
+
logResult(r);
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
console.error(`✗ ${spec.label}: ${e instanceof Error ? e.message : String(e)}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const wrote = results.filter((r) => r.action === 'created' || r.action === 'updated');
|
|
157
|
+
if (wrote.length > 0) {
|
|
158
|
+
console.log(`\nDone. Fully quit ${wrote.map((r) => r.label).join(' + ')} (Cmd+Q) and reopen — closing the window isn't enough.`);
|
|
159
|
+
console.log(`Then ask: "list the tools you have from ctrl" — you should see five.`);
|
|
160
|
+
}
|
|
161
|
+
else if (results.every((r) => r.action === 'already-current')) {
|
|
162
|
+
console.log(`\nNothing to change — your config already points at this key.`);
|
|
163
|
+
}
|
|
164
|
+
else if (results.every((r) => r.action === 'skipped')) {
|
|
165
|
+
console.log(`\nNone of the supported clients are installed at the default paths.`);
|
|
166
|
+
console.log(`If you have a non-standard install, paste this into your client's MCP config manually:`);
|
|
167
|
+
console.log(`\n ${JSON.stringify({ mcpServers: { ctrl: mcpEntry(apiKey) } }, null, 2)}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,QAAQ,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAY/D,SAAS,WAAW;IAClB,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAA;IACzB,OAAO;QACL;YACE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,gBAAgB;YACvB,UAAU,EAAE,IAAI,CAAC,IAAI,CACnB,IAAI,EACJ,SAAS,EACT,qBAAqB,EACrB,QAAQ,EACR,4BAA4B,CAC7B;YACD,WAAW,EAAE,YAAY;SAC1B;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,QAAQ;YACf,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC;YAClD,WAAW,EAAE,YAAY;SAC1B;QACD;YACE,EAAE,EAAE,OAAO;YACX,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,CAAC;YAClE,WAAW,EAAE,YAAY;SAC1B;KACF,CAAA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AI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;IAC3F,CAAC;AACH,CAAC"}
|
|
@@ -9,78 +9,18 @@ import { z } from 'zod';
|
|
|
9
9
|
export declare const createWorkflowInputSchema: z.ZodObject<{
|
|
10
10
|
name: z.ZodString;
|
|
11
11
|
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
trigger: z.
|
|
13
|
-
|
|
14
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
17
|
-
config?: Record<string, any> | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
20
|
-
config?: Record<string, any> | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
chain: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
23
|
-
type: z.ZodEnum<["cypher.swap", "read.balance", "notify.telegram", "notify.discord", "util.webhook"]>;
|
|
24
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
27
|
-
config?: Record<string, any> | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
30
|
-
config?: Record<string, any> | undefined;
|
|
31
|
-
}>, z.ZodObject<{
|
|
32
|
-
type: z.ZodEnum<["cond.price", "cond.balance", "cond.allowed_weekdays", "cond.time_window"]>;
|
|
33
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
36
|
-
config?: Record<string, any> | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
39
|
-
config?: Record<string, any> | undefined;
|
|
40
|
-
}>, z.ZodObject<{
|
|
41
|
-
type: z.ZodEnum<["util.delay", "util.note", "util.log", "util.stop", "util.snapshot"]>;
|
|
42
|
-
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
45
|
-
config?: Record<string, any> | undefined;
|
|
46
|
-
}, {
|
|
47
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
48
|
-
config?: Record<string, any> | undefined;
|
|
49
|
-
}>]>, "many">;
|
|
12
|
+
trigger: z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>;
|
|
13
|
+
chain: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>, z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>, z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>]>, "many">;
|
|
50
14
|
}, "strip", z.ZodTypeAny, {
|
|
51
15
|
name: string;
|
|
52
|
-
|
|
53
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
54
|
-
config?: Record<string, any> | undefined;
|
|
55
|
-
};
|
|
56
|
-
chain: ({
|
|
57
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
58
|
-
config?: Record<string, any> | undefined;
|
|
59
|
-
} | {
|
|
60
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
61
|
-
config?: Record<string, any> | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
64
|
-
config?: Record<string, any> | undefined;
|
|
65
|
-
})[];
|
|
16
|
+
chain: any[];
|
|
66
17
|
description?: string | undefined;
|
|
18
|
+
trigger?: any;
|
|
67
19
|
}, {
|
|
68
20
|
name: string;
|
|
69
|
-
|
|
70
|
-
type: "time.interval" | "trigger.manual" | "price.above" | "price.below" | "price.change" | "pool.created" | "watch.whale" | "event.transfer" | "event.balance";
|
|
71
|
-
config?: Record<string, any> | undefined;
|
|
72
|
-
};
|
|
73
|
-
chain: ({
|
|
74
|
-
type: "cypher.swap" | "read.balance" | "notify.telegram" | "notify.discord" | "util.webhook";
|
|
75
|
-
config?: Record<string, any> | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
type: "cond.price" | "cond.balance" | "cond.allowed_weekdays" | "cond.time_window";
|
|
78
|
-
config?: Record<string, any> | undefined;
|
|
79
|
-
} | {
|
|
80
|
-
type: "util.delay" | "util.note" | "util.log" | "util.stop" | "util.snapshot";
|
|
81
|
-
config?: Record<string, any> | undefined;
|
|
82
|
-
})[];
|
|
21
|
+
chain: any[];
|
|
83
22
|
description?: string | undefined;
|
|
23
|
+
trigger?: any;
|
|
84
24
|
}>;
|
|
85
25
|
export declare const CREATE_WORKFLOW_TOOL: {
|
|
86
26
|
readonly name: "ctrl_create_workflow";
|
|
@@ -147,8 +87,8 @@ export declare function handleCreateWorkflow(rawInput: unknown): Promise<{
|
|
|
147
87
|
workflowId: string;
|
|
148
88
|
activateUrl: string;
|
|
149
89
|
status: string;
|
|
150
|
-
trigger:
|
|
151
|
-
chain:
|
|
90
|
+
trigger: any;
|
|
91
|
+
chain: any[];
|
|
152
92
|
};
|
|
153
93
|
}>;
|
|
154
94
|
//# sourceMappingURL=create-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workflow.d.ts","sourceRoot":"","sources":["../../src/tools/create-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"create-workflow.d.ts","sourceRoot":"","sources":["../../src/tools/create-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAA2B,CAAA;AAEjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFvB,CAAA;AAMV,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,OAAO;;;;;;;;;;;;GAmD3D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ctrl_get_block_catalog — return the live block catalog from /api/mcp/block-catalog.
|
|
3
|
+
*
|
|
4
|
+
* Agents call this when they need the most up-to-date list of supported
|
|
5
|
+
* triggers/actions/conditions/utilities with their config field schemas.
|
|
6
|
+
* The route is auth-free (documentation) so this works without an API key.
|
|
7
|
+
*/
|
|
8
|
+
export interface BlockConfigField {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
default?: string | number | boolean;
|
|
13
|
+
enum_values?: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CatalogEntry {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
config_fields: BlockConfigField[];
|
|
21
|
+
}
|
|
22
|
+
export interface BlockCatalog {
|
|
23
|
+
triggers: CatalogEntry[];
|
|
24
|
+
actions: CatalogEntry[];
|
|
25
|
+
conditions: CatalogEntry[];
|
|
26
|
+
utilities: CatalogEntry[];
|
|
27
|
+
}
|
|
28
|
+
export declare const GET_BLOCK_CATALOG_TOOL: {
|
|
29
|
+
readonly name: "ctrl_get_block_catalog";
|
|
30
|
+
readonly description: "Return the live catalog of every CTRL workflow block (trigger, action, condition, utility) with id, label, description, and config-field schemas. Call this BEFORE ctrl_create_workflow whenever you're unsure about a block's exact config shape, or whenever you want the freshest list of supported blocks (CTRL ships new blocks regularly — the static plugin schema may lag). Optional input: { category } to narrow to a single bucket.";
|
|
31
|
+
readonly inputSchema: {
|
|
32
|
+
readonly type: "object";
|
|
33
|
+
readonly properties: {
|
|
34
|
+
readonly category: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly enum: readonly ["trigger", "action", "condition", "utility"];
|
|
37
|
+
readonly description: "Optional. Filter to a single block bucket. Omit to get all four.";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare function handleGetBlockCatalog(rawInput: unknown): Promise<{
|
|
43
|
+
content: {
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}[];
|
|
47
|
+
structuredContent: Record<string, unknown>;
|
|
48
|
+
}>;
|
|
49
|
+
//# sourceMappingURL=get-block-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-block-catalog.d.ts","sourceRoot":"","sources":["../../src/tools/get-block-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IACnC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,gBAAgB,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,SAAS,EAAE,YAAY,EAAE,CAAA;CAC1B;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;CAezB,CAAA;AAkBV,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,OAAO;;;;;uBAsDhB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;GAEnE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ctrl_get_block_catalog — return the live block catalog from /api/mcp/block-catalog.
|
|
3
|
+
*
|
|
4
|
+
* Agents call this when they need the most up-to-date list of supported
|
|
5
|
+
* triggers/actions/conditions/utilities with their config field schemas.
|
|
6
|
+
* The route is auth-free (documentation) so this works without an API key.
|
|
7
|
+
*/
|
|
8
|
+
import { CTRL_API_BASE } from '../config.js';
|
|
9
|
+
export const GET_BLOCK_CATALOG_TOOL = {
|
|
10
|
+
name: 'ctrl_get_block_catalog',
|
|
11
|
+
description: "Return the live catalog of every CTRL workflow block (trigger, action, condition, utility) with id, label, description, and config-field schemas. Call this BEFORE ctrl_create_workflow whenever you're unsure about a block's exact config shape, or whenever you want the freshest list of supported blocks (CTRL ships new blocks regularly — the static plugin schema may lag). Optional input: { category } to narrow to a single bucket.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
category: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
enum: ['trigger', 'action', 'condition', 'utility'],
|
|
18
|
+
description: 'Optional. Filter to a single block bucket. Omit to get all four.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
function isCategory(v) {
|
|
24
|
+
return v === 'trigger' || v === 'action' || v === 'condition' || v === 'utility';
|
|
25
|
+
}
|
|
26
|
+
function summarize(entries) {
|
|
27
|
+
return entries
|
|
28
|
+
.map((e) => {
|
|
29
|
+
const req = e.config_fields.filter((f) => f.required).map((f) => f.name);
|
|
30
|
+
const reqStr = req.length ? ` [required: ${req.join(', ')}]` : '';
|
|
31
|
+
return ` • ${e.id} — ${e.description}${reqStr}`;
|
|
32
|
+
})
|
|
33
|
+
.join('\n');
|
|
34
|
+
}
|
|
35
|
+
export async function handleGetBlockCatalog(rawInput) {
|
|
36
|
+
const input = (rawInput ?? {});
|
|
37
|
+
const category = isCategory(input.category) ? input.category : undefined;
|
|
38
|
+
const url = new URL('/api/mcp/block-catalog', CTRL_API_BASE);
|
|
39
|
+
if (category)
|
|
40
|
+
url.searchParams.set('category', category);
|
|
41
|
+
const controller = new AbortController();
|
|
42
|
+
const timeout = setTimeout(() => controller.abort(), 15_000);
|
|
43
|
+
let res;
|
|
44
|
+
try {
|
|
45
|
+
res = await fetch(url, {
|
|
46
|
+
method: 'GET',
|
|
47
|
+
headers: {
|
|
48
|
+
Accept: 'application/json',
|
|
49
|
+
'User-Agent': '@daxaur/ctrl-mcp',
|
|
50
|
+
},
|
|
51
|
+
signal: controller.signal,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
clearTimeout(timeout);
|
|
56
|
+
}
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
throw new Error(`Block catalog fetch failed: HTTP ${res.status} ${res.statusText}`);
|
|
59
|
+
}
|
|
60
|
+
const catalog = (await res.json());
|
|
61
|
+
const lines = [];
|
|
62
|
+
if (!category || category === 'trigger') {
|
|
63
|
+
lines.push(`Triggers (${catalog.triggers.length}):`);
|
|
64
|
+
lines.push(summarize(catalog.triggers));
|
|
65
|
+
}
|
|
66
|
+
if (!category || category === 'action') {
|
|
67
|
+
lines.push(`\nActions (${catalog.actions.length}):`);
|
|
68
|
+
lines.push(summarize(catalog.actions));
|
|
69
|
+
}
|
|
70
|
+
if (!category || category === 'condition') {
|
|
71
|
+
lines.push(`\nConditions (${catalog.conditions.length}):`);
|
|
72
|
+
lines.push(summarize(catalog.conditions));
|
|
73
|
+
}
|
|
74
|
+
if (!category || category === 'utility') {
|
|
75
|
+
lines.push(`\nUtilities (${catalog.utilities.length}):`);
|
|
76
|
+
lines.push(summarize(catalog.utilities));
|
|
77
|
+
}
|
|
78
|
+
lines.push('\nUse the structuredContent payload for full config_fields metadata when wiring up ctrl_create_workflow.');
|
|
79
|
+
return {
|
|
80
|
+
content: [{ type: 'text', text: lines.join('\n') }],
|
|
81
|
+
structuredContent: catalog,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=get-block-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-block-catalog.js","sourceRoot":"","sources":["../../src/tools/get-block-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAyB5C,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,gbAAgb;IAClb,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAC;gBACnD,WAAW,EACT,kEAAkE;aACrE;SACF;KACF;CACO,CAAA;AAIV,SAAS,UAAU,CAAC,CAAU;IAC5B,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,SAAS,CAAA;AAClF,CAAC;AAED,SAAS,SAAS,CAAC,OAAuB;IACxC,OAAO,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