@walkeros/mcp 3.1.1 → 3.2.0-next-1775064795590
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/index.js +164 -69
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var SimulateOutputShape = {
|
|
|
56
56
|
z.object({
|
|
57
57
|
received: z.boolean().describe("Whether destination received the event"),
|
|
58
58
|
calls: z.number().describe("Number of API calls made"),
|
|
59
|
-
payload: z.unknown().optional().describe("
|
|
59
|
+
payload: z.unknown().optional().describe("All intercepted API calls (only when verbose: true)")
|
|
60
60
|
})
|
|
61
61
|
).optional().describe("Per-destination results"),
|
|
62
62
|
capturedEvents: z.array(z.record(z.string(), z.unknown())).optional().describe("Events captured by source simulation"),
|
|
@@ -216,7 +216,11 @@ function registerFlowBundleTool(server2) {
|
|
|
216
216
|
|
|
217
217
|
// src/tools/simulate.ts
|
|
218
218
|
import { z as z3 } from "zod";
|
|
219
|
-
import {
|
|
219
|
+
import {
|
|
220
|
+
simulateSource,
|
|
221
|
+
simulateTransformer,
|
|
222
|
+
simulateDestination
|
|
223
|
+
} from "@walkeros/cli";
|
|
220
224
|
import { schemas as schemas3 } from "@walkeros/cli/dev";
|
|
221
225
|
import { mcpResult as mcpResult3, mcpError as mcpError3 } from "@walkeros/core";
|
|
222
226
|
function registerFlowSimulateTool(server2) {
|
|
@@ -224,11 +228,11 @@ function registerFlowSimulateTool(server2) {
|
|
|
224
228
|
"flow_simulate",
|
|
225
229
|
{
|
|
226
230
|
title: "Simulate Flow",
|
|
227
|
-
description: 'Simulate events through a walkerOS flow without making real API calls. For destinations: event is a walkerOS event { name: "entity action", data: {...} }. For sources: event is { content: ..., trigger?: { type?, options? }, env?: {...} }. Use step to target a specific step. Use flow_examples to discover available test data.',
|
|
231
|
+
description: 'Simulate events through a walkerOS flow without making real API calls. For destinations: event is a walkerOS event { name: "entity action", data: {...} }. For sources: event is { content: ..., trigger?: { type?, options? }, env?: {...} }. Use step to target a specific step. Use flow_examples to discover available test data. IMPORTANT: Destinations with require (e.g. require: ["consent"]) stay pending until that collector event fires \u2014 simulation will error "not found" if require is not satisfied. Remove require from config or provide consent/user events before simulating. Separately, destinations with consent (e.g. consent: { marketing: true }) only receive events where the event includes matching consent. Mapping transforms event names and data at the destination level. Policy redacts or injects fields before mapping runs.',
|
|
228
232
|
inputSchema: {
|
|
229
233
|
configPath: schemas3.SimulateInputShape.configPath,
|
|
230
234
|
event: z3.union([z3.record(z3.string(), z3.unknown()), z3.string()]).optional().describe(
|
|
231
|
-
"For destinations: { name, data }. For sources: { content, trigger?, env? }. Can also be a JSON string or file path."
|
|
235
|
+
"For destinations: { name, data, consent? }. Include consent (e.g. { marketing: true }) to satisfy destination consent requirements. For sources: { content, trigger?, env? }. Can also be a JSON string or file path."
|
|
232
236
|
),
|
|
233
237
|
flow: schemas3.SimulateInputShape.flow,
|
|
234
238
|
platform: schemas3.SimulateInputShape.platform,
|
|
@@ -250,22 +254,75 @@ function registerFlowSimulateTool(server2) {
|
|
|
250
254
|
"event is required. For sources provide { content, trigger? }, for destinations provide { name, data }."
|
|
251
255
|
);
|
|
252
256
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
|
|
257
|
+
if (!step) {
|
|
258
|
+
throw new Error(
|
|
259
|
+
'step is required. Specify a target like "source.browser", "destination.gtag", or "transformer.demo".'
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
let resolvedEvent = event;
|
|
263
|
+
if (typeof event === "string") {
|
|
264
|
+
try {
|
|
265
|
+
resolvedEvent = JSON.parse(event);
|
|
266
|
+
} catch {
|
|
267
|
+
throw new Error(
|
|
268
|
+
"Event string must be valid JSON. Got: " + event.substring(0, 50)
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const dotIndex = step.indexOf(".");
|
|
273
|
+
if (dotIndex === -1) {
|
|
274
|
+
throw new Error(
|
|
275
|
+
`Invalid step format "${step}". Use "type.name" (e.g. "source.browser", "destination.gtag").`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
const stepType = step.substring(0, dotIndex);
|
|
279
|
+
const stepId = step.substring(dotIndex + 1);
|
|
280
|
+
let result;
|
|
281
|
+
switch (stepType) {
|
|
282
|
+
case "source":
|
|
283
|
+
result = await simulateSource(configPath, resolvedEvent, {
|
|
284
|
+
sourceId: stepId,
|
|
285
|
+
flow,
|
|
286
|
+
silent: true
|
|
287
|
+
});
|
|
288
|
+
break;
|
|
289
|
+
case "transformer":
|
|
290
|
+
result = await simulateTransformer(
|
|
291
|
+
configPath,
|
|
292
|
+
resolvedEvent,
|
|
293
|
+
{
|
|
294
|
+
transformerId: stepId,
|
|
295
|
+
flow,
|
|
296
|
+
silent: true
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
break;
|
|
300
|
+
case "destination":
|
|
301
|
+
result = await simulateDestination(
|
|
302
|
+
configPath,
|
|
303
|
+
resolvedEvent,
|
|
304
|
+
{
|
|
305
|
+
destinationId: stepId,
|
|
306
|
+
flow,
|
|
307
|
+
silent: true
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
break;
|
|
311
|
+
default:
|
|
312
|
+
throw new Error(
|
|
313
|
+
`Unknown step type "${stepType}". Use "source", "transformer", or "destination".`
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
if (result.captured && result.captured.length > 0) {
|
|
317
|
+
const eventCount = result.captured.length;
|
|
261
318
|
const summary2 = `Source captured ${eventCount} event${eventCount !== 1 ? "s" : ""}`;
|
|
262
319
|
return mcpResult3(
|
|
263
320
|
{
|
|
264
|
-
success:
|
|
265
|
-
error:
|
|
321
|
+
success: result.success,
|
|
322
|
+
error: result.error,
|
|
266
323
|
summary: summary2,
|
|
267
|
-
capturedEvents:
|
|
268
|
-
duration:
|
|
324
|
+
capturedEvents: result.captured,
|
|
325
|
+
duration: result.duration
|
|
269
326
|
},
|
|
270
327
|
{
|
|
271
328
|
next: eventCount > 0 ? [
|
|
@@ -277,14 +334,20 @@ function registerFlowSimulateTool(server2) {
|
|
|
277
334
|
);
|
|
278
335
|
}
|
|
279
336
|
const destinations = {};
|
|
280
|
-
if (
|
|
281
|
-
|
|
337
|
+
if (result.elbResult && typeof result.elbResult === "object" && "done" in result.elbResult && result.elbResult.done) {
|
|
338
|
+
const done = result.elbResult.done;
|
|
339
|
+
for (const name of Object.keys(done)) {
|
|
340
|
+
destinations[name] = { received: true, calls: 0 };
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (result.usage) {
|
|
344
|
+
for (const [name, calls] of Object.entries(result.usage)) {
|
|
282
345
|
const summary2 = {
|
|
283
346
|
received: calls.length > 0,
|
|
284
347
|
calls: calls.length
|
|
285
348
|
};
|
|
286
349
|
if (verbose && calls.length > 0) {
|
|
287
|
-
summary2.payload = calls
|
|
350
|
+
summary2.payload = calls;
|
|
288
351
|
}
|
|
289
352
|
destinations[name] = summary2;
|
|
290
353
|
}
|
|
@@ -294,28 +357,30 @@ function registerFlowSimulateTool(server2) {
|
|
|
294
357
|
(d) => d.received
|
|
295
358
|
).length;
|
|
296
359
|
const warnings = [];
|
|
297
|
-
if (destCount === 0) {
|
|
298
|
-
warnings.push("No destinations found in flow configuration.");
|
|
299
|
-
}
|
|
300
|
-
if (destCount > 0 && receivedCount === 0) {
|
|
360
|
+
if (stepType === "destination" && destCount === 0) {
|
|
301
361
|
warnings.push(
|
|
302
|
-
|
|
362
|
+
'Destination did not receive the event. Common causes: (1) destination config has consent: { marketing: true } but event lacks matching consent, (2) mapping rules do not match the event name, (3) policy redacted required fields. Add consent to the event: { name: "...", data: {...}, consent: { marketing: true } }.'
|
|
303
363
|
);
|
|
304
364
|
}
|
|
305
|
-
const summary = `${receivedCount}/${destCount} destinations received the event`;
|
|
306
|
-
const
|
|
307
|
-
success:
|
|
308
|
-
error:
|
|
365
|
+
const summary = stepType === "transformer" ? `Transformer processed event` : `${receivedCount}/${destCount} destinations received the event`;
|
|
366
|
+
const resultObj = {
|
|
367
|
+
success: result.success,
|
|
368
|
+
error: result.error,
|
|
309
369
|
summary,
|
|
310
370
|
destinations: destCount > 0 ? destinations : void 0,
|
|
311
|
-
duration:
|
|
371
|
+
duration: result.duration
|
|
312
372
|
};
|
|
313
|
-
return mcpResult3(
|
|
373
|
+
return mcpResult3(resultObj, {
|
|
314
374
|
next: ["Use flow_bundle to build for production"],
|
|
315
375
|
...warnings.length > 0 ? { warnings } : {}
|
|
316
376
|
});
|
|
317
377
|
} catch (error) {
|
|
318
|
-
|
|
378
|
+
const msg = error instanceof Error ? error.message : "";
|
|
379
|
+
let hint = "Run flow_validate for detailed error messages";
|
|
380
|
+
if (msg.includes("not found in collector")) {
|
|
381
|
+
hint = 'If this destination has require: ["consent"] or require: ["user"], it stays pending until that event fires. For simulation, either remove require from the config or simulate with a flow that omits require on the target destination.';
|
|
382
|
+
}
|
|
383
|
+
return mcpError3(error, hint);
|
|
319
384
|
}
|
|
320
385
|
}
|
|
321
386
|
);
|
|
@@ -499,13 +564,27 @@ async function fetchCatalog(filters) {
|
|
|
499
564
|
}
|
|
500
565
|
let entries;
|
|
501
566
|
try {
|
|
502
|
-
entries = await fetchFromNpm();
|
|
567
|
+
entries = filters?.baseUrl ? await fetchCatalogFrom(filters.baseUrl, filters) : await fetchFromNpm();
|
|
503
568
|
} catch {
|
|
504
|
-
|
|
569
|
+
try {
|
|
570
|
+
entries = await fetchFromNpm();
|
|
571
|
+
} catch {
|
|
572
|
+
return [];
|
|
573
|
+
}
|
|
505
574
|
}
|
|
506
575
|
cache = { entries, timestamp: Date.now() };
|
|
507
576
|
return applyFilters(entries, filters);
|
|
508
577
|
}
|
|
578
|
+
async function fetchCatalogFrom(baseUrl, filters) {
|
|
579
|
+
const params = new URLSearchParams();
|
|
580
|
+
if (filters?.type) params.set("type", filters.type);
|
|
581
|
+
if (filters?.platform) params.set("platform", filters.platform);
|
|
582
|
+
const url = `${baseUrl}/api/packages${params.toString() ? `?${params}` : ""}`;
|
|
583
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(15e3) });
|
|
584
|
+
if (!res.ok) throw new Error(`Catalog fetch failed: ${res.status}`);
|
|
585
|
+
const data = await res.json();
|
|
586
|
+
return data.catalog;
|
|
587
|
+
}
|
|
509
588
|
async function fetchFromNpm() {
|
|
510
589
|
const res = await fetch(`${NPM_SEARCH_URL}?text=@walkeros/&size=250`, {
|
|
511
590
|
signal: AbortSignal.timeout(1e4)
|
|
@@ -559,7 +638,7 @@ function registerPackageSearchTool(server2) {
|
|
|
559
638
|
"package_search",
|
|
560
639
|
{
|
|
561
640
|
title: "Search Package",
|
|
562
|
-
description: "
|
|
641
|
+
description: "Start here for package discovery. Never guess package names \u2014 use this tool first to find exact names. Without package name: returns catalog filtered by type/platform. With package name: returns metadata, hint keys, and example summaries.",
|
|
563
642
|
inputSchema: {
|
|
564
643
|
package: z6.string().min(1).optional().describe(
|
|
565
644
|
"Exact npm package name for detailed lookup (e.g., @walkeros/web-destination-snowplow)"
|
|
@@ -579,15 +658,16 @@ function registerPackageSearchTool(server2) {
|
|
|
579
658
|
}
|
|
580
659
|
},
|
|
581
660
|
async ({ package: packageName, type, platform, version }) => {
|
|
661
|
+
const baseUrl = process.env.APP_URL || void 0;
|
|
582
662
|
if (!packageName) {
|
|
583
|
-
const catalog = await fetchCatalog({ type, platform });
|
|
663
|
+
const catalog = await fetchCatalog({ type, platform, baseUrl });
|
|
584
664
|
const result = { catalog, count: catalog.length };
|
|
585
665
|
return mcpResult6(result, {
|
|
586
666
|
next: ["Use package_get for schemas and examples"]
|
|
587
667
|
});
|
|
588
668
|
}
|
|
589
669
|
try {
|
|
590
|
-
const info = await fetchPackage(packageName, { version });
|
|
670
|
+
const info = await fetchPackage(packageName, { version, baseUrl });
|
|
591
671
|
const result = {
|
|
592
672
|
package: info.packageName,
|
|
593
673
|
version: info.version,
|
|
@@ -614,7 +694,7 @@ function registerGetPackageSchemaTool(server2) {
|
|
|
614
694
|
"package_get",
|
|
615
695
|
{
|
|
616
696
|
title: "Get Package",
|
|
617
|
-
description: '
|
|
697
|
+
description: 'Requires exact package name \u2014 do not guess names, use package_search first to find them. Returns schemas + hint texts + example summaries by default (lightweight). Use section parameter for full content: "hints" (with code blocks), "examples" (full in/out data), or "all".',
|
|
618
698
|
inputSchema: {
|
|
619
699
|
package: z6.string().min(1).describe(
|
|
620
700
|
"Exact npm package name (e.g., @walkeros/web-destination-snowplow)"
|
|
@@ -633,8 +713,9 @@ function registerGetPackageSchemaTool(server2) {
|
|
|
633
713
|
}
|
|
634
714
|
},
|
|
635
715
|
async ({ package: packageName, version, section }) => {
|
|
716
|
+
const baseUrl = process.env.APP_URL || void 0;
|
|
636
717
|
try {
|
|
637
|
-
const info = await fetchPackage(packageName, { version });
|
|
718
|
+
const info = await fetchPackage(packageName, { version, baseUrl });
|
|
638
719
|
const mergedSchemas = {};
|
|
639
720
|
if (info.type) {
|
|
640
721
|
mergedSchemas.config = mergeConfigSchema(
|
|
@@ -816,7 +897,7 @@ function registerFeedbackTool(server2) {
|
|
|
816
897
|
writeConfig({ ...base, anonymousFeedback: anonymous });
|
|
817
898
|
}
|
|
818
899
|
const isAnonymous = explicitAnonymous ?? anonymous ?? true;
|
|
819
|
-
await feedback(text, { anonymous: isAnonymous, version: "3.
|
|
900
|
+
await feedback(text, { anonymous: isAnonymous, version: "3.2.0-next-1775064795590" });
|
|
820
901
|
return mcpResult8({ ok: true });
|
|
821
902
|
} catch (error) {
|
|
822
903
|
return mcpError8(error);
|
|
@@ -1464,9 +1545,10 @@ function registerAddStepPrompt(server2) {
|
|
|
1464
1545
|
"4. Scaffold the step config using the package schemas \u2014 include required settings with placeholder values.",
|
|
1465
1546
|
"5. Wire the step into the flow: add to packages section (with version if needed), connect via next/before chains if needed.",
|
|
1466
1547
|
'6. For destinations: configure mapping using nested entity \u2192 action keys. Event "product add" maps to `{ "product": { "add": { name: "AddToCart" } } }`. Use the setup-mapping prompt for guidance.',
|
|
1467
|
-
|
|
1468
|
-
"8.
|
|
1469
|
-
"9.
|
|
1548
|
+
'7. For destinations: if consent-gated loading is needed, add require: ["consent"] to config. Note: require delays initialization until a "walker consent" event fires. When simulating with flow_simulate, destinations with require will error "not found" \u2014 remove require temporarily or test without it. For per-event consent filtering, add consent: { marketing: true } to config.',
|
|
1549
|
+
"8. Use flow_validate to verify the result.",
|
|
1550
|
+
"9. For server sources: check if the package supports `ingest` configuration via package_get. Ingest extracts request metadata (IP, user-agent, headers) using mapping syntax. Transformers like fingerprint depend on ingest data.",
|
|
1551
|
+
"10. When adding a transformer that uses ingest fields, verify the source has `ingest` configured \u2014 otherwise ingest fields resolve to empty values.",
|
|
1470
1552
|
"",
|
|
1471
1553
|
"Important:",
|
|
1472
1554
|
"- Read the walkeros://reference/flow-schema resource to understand connection rules.",
|
|
@@ -1514,7 +1596,13 @@ function registerSetupMappingPrompt(server2) {
|
|
|
1514
1596
|
"",
|
|
1515
1597
|
'Mapping uses nested entity \u2192 action keys. Event "product add" maps to `{ "product": { "add": Rule } }`. Wildcards: `{ "*": { "view": Rule } }`.',
|
|
1516
1598
|
"",
|
|
1517
|
-
"Use $def references for shared mapping patterns across destinations."
|
|
1599
|
+
"Use $def references for shared mapping patterns across destinations.",
|
|
1600
|
+
"",
|
|
1601
|
+
"Policy and consent in mapping:",
|
|
1602
|
+
"- config.policy runs BEFORE mapping rules \u2014 use it to inject or redact fields on the event.",
|
|
1603
|
+
"- rule.policy runs after config.policy but before data transformation \u2014 use for event-specific pre-processing.",
|
|
1604
|
+
"- config.consent gates ALL events to this destination. rule.consent gates specific event types.",
|
|
1605
|
+
"- Individual value configs support consent: { marketing: true } for field-level gating."
|
|
1518
1606
|
].join("\n")
|
|
1519
1607
|
}
|
|
1520
1608
|
}
|
|
@@ -1620,19 +1708,36 @@ function registerUseDefinitionsPrompt(server2) {
|
|
|
1620
1708
|
var server = new McpServer(
|
|
1621
1709
|
{
|
|
1622
1710
|
name: "walkeros-flow",
|
|
1623
|
-
version: "3.
|
|
1711
|
+
version: "3.2.0-next-1775064795590"
|
|
1624
1712
|
},
|
|
1625
1713
|
{
|
|
1626
1714
|
instructions: `walkerOS is an open-source, privacy-first event data collection platform. Define event pipelines as code using JSON flow configurations.
|
|
1627
1715
|
|
|
1716
|
+
## Rules
|
|
1717
|
+
|
|
1718
|
+
- **Never guess package names.** Always use \`package_search\` first to find exact names, then \`package_get\` for details.
|
|
1719
|
+
- **Never construct flow configs from memory.** Read \`walkeros://reference/flow-schema\` and use \`package_get\` for package-specific schemas.
|
|
1720
|
+
- **Always validate.** Run \`flow_validate\` after every config change. If validation fails, fix and re-validate.
|
|
1721
|
+
- **Simulate before deploying.** Use \`flow_simulate\` to test with mocked API calls before \`flow_bundle\` or \`flow_push\`.
|
|
1722
|
+
|
|
1723
|
+
## Workflow
|
|
1724
|
+
|
|
1725
|
+
1. \`flow_load({ platform: "web" })\` or \`flow_load({ source: "./flow.json" })\` \u2014 create or load
|
|
1726
|
+
2. \`package_search({ type: "destination", platform: "web" })\` \u2014 discover packages
|
|
1727
|
+
3. \`package_get({ package: "..." })\` \u2014 read schemas, hints, examples
|
|
1728
|
+
4. Use the \`add-step\` prompt \u2014 guided step addition
|
|
1729
|
+
5. Use the \`setup-mapping\` prompt \u2014 event transformation config
|
|
1730
|
+
6. \`flow_validate({ type: "flow", input: "flow.json" })\` \u2014 verify
|
|
1731
|
+
7. \`flow_simulate({ configPath: "flow.json", event: "..." })\` \u2014 test
|
|
1732
|
+
8. \`flow_bundle({ configPath: "flow.json" })\` \u2014 build
|
|
1733
|
+
9. \`api({ action: "deploy", id: "cfg_..." })\` \u2014 deploy (requires WALKEROS_TOKEN)
|
|
1734
|
+
|
|
1628
1735
|
## Architecture: Source \u2192 Collector \u2192 Destination(s)
|
|
1629
1736
|
|
|
1630
1737
|
Every component in a flow is a **step**: sources capture events, transformers process them, destinations deliver them, stores provide shared state. Steps connect via \`next\` (pre-collector) and \`before\` (post-collector) chains.
|
|
1631
1738
|
|
|
1632
1739
|
## Flow Config Structure
|
|
1633
1740
|
|
|
1634
|
-
Every flow config follows this shape:
|
|
1635
|
-
|
|
1636
1741
|
\`\`\`json
|
|
1637
1742
|
{
|
|
1638
1743
|
"version": 3,
|
|
@@ -1646,38 +1751,28 @@ Every flow config follows this shape:
|
|
|
1646
1751
|
}
|
|
1647
1752
|
\`\`\`
|
|
1648
1753
|
|
|
1649
|
-
Event format: \`{ name: "entity action", data: {...}, entity: "...", action: "..." }\`. Sources convert raw input into this format.
|
|
1650
|
-
|
|
1651
|
-
Key rules:
|
|
1652
1754
|
- \`version: 3\` is required
|
|
1653
1755
|
- Each flow must have exactly one of \`web: {}\` or \`server: {}\`
|
|
1654
1756
|
- Destination settings go inside \`config.settings\`, not directly on the destination
|
|
1655
|
-
-
|
|
1656
|
-
|
|
1657
|
-
## Getting Started
|
|
1658
|
-
|
|
1659
|
-
1. \`flow_load({ platform: "web" })\` or \`flow_load({ source: "./flow.json" })\` \u2014 create or load a flow (also accepts inline JSON strings or URLs)
|
|
1660
|
-
2. \`package_search({ type: "destination", platform: "web" })\` \u2014 discover available packages
|
|
1661
|
-
3. Use the \`add-step\` prompt to add sources, destinations, transformers, or stores
|
|
1662
|
-
4. Use the \`setup-mapping\` prompt to configure event transformations
|
|
1663
|
-
5. \`flow_validate({ type: "flow", input: "flow.json" })\` \u2014 verify configuration
|
|
1664
|
-
6. \`flow_simulate({ configPath: "flow.json", event: "..." })\` \u2014 test with mocked API calls
|
|
1665
|
-
7. \`flow_bundle({ configPath: "flow.json" })\` \u2014 build deployable JavaScript
|
|
1666
|
-
8. \`api({ action: "deploy", id: "cfg_..." })\` \u2014 deploy to walkerOS cloud (requires WALKEROS_TOKEN env var; unavailable without it)
|
|
1667
|
-
|
|
1668
|
-
If validation fails, fix the reported errors and re-validate. Do not skip validation.
|
|
1669
|
-
|
|
1670
|
-
## Reference Resources
|
|
1671
|
-
|
|
1672
|
-
Read these before constructing configs manually: \`walkeros://reference/flow-schema\`, \`walkeros://reference/mapping\`, \`walkeros://reference/event-model\`, \`walkeros://reference/consent\`, \`walkeros://reference/variables\`, \`walkeros://reference/contract\`, \`walkeros://reference/examples\`.
|
|
1757
|
+
- Event format: \`{ name: "entity action", data: {...}, entity: "...", action: "..." }\`
|
|
1673
1758
|
|
|
1674
1759
|
## Key Concepts
|
|
1675
1760
|
|
|
1676
|
-
- **Steps** are sources, destinations, transformers, or stores \u2014 each backed by an npm package. Use \`package_search\` to browse, \`package_get\` for schemas and examples. \`package_get\` returns \`schemas.config\` \u2014 a merged JSON Schema combining base config fields (consent, require, logger, mapping, etc.) with the package's typed settings. Non-config schemas (mapping rules, utility schemas) remain as sibling keys.
|
|
1677
1761
|
- **Mapping** transforms events using data/map/loop/set/condition rules. Same syntax on sources and destinations. Mapping rules use NESTED entity \u2192 action keying: event name "product add" maps to \`{ "product": { "add": Rule } }\`. Wildcards: \`{ "*": { "view": Rule } }\`.
|
|
1678
1762
|
- **Contracts** define event schemas using entity-action keying. Can generate FROM mappings or scaffold mappings FROM contracts.
|
|
1679
1763
|
- **Variables** ($var, $env, $def, $code, $store) enable DRY, environment-aware config. Use the \`use-definitions\` prompt to extract shared patterns.
|
|
1680
|
-
- **Consent** gates destinations, mapping rules, and individual fields. Privacy-first by design
|
|
1764
|
+
- **Consent** gates destinations, mapping rules, and individual fields. Privacy-first by design.
|
|
1765
|
+
|
|
1766
|
+
## Simulation Tips
|
|
1767
|
+
|
|
1768
|
+
- Destinations with \`require: ["consent"]\` stay **pending** until a \`"walker consent"\` event fires. Simulation will error "not found" for pending destinations \u2014 remove \`require\` from config when testing with \`flow_simulate\`.
|
|
1769
|
+
- Destinations with \`consent: { marketing: true }\` silently skip events that lack matching consent. Include \`consent\` in the event: \`{ name: "page view", data: {...}, consent: { marketing: true } }\`.
|
|
1770
|
+
- **Mapping** transforms event names and data at the destination level. Events without a matching mapping rule pass through unmodified.
|
|
1771
|
+
- **Policy** modifies the event before mapping runs \u2014 use it to inject computed fields or redact sensitive data.
|
|
1772
|
+
|
|
1773
|
+
## Reference Resources
|
|
1774
|
+
|
|
1775
|
+
Read these before constructing configs manually: \`walkeros://reference/flow-schema\`, \`walkeros://reference/mapping\`, \`walkeros://reference/event-model\`, \`walkeros://reference/consent\`, \`walkeros://reference/variables\`, \`walkeros://reference/contract\`, \`walkeros://reference/examples\`.`
|
|
1681
1776
|
}
|
|
1682
1777
|
);
|
|
1683
1778
|
registerFlowValidateTool(server);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/tools/validate.ts","../src/schemas/output.ts","../src/tools/bundle.ts","../src/tools/simulate.ts","../src/tools/push.ts","../src/tools/examples.ts","../src/tools/package.ts","../src/catalog.ts","../src/tools/flow-load.ts","../src/tools/feedback.ts","../src/tools/api.ts","../src/schemas/api-output.ts","../src/resources/package-schemas.ts","../src/resources/references.ts","../src/prompts/add-step.ts","../src/prompts/setup-mapping.ts","../src/prompts/manage-contract.ts","../src/prompts/use-definitions.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { registerFlowValidateTool } from './tools/validate.js';\nimport { registerFlowBundleTool } from './tools/bundle.js';\nimport { registerFlowSimulateTool } from './tools/simulate.js';\nimport { registerFlowPushTool } from './tools/push.js';\nimport { registerFlowExamplesTool } from './tools/examples.js';\nimport {\n registerPackageSearchTool,\n registerGetPackageSchemaTool,\n} from './tools/package.js';\nimport { registerFlowLoadTool } from './tools/flow-load.js';\nimport { registerFeedbackTool } from './tools/feedback.js';\nimport { registerApiTool } from './tools/api.js';\nimport { registerPackageSchemaResources } from './resources/package-schemas.js';\nimport { registerReferenceResources } from './resources/references.js';\nimport { registerAddStepPrompt } from './prompts/add-step.js';\nimport { registerSetupMappingPrompt } from './prompts/setup-mapping.js';\nimport { registerManageContractPrompt } from './prompts/manage-contract.js';\nimport { registerUseDefinitionsPrompt } from './prompts/use-definitions.js';\n\ndeclare const __VERSION__: string;\n\nconst server = new McpServer(\n {\n name: 'walkeros-flow',\n version: __VERSION__,\n },\n {\n instructions: `walkerOS is an open-source, privacy-first event data collection platform. Define event pipelines as code using JSON flow configurations.\n\n## Architecture: Source → Collector → Destination(s)\n\nEvery component in a flow is a **step**: sources capture events, transformers process them, destinations deliver them, stores provide shared state. Steps connect via \\`next\\` (pre-collector) and \\`before\\` (post-collector) chains.\n\n## Flow Config Structure\n\nEvery flow config follows this shape:\n\n\\`\\`\\`json\n{\n \"version\": 3,\n \"flows\": {\n \"default\": {\n \"web\": {},\n \"sources\": { \"<name>\": { \"package\": \"<npm-package>\", \"config\": {} } },\n \"destinations\": { \"<name>\": { \"package\": \"<npm-package>\", \"config\": { \"settings\": {} } } }\n }\n }\n}\n\\`\\`\\`\n\nEvent format: \\`{ name: \"entity action\", data: {...}, entity: \"...\", action: \"...\" }\\`. Sources convert raw input into this format.\n\nKey rules:\n- \\`version: 3\\` is required\n- Each flow must have exactly one of \\`web: {}\\` or \\`server: {}\\`\n- Destination settings go inside \\`config.settings\\`, not directly on the destination\n- Read \\`walkeros://reference/flow-schema\\` for the full annotated structure\n\n## Getting Started\n\n1. \\`flow_load({ platform: \"web\" })\\` or \\`flow_load({ source: \"./flow.json\" })\\` — create or load a flow (also accepts inline JSON strings or URLs)\n2. \\`package_search({ type: \"destination\", platform: \"web\" })\\` — discover available packages\n3. Use the \\`add-step\\` prompt to add sources, destinations, transformers, or stores\n4. Use the \\`setup-mapping\\` prompt to configure event transformations\n5. \\`flow_validate({ type: \"flow\", input: \"flow.json\" })\\` — verify configuration\n6. \\`flow_simulate({ configPath: \"flow.json\", event: \"...\" })\\` — test with mocked API calls\n7. \\`flow_bundle({ configPath: \"flow.json\" })\\` — build deployable JavaScript\n8. \\`api({ action: \"deploy\", id: \"cfg_...\" })\\` — deploy to walkerOS cloud (requires WALKEROS_TOKEN env var; unavailable without it)\n\nIf validation fails, fix the reported errors and re-validate. Do not skip validation.\n\n## Reference Resources\n\nRead these before constructing configs manually: \\`walkeros://reference/flow-schema\\`, \\`walkeros://reference/mapping\\`, \\`walkeros://reference/event-model\\`, \\`walkeros://reference/consent\\`, \\`walkeros://reference/variables\\`, \\`walkeros://reference/contract\\`, \\`walkeros://reference/examples\\`.\n\n## Key Concepts\n\n- **Steps** are sources, destinations, transformers, or stores — each backed by an npm package. Use \\`package_search\\` to browse, \\`package_get\\` for schemas and examples. \\`package_get\\` returns \\`schemas.config\\` — a merged JSON Schema combining base config fields (consent, require, logger, mapping, etc.) with the package's typed settings. Non-config schemas (mapping rules, utility schemas) remain as sibling keys.\n- **Mapping** transforms events using data/map/loop/set/condition rules. Same syntax on sources and destinations. Mapping rules use NESTED entity → action keying: event name \"product add\" maps to \\`{ \"product\": { \"add\": Rule } }\\`. Wildcards: \\`{ \"*\": { \"view\": Rule } }\\`.\n- **Contracts** define event schemas using entity-action keying. Can generate FROM mappings or scaffold mappings FROM contracts.\n- **Variables** (\\$var, \\$env, \\$def, \\$code, \\$store) enable DRY, environment-aware config. Use the \\`use-definitions\\` prompt to extract shared patterns.\n- **Consent** gates destinations, mapping rules, and individual fields. Privacy-first by design.`,\n },\n);\n\nregisterFlowValidateTool(server);\nregisterFlowBundleTool(server);\nregisterFlowSimulateTool(server);\nregisterFlowPushTool(server);\nregisterFlowExamplesTool(server);\nregisterPackageSearchTool(server);\nregisterGetPackageSchemaTool(server);\nregisterFlowLoadTool(server);\nregisterFeedbackTool(server);\nregisterPackageSchemaResources(server);\nregisterReferenceResources(server);\nregisterAddStepPrompt(server);\nregisterSetupMappingPrompt(server);\nregisterManageContractPrompt(server);\nregisterUseDefinitionsPrompt(server);\n\nif (process.env.WALKEROS_TOKEN) {\n registerApiTool(server);\n}\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('walkerOS Flow MCP server running on stdio');\n}\n\nmain().catch((error) => {\n console.error('Failed to start Flow MCP server:', error);\n process.exit(1);\n});\n","import { validate } from '@walkeros/cli';\nimport type { ValidateResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { ValidateOutputShape } from '../schemas/output.js';\n\nexport function registerFlowValidateTool(server: McpServer) {\n server.registerTool(\n 'flow_validate',\n {\n title: 'Validate Flow',\n description:\n 'Validate walkerOS events, flow configurations, mapping rules, or data contracts. ' +\n 'Accepts JSON strings, file paths, or URLs as input. ' +\n 'Returns validation results with errors, warnings, and details.',\n inputSchema: schemas.ValidateInputShape,\n outputSchema: ValidateOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ type, input, flow, path }) => {\n try {\n const result: ValidateResult = await validate(type, input, {\n flow,\n path,\n });\n const hints = result.valid\n ? {\n next: [\n 'Use flow_simulate to test event flow',\n 'Use flow_bundle to build',\n ],\n }\n : {\n next: [\n 'Fix errors above, then run flow_validate again',\n 'Read walkeros://reference/flow-schema for correct structure',\n ],\n };\n return mcpResult(result, hints);\n } catch (error) {\n return mcpError(\n error,\n 'Check the input parameter — expected a JSON string, file path, or URL',\n );\n }\n },\n );\n}\n","import { z } from 'zod';\n\n// CLI tool output shapes\nexport const ValidateOutputShape = {\n valid: z.boolean().describe('Whether validation passed'),\n type: z\n .union([\n z.enum(['contract', 'entry', 'event', 'flow', 'mapping']),\n z.string().regex(/^(destinations|sources|transformers)\\.\\w+$/),\n ])\n .describe('What was validated'),\n errors: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n value: z.unknown().optional(),\n code: z.string().optional(),\n }),\n )\n .describe('Validation errors'),\n warnings: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n suggestion: z.string().optional(),\n }),\n )\n .describe('Validation warnings'),\n details: z\n .record(z.string(), z.unknown())\n .describe('Additional validation details'),\n};\n\nexport const BundleOutputShape = {\n success: z.boolean().describe('Whether bundling succeeded'),\n totalSize: z.number().optional().describe('Total bundle size in bytes'),\n buildTime: z.number().optional().describe('Build time in milliseconds'),\n packages: z\n .array(\n z.object({\n name: z.string(),\n size: z.number(),\n }),\n )\n .optional()\n .describe('Per-package size breakdown'),\n treeshakingEffective: z\n .boolean()\n .optional()\n .describe('Whether tree-shaking was effective'),\n message: z.string().optional().describe('Status message'),\n};\n\nexport const SimulateOutputShape = {\n success: z.boolean().describe('Whether simulation succeeded'),\n error: z.string().optional().describe('Error message if failed'),\n summary: z.string().describe('One-line result summary'),\n destinations: z\n .record(\n z.string(),\n z.object({\n received: z\n .boolean()\n .describe('Whether destination received the event'),\n calls: z.number().describe('Number of API calls made'),\n payload: z\n .unknown()\n .optional()\n .describe('Full payload (only when verbose: true)'),\n }),\n )\n .optional()\n .describe('Per-destination results'),\n capturedEvents: z\n .array(z.record(z.string(), z.unknown()))\n .optional()\n .describe('Events captured by source simulation'),\n duration: z.number().optional().describe('Simulation duration in ms'),\n};\n\nexport const PushOutputShape = {\n success: z.boolean().describe('Whether push succeeded'),\n elbResult: z.unknown().optional().describe('Push result from the collector'),\n duration: z.number().describe('Push duration in milliseconds'),\n error: z.string().optional().describe('Error message if push failed'),\n};\n\n// Examples List output shape\nexport const ExamplesListOutputShape = {\n flow: z.string().describe('Flow name'),\n count: z.number().describe('Number of examples found'),\n examples: z\n .array(\n z.object({\n step: z.string().describe('Step location (e.g., \"destination.gtag\")'),\n stepType: z\n .enum(['source', 'transformer', 'destination'])\n .describe('Step type'),\n stepName: z.string().describe('Step name'),\n exampleName: z.string().describe('Example name'),\n hasIn: z.boolean().describe('Whether the example has an input value'),\n hasOut: z.boolean().describe('Whether the example has an output value'),\n hasMapping: z\n .boolean()\n .describe('Whether the example has a mapping configuration'),\n hasTrigger: z\n .boolean()\n .describe('Whether the example has trigger metadata'),\n in: z.unknown().optional().describe('Input event data'),\n out: z.unknown().optional().describe('Expected output data'),\n mapping: z\n .unknown()\n .optional()\n .describe('Mapping configuration for destinations'),\n trigger: z\n .object({\n type: z.string().optional(),\n options: z.unknown().optional(),\n })\n .optional()\n .describe('Trigger metadata for source simulation'),\n }),\n )\n .describe('Step examples'),\n};\n","import { z } from 'zod';\nimport { bundle, bundleRemote } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { BundleOutputShape } from '../schemas/output.js';\n\nexport function registerFlowBundleTool(server: McpServer) {\n server.registerTool(\n 'flow_bundle',\n {\n title: 'Bundle Flow',\n description:\n 'Bundle a walkerOS flow configuration into deployable JavaScript. ' +\n 'Resolves all destinations, sources, and transformers, then outputs ' +\n 'a tree-shaken production bundle. Returns bundle statistics. ' +\n 'Set remote: true to use the walkerOS cloud service instead of local build tools.',\n inputSchema: {\n ...schemas.BundleInputShape,\n remote: z\n .boolean()\n .optional()\n .describe(\n 'Use remote cloud bundling (requires WALKEROS_TOKEN). Default: false (local)',\n ),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Flow.Config JSON content (required when remote: true)'),\n },\n outputSchema: BundleOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async ({ configPath, flow, stats, output, remote, content }) => {\n try {\n if (remote) {\n if (!content)\n throw new Error('content is required when remote: true');\n const result = await bundleRemote({\n content: content as Record<string, unknown>,\n flowName: flow,\n });\n return mcpResult(\n { success: true, ...result },\n {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n },\n );\n }\n\n const result = await bundle(configPath, {\n flowName: flow,\n stats: stats ?? true,\n buildOverrides: output ? { output } : undefined,\n });\n\n if (!result) {\n return mcpResult(\n { success: false, message: 'Bundle produced no output' },\n {\n warnings: [\n 'The build returned no result. The flow may be empty or misconfigured.',\n ],\n next: ['Run flow_validate to check your configuration'],\n },\n );\n }\n\n const output_ = result as unknown as Record<string, unknown>;\n\n return mcpResult(\n { success: true, ...output_ },\n {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n },\n );\n } catch (error) {\n return mcpError(error, 'Run flow_validate for detailed error messages');\n }\n },\n );\n}\n","import { z } from 'zod';\nimport { simulate } from '@walkeros/cli';\nimport type { SimulationResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { SimulateOutputShape } from '../schemas/output.js';\n\ninterface DestinationSummary {\n received: boolean;\n calls: number;\n payload?: unknown;\n}\n\nexport function registerFlowSimulateTool(server: McpServer) {\n server.registerTool(\n 'flow_simulate',\n {\n title: 'Simulate Flow',\n description:\n 'Simulate events through a walkerOS flow without making real API calls. ' +\n 'For destinations: event is a walkerOS event { name: \"entity action\", data: {...} }. ' +\n 'For sources: event is { content: ..., trigger?: { type?, options? }, env?: {...} }. ' +\n 'Use step to target a specific step. ' +\n 'Use flow_examples to discover available test data.',\n inputSchema: {\n configPath: schemas.SimulateInputShape.configPath,\n event: z\n .union([z.record(z.string(), z.unknown()), z.string()])\n .optional()\n .describe(\n 'For destinations: { name, data }. For sources: { content, trigger?, env? }. ' +\n 'Can also be a JSON string or file path.',\n ),\n flow: schemas.SimulateInputShape.flow,\n platform: schemas.SimulateInputShape.platform,\n step: schemas.SimulateInputShape.step,\n verbose: z\n .boolean()\n .optional()\n .describe('Include full payload per destination (default: false)'),\n },\n outputSchema: SimulateOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ configPath, event, flow, platform, step, verbose }) => {\n try {\n if (!event) {\n throw new Error(\n 'event is required. For sources provide { content, trigger? }, for destinations provide { name, data }.',\n );\n }\n\n const raw: SimulationResult = await simulate(configPath, event, {\n json: true,\n flow,\n platform,\n step,\n });\n\n // Source simulation returns capturedEvents\n if (raw.capturedEvents) {\n const eventCount = raw.capturedEvents.length;\n const summary = `Source captured ${eventCount} event${eventCount !== 1 ? 's' : ''}`;\n\n return mcpResult(\n {\n success: raw.success,\n error: raw.error,\n summary,\n capturedEvents: raw.capturedEvents,\n duration: raw.duration,\n },\n {\n next:\n eventCount > 0\n ? [\n 'Use flow_simulate with a destination step to test downstream processing',\n ]\n : [\n 'Check source package examples with package_get, verify trigger type matches',\n ],\n },\n );\n }\n\n // Destination/transformer simulation\n const destinations: Record<string, DestinationSummary> = {};\n\n if (raw.usage) {\n for (const [name, calls] of Object.entries(raw.usage)) {\n const summary: DestinationSummary = {\n received: calls.length > 0,\n calls: calls.length,\n };\n if (verbose && calls.length > 0) {\n summary.payload = calls[calls.length - 1];\n }\n destinations[name] = summary;\n }\n }\n\n const destCount = Object.keys(destinations).length;\n const receivedCount = Object.values(destinations).filter(\n (d) => d.received,\n ).length;\n\n const warnings: string[] = [];\n if (destCount === 0) {\n warnings.push('No destinations found in flow configuration.');\n }\n if (destCount > 0 && receivedCount === 0) {\n warnings.push(\n 'No destinations received the event. Check: mapping keys use nested entity→action structure, event name matches, consent is granted.',\n );\n }\n\n const summary = `${receivedCount}/${destCount} destinations received the event`;\n\n const result = {\n success: raw.success,\n error: raw.error,\n summary,\n destinations: destCount > 0 ? destinations : undefined,\n duration: raw.duration,\n };\n\n return mcpResult(result, {\n next: ['Use flow_bundle to build for production'],\n ...(warnings.length > 0 ? { warnings } : {}),\n });\n } catch (error) {\n return mcpError(error, 'Run flow_validate for detailed error messages');\n }\n },\n );\n}\n","import { z } from 'zod';\nimport { push } from '@walkeros/cli';\nimport type { PushResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { PushOutputShape } from '../schemas/output.js';\n\nexport function registerFlowPushTool(server: McpServer) {\n server.registerTool(\n 'flow_push',\n {\n title: 'Push Events',\n description:\n 'Push a real event through a walkerOS flow to actual destinations. ' +\n 'Makes real API calls to real endpoints. ' +\n 'Best suited for server-side flows — web flows should use flow_simulate for testing.',\n inputSchema: {\n configPath: schemas.PushInputShape.configPath,\n event: z\n .record(z.string(), z.unknown())\n .describe(\n 'Event object, e.g. { name: \"page view\", data: { title: \"Home\" } }',\n ),\n flow: schemas.PushInputShape.flow,\n platform: schemas.PushInputShape.platform,\n },\n outputSchema: PushOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async ({ configPath, event, flow, platform }) => {\n try {\n const result: PushResult = await push(configPath, event, {\n json: true,\n flow,\n platform,\n });\n\n if (!result.success) {\n return mcpError(\n new Error(result.error || 'Push failed'),\n 'Check destination configuration and connectivity.',\n );\n }\n\n return mcpResult(result);\n } catch (error) {\n return mcpError(\n error,\n 'Check configPath and event format. For web flows, use flow_simulate.',\n );\n }\n },\n );\n}\n","import { z } from 'zod';\nimport { loadJsonConfig } from '@walkeros/cli';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport type { Flow } from '@walkeros/core';\nimport { ExamplesListOutputShape } from '../schemas/output.js';\n\nexport function registerFlowExamplesTool(server: McpServer) {\n server.registerTool(\n 'flow_examples',\n {\n title: 'Flow Examples',\n description:\n 'List all step examples in a walkerOS flow configuration. ' +\n 'Shows example names, step locations, and in/out shapes. ' +\n 'Use this to discover available test fixtures and simulation data.',\n inputSchema: {\n configPath: z\n .string()\n .min(1)\n .describe(\n 'Path to flow configuration file, URL, or inline JSON string',\n ),\n flow: z\n .string()\n .optional()\n .describe('Flow name for multi-flow configs'),\n step: z\n .string()\n .optional()\n .describe('Filter to a specific step (e.g., \"destination.gtag\")'),\n full: z\n .boolean()\n .optional()\n .describe(\n 'Return full in/out/mapping data for each example (default: false, returns metadata only)',\n ),\n },\n outputSchema: ExamplesListOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ configPath, flow, step, full }) => {\n try {\n const rawConfig = await loadJsonConfig<Flow.Config>(configPath);\n\n // Resolve flow name\n const flowNames = Object.keys(rawConfig.flows || {});\n const flowName =\n flow || (flowNames.length === 1 ? flowNames[0] : undefined);\n\n if (!flowName) {\n throw new Error(\n `Multiple flows found. Specify flow parameter. Available: ${flowNames.join(', ')}`,\n );\n }\n\n const flowSettings = rawConfig.flows[flowName];\n if (!flowSettings) {\n throw new Error(`Flow \"${flowName}\" not found`);\n }\n\n // Collect all examples\n const examples: Array<{\n step: string;\n stepType: string;\n stepName: string;\n exampleName: string;\n hasIn: boolean;\n hasOut: boolean;\n hasMapping: boolean;\n hasTrigger: boolean;\n in?: unknown;\n out?: unknown;\n mapping?: unknown;\n trigger?: unknown;\n }> = [];\n\n const stepTypes = [\n { key: 'sources' as const, type: 'source' },\n { key: 'transformers' as const, type: 'transformer' },\n { key: 'destinations' as const, type: 'destination' },\n ];\n\n for (const { key, type } of stepTypes) {\n const refs = flowSettings[key] || {};\n for (const [name, ref] of Object.entries(refs)) {\n if (!ref.examples) continue;\n\n // Apply step filter\n if (step && `${type}.${name}` !== step) continue;\n\n for (const [exName, ex] of Object.entries(\n ref.examples as Flow.StepExamples,\n )) {\n examples.push({\n step: `${type}.${name}`,\n stepType: type,\n stepName: name,\n exampleName: exName,\n hasIn: ex.in !== undefined,\n hasOut: ex.out !== undefined,\n hasMapping: ex.mapping !== undefined,\n hasTrigger: ex.trigger !== undefined,\n ...(full\n ? {\n in: ex.in,\n out: ex.out,\n mapping: ex.mapping,\n trigger: ex.trigger,\n }\n : {}),\n });\n }\n }\n }\n\n const result = {\n flow: flowName,\n count: examples.length,\n examples,\n };\n\n const hints: { next: string[]; warnings?: string[] } = {\n next: ['Use flow_simulate with step and event to simulate'],\n };\n if (examples.length === 0) {\n hints.warnings = [\n 'No examples found. Add examples to step definitions in your flow config for testing.',\n ];\n }\n return mcpResult(result, hints);\n } catch (error) {\n return mcpError(error, 'Check configPath — expected a flow.json file');\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n fetchPackage,\n mergeConfigSchema,\n mcpResult,\n mcpError,\n} from '@walkeros/core';\nimport { fetchCatalog, normalizePlatform } from '../catalog.js';\n\nexport function registerPackageSearchTool(server: McpServer) {\n server.registerTool(\n 'package_search',\n {\n title: 'Search Package',\n description:\n 'Browse walkerOS packages or look up a specific one. Without package name: returns catalog ' +\n 'filtered by type/platform. With package name: returns metadata, hint keys, and example summaries.',\n inputSchema: {\n package: z\n .string()\n .min(1)\n .optional()\n .describe(\n 'Exact npm package name for detailed lookup (e.g., @walkeros/web-destination-snowplow)',\n ),\n type: z\n .enum(['source', 'destination', 'transformer', 'store'])\n .optional()\n .describe('Filter by package type (browse mode)'),\n platform: z\n .enum(['web', 'server'])\n .optional()\n .describe(\n 'Filter by platform (browse mode, includes universal packages)',\n ),\n version: z\n .string()\n .optional()\n .describe('Package version for detailed lookup (default: latest)'),\n },\n // No outputSchema: browse mode returns {catalog, count}, lookup returns metadata — incompatible shapes\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ package: packageName, type, platform, version }) => {\n // Browse mode: no package specified → return catalog\n if (!packageName) {\n const catalog = await fetchCatalog({ type, platform });\n const result = { catalog, count: catalog.length };\n return mcpResult(result, {\n next: ['Use package_get for schemas and examples'],\n });\n }\n\n // Lookup mode: fetch specific package details\n try {\n const info = await fetchPackage(packageName, { version });\n\n const result = {\n package: info.packageName,\n version: info.version,\n description: info.description,\n type: info.type,\n platform: normalizePlatform(info.platform),\n hintKeys: info.hintKeys,\n exampleSummaries: info.exampleSummaries,\n };\n\n return mcpResult(result, {\n next: ['Use package_get for schemas and examples'],\n });\n } catch (error) {\n return mcpError(\n error,\n 'Package not found. Use package_search without parameters to browse available packages.',\n );\n }\n },\n );\n}\n\nexport function registerGetPackageSchemaTool(server: McpServer) {\n server.registerTool(\n 'package_get',\n {\n title: 'Get Package',\n description:\n 'Fetch walkerOS package details from npm. By default returns schemas + hint texts + example summaries (lightweight). ' +\n 'Use section parameter to get full content: \"hints\" (with code blocks), \"examples\" (full in/out data), ' +\n 'or \"all\" (everything). Use package_search first to browse available packages.',\n inputSchema: {\n package: z\n .string()\n .min(1)\n .describe(\n 'Exact npm package name (e.g., @walkeros/web-destination-snowplow)',\n ),\n version: z\n .string()\n .optional()\n .describe('Package version (default: latest)'),\n section: z\n .enum(['hints', 'examples', 'all'])\n .optional()\n .describe(\n 'Section to expand with full content. Default: summary view with schemas + hint texts + example descriptions',\n ),\n },\n // No outputSchema — removed to avoid SDK -32602 crashes on unexpected field values\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ package: packageName, version, section }) => {\n try {\n const info = await fetchPackage(packageName, { version });\n\n // Build merged schemas: base config + package settings → schemas.config\n const mergedSchemas: Record<string, unknown> = {};\n\n if (info.type) {\n mergedSchemas.config = mergeConfigSchema(\n info.type as 'source' | 'destination' | 'transformer' | 'store',\n info.schemas as Record<string, Record<string, unknown>>,\n );\n }\n\n // Keep non-settings schemas as siblings (mapping, ga4, tagger, etc.)\n for (const [key, value] of Object.entries(info.schemas)) {\n if (key !== 'settings') {\n mergedSchemas[key] = value;\n }\n }\n\n const result: Record<string, unknown> = {\n package: info.packageName,\n version: info.version,\n type: info.type,\n platform: normalizePlatform(info.platform),\n schemas: mergedSchemas,\n };\n\n // Hints\n if (info.hints) {\n if (section === 'hints' || section === 'all') {\n result.hints = info.hints;\n } else {\n const hintSummary: Record<string, { text: string }> = {};\n for (const [key, hint] of Object.entries(info.hints)) {\n const h = hint as { text: string };\n hintSummary[key] = { text: h.text };\n }\n result.hints = hintSummary;\n }\n }\n\n // Examples\n if (section === 'examples' || section === 'all') {\n result.examples = info.examples;\n } else {\n result.exampleSummaries = info.exampleSummaries;\n }\n\n return mcpResult(result);\n } catch (error) {\n return mcpError(\n error,\n 'Use package_search to browse available package names.',\n );\n }\n },\n );\n}\n","const NPM_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search';\nconst JSDELIVR_BASE = 'https://cdn.jsdelivr.net/npm';\nconst WALKEROS_JSON_PATH = 'dist/walkerOS.json';\nconst CACHE_TTL = 5 * 60 * 1000;\n\nexport interface CatalogEntry {\n name: string;\n version: string;\n description?: string;\n type: string;\n platform: string[];\n}\n\nlet cache: { entries: CatalogEntry[]; timestamp: number } | undefined;\n\nexport function clearCatalogCache() {\n cache = undefined;\n}\n\nexport function normalizePlatform(platform?: unknown): string[] {\n if (platform == null) return [];\n if (typeof platform === 'string') {\n return platform === 'universal' ? ['web', 'server'] : [platform];\n }\n if (Array.isArray(platform)) {\n return platform.filter((v): v is string => typeof v === 'string');\n }\n return [];\n}\n\nexport async function fetchCatalog(filters?: {\n type?: string;\n platform?: string;\n}): Promise<CatalogEntry[]> {\n if (cache && Date.now() - cache.timestamp < CACHE_TTL) {\n return applyFilters(cache.entries, filters);\n }\n\n let entries: CatalogEntry[];\n try {\n entries = await fetchFromNpm();\n } catch {\n return [];\n }\n\n cache = { entries, timestamp: Date.now() };\n\n return applyFilters(entries, filters);\n}\n\nasync function fetchFromNpm(): Promise<CatalogEntry[]> {\n const res = await fetch(`${NPM_SEARCH_URL}?text=@walkeros/&size=250`, {\n signal: AbortSignal.timeout(10000),\n });\n if (!res.ok) throw new Error(`npm search failed: ${res.status}`);\n\n const data = (await res.json()) as {\n objects: Array<{\n package: { name: string; version: string; description?: string };\n }>;\n };\n\n const metaResults = await Promise.allSettled(\n data.objects.map((obj) => enrichWithMeta(obj.package)),\n );\n\n return metaResults\n .filter(\n (r): r is PromiseFulfilledResult<CatalogEntry | undefined> =>\n r.status === 'fulfilled',\n )\n .map((r) => r.value)\n .filter((entry): entry is CatalogEntry => entry !== undefined);\n}\n\nasync function enrichWithMeta(pkg: {\n name: string;\n version: string;\n description?: string;\n}): Promise<CatalogEntry | undefined> {\n try {\n const res = await fetch(\n `${JSDELIVR_BASE}/${pkg.name}@${pkg.version}/${WALKEROS_JSON_PATH}`,\n { signal: AbortSignal.timeout(5000) },\n );\n if (!res.ok) return undefined;\n\n const json = (await res.json()) as { $meta?: Record<string, unknown> };\n const meta = json.$meta;\n if (!meta || typeof meta.type !== 'string') return undefined;\n\n return {\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n type: meta.type,\n platform: normalizePlatform(meta.platform),\n };\n } catch {\n return undefined;\n }\n}\n\nfunction applyFilters(\n entries: CatalogEntry[],\n filters?: { type?: string; platform?: string },\n): CatalogEntry[] {\n let results = entries;\n if (filters?.type) {\n results = results.filter((e) => e.type === filters.type);\n }\n if (filters?.platform) {\n // Empty platform means platform-agnostic → matches any filter\n results = results.filter(\n (e) => e.platform.length === 0 || e.platform.includes(filters.platform!),\n );\n }\n return results;\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { loadJsonConfig } from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\n\nconst WEB_SKELETON = {\n version: 3,\n flows: {\n default: {\n web: {},\n packages: {},\n sources: {},\n destinations: {},\n },\n },\n};\n\nconst SERVER_SKELETON = {\n version: 3,\n flows: {\n default: {\n server: {},\n packages: {},\n sources: {},\n destinations: {},\n },\n },\n};\n\nexport function registerFlowLoadTool(server: McpServer) {\n server.registerTool(\n 'flow_load',\n {\n title: 'Load or Create Flow',\n description:\n 'Load an existing flow configuration from a local file path, URL, or walkerOS API (by flow ID). ' +\n 'Or create a new empty flow by specifying a platform (web or server). ' +\n 'Use the add-step prompt to add sources, destinations, transformers, or stores to the flow.',\n inputSchema: {\n source: z\n .string()\n .optional()\n .describe(\n 'Flow source: local file path (./flow.json), URL (https://...), ' +\n 'inline JSON string, or API flow ID (cfg_...). Omit to create a new flow.',\n ),\n platform: z\n .enum(['web', 'server'])\n .optional()\n .describe(\n 'Platform for new flows. Required when source is omitted. ' +\n 'web = browser tracking, server = Node.js HTTP.',\n ),\n },\n outputSchema: {\n version: z.number().describe('Flow config version'),\n flows: z.record(z.string(), z.unknown()).describe('Flow definitions'),\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ source, platform }) => {\n try {\n if (source) {\n const config = await loadJsonConfig(source);\n return mcpResult(config, {\n next: [\n 'Use flow_validate to check',\n 'Use add-step prompt to modify',\n ],\n });\n }\n\n if (!platform) {\n return mcpError(\n new Error(\n 'Provide source (file path, URL, or flow ID) to load existing flow, ' +\n 'or platform (web/server) to create a new one.',\n ),\n );\n }\n\n const skeleton = platform === 'web' ? WEB_SKELETON : SERVER_SKELETON;\n return mcpResult(skeleton, {\n next: [\n 'Read walkeros://reference/flow-schema for config structure',\n 'Use add-step prompt to add sources and destinations',\n ],\n });\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\n if (msg.includes('not found') || msg.includes('ENOENT'))\n return mcpError(\n error,\n 'Check configPath — expected a flow.json file',\n );\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { feedback, readConfig, writeConfig } from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\n\ndeclare const __VERSION__: string;\n\nexport function registerFeedbackTool(server: McpServer) {\n server.registerTool(\n 'feedback',\n {\n title: 'Send Feedback',\n description: 'Send feedback about walkerOS',\n inputSchema: {\n text: z.string().describe('Your feedback text'),\n anonymous: z\n .boolean()\n .optional()\n .describe(\n 'Include user/project info? false = include, true = anonymous. Only needed on first call if not yet configured.',\n ),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async (params) => {\n try {\n const { text, anonymous: explicitAnonymous } = params;\n\n const config = readConfig();\n let anonymous = config?.anonymousFeedback;\n\n // First time: need user's consent choice\n if (anonymous === undefined && explicitAnonymous === undefined) {\n return mcpResult(\n { needsConsent: true },\n {\n next: [\n 'Ask the user if they want to include their info',\n 'Call feedback again with anonymous: true or false',\n ],\n },\n );\n }\n\n // Store preference if this is the first time\n if (anonymous === undefined && explicitAnonymous !== undefined) {\n anonymous = explicitAnonymous;\n const base = config ?? { token: '', email: '', appUrl: '' };\n writeConfig({ ...base, anonymousFeedback: anonymous });\n }\n\n // Use explicit override if provided, otherwise use stored value\n const isAnonymous = explicitAnonymous ?? anonymous ?? true;\n\n await feedback(text, { anonymous: isAnonymous, version: __VERSION__ });\n\n return mcpResult({ ok: true });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ServerNotification } from '@modelcontextprotocol/sdk/types.js';\nimport {\n whoami,\n listProjects,\n getProject,\n createProject,\n updateProject,\n deleteProject,\n listFlows,\n getFlow,\n createFlow,\n updateFlow,\n deleteFlow,\n duplicateFlow,\n deploy,\n getDeployment,\n listDeployments,\n getDeploymentBySlug,\n createDeployment as createDep,\n deleteDeployment as deleteDep,\n} from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { ApiOutputShape } from '../schemas/api-output.js';\n\nconst ACTIONS = [\n 'whoami',\n 'project.list',\n 'project.get',\n 'project.create',\n 'project.update',\n 'project.delete',\n 'flow.list',\n 'flow.get',\n 'flow.create',\n 'flow.update',\n 'flow.delete',\n 'flow.duplicate',\n 'deploy',\n 'deployment.get',\n 'deployment.list',\n 'deployment.create',\n 'deployment.delete',\n] as const;\n\nexport function registerApiTool(server: McpServer) {\n server.registerTool(\n 'api',\n {\n title: 'walkerOS Cloud API',\n description:\n 'Manage walkerOS cloud projects, flows, and deployments. Requires WALKEROS_TOKEN env var.\\n\\n' +\n 'Actions:\\n' +\n '- whoami — verify token, get user info\\n' +\n '- project.list/get/create/update/delete — manage projects\\n' +\n '- flow.list/get/create/update/delete/duplicate — manage flow configs\\n' +\n '- deploy — deploy a flow (auto-detects web/server)\\n' +\n '- deployment.get/list/create/delete — manage deployments\\n\\n' +\n 'Parameters vary by action. content = Flow.Config JSON for flow.create/update.',\n inputSchema: {\n action: z.enum(ACTIONS).describe('API action to perform'),\n projectId: z\n .string()\n .optional()\n .describe(\n 'Project ID (proj_...). Required for: project.get/update/delete, flow.create, flow.list. ' +\n 'Falls back to WALKEROS_PROJECT_ID env var.',\n ),\n flowId: z\n .string()\n .optional()\n .describe(\n 'Flow ID (flow_...) or config ID (cfg_...). Required for: ' +\n 'flow.get, flow.update, flow.delete, flow.duplicate, deploy. ' +\n 'For deployment.get/delete: can be a deployment slug.',\n ),\n name: z\n .string()\n .optional()\n .describe('Name for create/update operations'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Flow.Config JSON for flow operations'),\n patch: z\n .boolean()\n .optional()\n .describe('Use merge-patch for flow.update (default: true)'),\n wait: z\n .boolean()\n .optional()\n .describe('Wait for deploy to complete (default: true)'),\n flowName: z\n .string()\n .optional()\n .describe('Flow name for multi-settings flows'),\n fields: z\n .array(z.string())\n .optional()\n .describe('Dot-path field selectors for flow.get'),\n type: z\n .enum(['web', 'server'])\n .optional()\n .describe('Deployment type for deployment.create'),\n sort: z.string().optional().describe('Sort field for list operations'),\n order: z.enum(['asc', 'desc']).optional().describe('Sort order'),\n status: z\n .string()\n .optional()\n .describe('Status filter for deployment.list'),\n includeDeleted: z\n .boolean()\n .optional()\n .describe('Include deleted items in lists'),\n },\n outputSchema: ApiOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async (params, extra) => {\n const {\n action,\n projectId,\n flowId,\n name,\n content,\n patch,\n wait,\n flowName,\n fields,\n type,\n sort,\n order,\n status,\n includeDeleted,\n } = params;\n\n try {\n let data: unknown;\n\n switch (action) {\n // Auth\n case 'whoami': {\n data = await whoami();\n break;\n }\n\n // Projects\n case 'project.list': {\n data = await listProjects();\n break;\n }\n case 'project.get': {\n data = await getProject({ projectId });\n break;\n }\n case 'project.create': {\n if (!name) throw new Error('name required for project.create');\n data = await createProject({ name });\n break;\n }\n case 'project.update': {\n if (!name) throw new Error('name required for project.update');\n data = await updateProject({ projectId, name });\n break;\n }\n case 'project.delete': {\n data = await deleteProject({ projectId });\n break;\n }\n\n // Flows\n case 'flow.list': {\n data = await listFlows({\n projectId,\n sort: sort as 'name' | 'updated_at' | 'created_at' | undefined,\n order: order as 'asc' | 'desc' | undefined,\n includeDeleted,\n });\n break;\n }\n case 'flow.get': {\n if (!flowId) throw new Error('flowId required for flow.get');\n data = await getFlow({ flowId, projectId, fields });\n break;\n }\n case 'flow.create': {\n if (!name) throw new Error('name required for flow.create');\n if (!content) throw new Error('content required for flow.create');\n data = await createFlow({ name, content, projectId });\n break;\n }\n case 'flow.update': {\n if (!flowId) throw new Error('flowId required for flow.update');\n data = await updateFlow({\n flowId,\n name,\n content,\n projectId,\n mergePatch: patch ?? true,\n });\n break;\n }\n case 'flow.delete': {\n if (!flowId) throw new Error('flowId required for flow.delete');\n data = await deleteFlow({ flowId, projectId });\n break;\n }\n case 'flow.duplicate': {\n if (!flowId) throw new Error('flowId required for flow.duplicate');\n data = await duplicateFlow({ flowId, name, projectId });\n break;\n }\n\n // Deploy\n case 'deploy': {\n if (!flowId) throw new Error('flowId required for deploy');\n const progressToken = extra._meta?.progressToken;\n const DEPLOY_TIMEOUT_MS = 90_000;\n const timeoutSignal = AbortSignal.timeout(DEPLOY_TIMEOUT_MS);\n const combinedAbort = new AbortController();\n const onAbort = () => combinedAbort.abort();\n timeoutSignal.addEventListener('abort', onAbort);\n extra.signal?.addEventListener('abort', onAbort);\n data = await deploy({\n flowId,\n projectId,\n wait: wait ?? true,\n flowName,\n timeout: DEPLOY_TIMEOUT_MS,\n onStatus: (s: string, sub: string | null) => {\n if (!progressToken) return;\n const key = sub ? `${s}:${sub}` : s;\n const stages: Record<\n string,\n { progress: number; label: string }\n > = {\n 'bundling:building': {\n progress: 20,\n label: 'Building bundle...',\n },\n 'deploying:publishing': {\n progress: 60,\n label: 'Publishing to CDN...',\n },\n 'deploying:provisioning': {\n progress: 60,\n label: 'Provisioning container...',\n },\n 'deploying:starting': {\n progress: 80,\n label: 'Starting container...',\n },\n published: { progress: 100, label: 'Published' },\n active: { progress: 100, label: 'Active' },\n failed: { progress: 100, label: 'Failed' },\n };\n const stage = stages[key] ??\n stages[s] ?? { progress: 10, label: key };\n extra.sendNotification({\n method: 'notifications/progress',\n params: {\n progressToken,\n progress: stage.progress,\n total: 100,\n message: stage.label,\n },\n } as ServerNotification);\n },\n signal: combinedAbort.signal,\n });\n timeoutSignal.removeEventListener('abort', onAbort);\n extra.signal?.removeEventListener('abort', onAbort);\n const st = (data as Record<string, unknown>).status;\n const deployData = data as Record<string, unknown>;\n if (st === 'failed') {\n return mcpResult(\n { action, ok: false, data },\n {\n next: ['Run flow_validate to check your configuration'],\n },\n );\n } else {\n const publicUrl = deployData.publicUrl as string | undefined;\n const containerUrl = deployData.containerUrl as\n | string\n | undefined;\n const deployType = deployData.type as string | undefined;\n const nextHints: string[] = [];\n if (deployType === 'web' && publicUrl) {\n nextHints.push(`Bundle at ${publicUrl}`);\n nextHints.push(`Add <script src='${publicUrl}'></script>`);\n } else if (deployType === 'server' && containerUrl) {\n nextHints.push(`Container at ${containerUrl}`);\n nextHints.push(`Test: curl ${containerUrl}/health`);\n }\n if (nextHints.length > 0) {\n return mcpResult(\n { action, ok: true, data },\n {\n next: nextHints,\n },\n );\n }\n }\n break;\n }\n\n // Deployments\n case 'deployment.get': {\n if (!flowId)\n throw new Error(\n 'flowId (flowId or slug) required for deployment.get',\n );\n try {\n data = await getDeployment({ flowId, flowName });\n } catch {\n data = await getDeploymentBySlug({ slug: flowId });\n }\n break;\n }\n case 'deployment.list': {\n data = await listDeployments({\n projectId,\n type: type as 'web' | 'server' | undefined,\n status,\n });\n break;\n }\n case 'deployment.create': {\n if (!type)\n throw new Error(\n 'type (web/server) required for deployment.create',\n );\n data = await createDep({ type, label: name, projectId });\n break;\n }\n case 'deployment.delete': {\n if (!flowId)\n throw new Error('flowId (slug) required for deployment.delete');\n data = await deleteDep({ slug: flowId });\n break;\n }\n\n default:\n throw new Error(\n `Unknown action: ${action}. Use one of: ${ACTIONS.join(', ')}`,\n );\n }\n\n return mcpResult({ action, ok: true, data });\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\n const name = error instanceof Error ? error.name : '';\n\n // Deploy timeout — return helpful status instead of raw error\n if (\n action === 'deploy' &&\n (name === 'AbortError' ||\n name === 'TimeoutError' ||\n msg.includes('abort'))\n ) {\n return mcpResult(\n {\n action,\n ok: true,\n data: { status: 'deploying', flowId },\n },\n {\n next: [\n 'Use api(action: \"deployment.list\") to check current status',\n ],\n },\n );\n }\n\n if (\n msg.includes('401') ||\n msg.includes('403') ||\n msg.includes('Unauthorized')\n )\n return mcpError(\n error,\n 'Set WALKEROS_TOKEN env var or check token expiry',\n );\n if (msg.includes('required'))\n return mcpError(\n error,\n `See api tool description for ${action} parameters.`,\n );\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\n\nexport const ApiOutputShape = {\n action: z.string().describe('Action that was executed'),\n ok: z.boolean().describe('Whether the action succeeded'),\n data: z.unknown().describe('Action-specific result data'),\n};\n","import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { fetchPackageSchema } from '@walkeros/core';\nimport { fetchCatalog } from '../catalog.js';\n\nexport function registerPackageSchemaResources(server: McpServer) {\n const template = new ResourceTemplate('walkeros://schema/{packageName}', {\n list: async () => {\n const catalog = await fetchCatalog();\n return {\n resources: catalog.map((pkg) => ({\n uri: `walkeros://schema/${encodeURIComponent(pkg.name)}`,\n name: pkg.name,\n description: `Schema and examples for ${pkg.name}`,\n mimeType: 'application/json' as const,\n })),\n };\n },\n });\n\n server.registerResource(\n 'package-schema',\n template,\n {\n title: 'walkerOS Package Schema',\n description:\n 'JSON Schema and configuration examples for walkerOS packages',\n mimeType: 'application/json',\n },\n async (uri, { packageName }) => {\n const info = await fetchPackageSchema(\n decodeURIComponent(packageName as string),\n );\n return {\n contents: [\n {\n uri: uri.toString(),\n mimeType: 'application/json' as const,\n text: JSON.stringify(info, null, 2),\n },\n ],\n };\n },\n );\n}\n","/**\n * Reference resources — pure schema and structural data only.\n *\n * Design principle: resources are loaded into context and should contain\n * only schemas, type definitions, and structural references. Behavioral\n * guidance, tutorials, and step-by-step instructions belong in prompts.\n * Vendor-specific examples belong in packages (fetched via package_get).\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { schemas } from '@walkeros/core/dev';\nimport { fetchCatalog } from '../catalog.js';\n\nexport function registerReferenceResources(server: McpServer) {\n // Flow Schema reference (generated from Zod)\n server.resource(\n 'flow-schema',\n 'walkeros://reference/flow-schema',\n {\n description:\n 'JSON Schema for Flow.Config — the complete flow configuration structure',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/flow-schema',\n text: JSON.stringify(schemas.configJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Event Model reference (generated from Zod)\n server.resource(\n 'event-model',\n 'walkeros://reference/event-model',\n {\n description:\n 'JSON Schema for walkerOS events: entity-action naming, data, context, globals, user, consent',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/event-model',\n text: JSON.stringify(schemas.eventJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Mapping reference (generated from Zod — composite of related schemas)\n server.resource(\n 'mapping',\n 'walkeros://reference/mapping',\n {\n description:\n 'JSON Schemas for walkerOS mapping: rules, valueConfig, rule, policy',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/mapping',\n text: JSON.stringify(\n {\n rules: schemas.rulesJsonSchema,\n valueConfig: schemas.valueConfigJsonSchema,\n rule: schemas.ruleJsonSchema,\n policy: schemas.policyJsonSchema,\n },\n null,\n 2,\n ),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Consent reference (generated from Zod)\n server.resource(\n 'consent',\n 'walkeros://reference/consent',\n {\n description:\n 'JSON Schema for walkerOS consent: destination-level, rule-level, and field-level consent gating',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/consent',\n text: JSON.stringify(schemas.consentJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Variables reference (hand-maintained — runtime interpolation patterns not captured in Zod schemas)\n server.resource(\n 'variables',\n 'walkeros://reference/variables',\n {\n description:\n 'walkerOS variable patterns: $var, $env, $def, $contract, $code, $store substitution',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/variables',\n text: JSON.stringify(\n {\n patterns: {\n '$var.name':\n 'Variable substitution — cascade: step settings > flow settings > config variables',\n '$env.NAME':\n 'Environment variable — $env.GA_ID reads process.env.GA_ID',\n '$env.NAME:default':\n 'Environment variable with fallback — $env.GA_ID:G-DEFAULT',\n '$def.name':\n 'Definition reference — reusable config blocks from definitions section',\n '$def.name.path.deep':\n 'Nested definition access — $def.ga4Events.purchase',\n '$contract.name':\n 'Contract reference — links to named contract for validation',\n '$contract.name.path':\n 'Nested contract access — $contract.ecommerce.product',\n '$code:(expr)':\n 'Inline JavaScript — $code:(event) => event.data.price * 100',\n '$store:storeId':\n 'Store injection in env values — wires runtime store access',\n },\n cascade: {\n priority: [\n '1. Step-level settings (highest)',\n '2. Flow-level settings',\n '3. Config-level variables (lowest)',\n ],\n example: {\n variables: { apiKey: 'default-key' },\n flows: {\n production: {\n destinations: {\n api: {\n config: { key: '$var.apiKey' },\n settings: { apiKey: 'prod-key' },\n },\n },\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Contract reference (generated from Zod)\n server.resource(\n 'contract',\n 'walkeros://reference/contract',\n {\n description:\n 'JSON Schema for walkerOS contracts: event schema validation with entity-action keying',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/contract',\n text: JSON.stringify(schemas.contractJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Examples reference (loaded from @walkeros/cli at runtime)\n server.resource(\n 'examples',\n 'walkeros://reference/examples',\n {\n description:\n 'Complete flow config example: web + server flows, mapping, contracts, step examples',\n mimeType: 'application/json',\n },\n async () => {\n let example: string;\n try {\n const { readFileSync } = await import('fs');\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const examplePath =\n require.resolve('@walkeros/cli/examples/flow-complete.json');\n example = readFileSync(examplePath, 'utf-8');\n } catch {\n example = JSON.stringify({ error: 'Example not found' });\n }\n return {\n contents: [\n {\n uri: 'walkeros://reference/examples',\n text: example,\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n\n // API reference (OpenAPI spec)\n server.resource(\n 'api',\n 'walkeros://reference/api',\n {\n description: 'walkerOS cloud API — OpenAPI 3.1 specification',\n mimeType: 'application/json',\n },\n async () => {\n let openApiSpec: string;\n try {\n const { readFileSync } = await import('fs');\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const specPath = require.resolve('@walkeros/cli/openapi/spec.json');\n openApiSpec = readFileSync(specPath, 'utf-8');\n } catch {\n openApiSpec = JSON.stringify({ error: 'OpenAPI spec not found' });\n }\n return {\n contents: [\n {\n uri: 'walkeros://reference/api',\n text: openApiSpec,\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n\n // Packages catalog resource\n server.resource(\n 'packages',\n 'walkeros://reference/packages',\n {\n description:\n 'Complete walkerOS package catalog — all sources, destinations, transformers, and stores',\n mimeType: 'application/json',\n },\n async () => {\n const catalog = await fetchCatalog();\n return {\n contents: [\n {\n uri: 'walkeros://reference/packages',\n text: JSON.stringify(catalog, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerAddStepPrompt(server: McpServer) {\n server.registerPrompt(\n 'add-step',\n {\n description:\n 'Add a source, destination, transformer, or store step to a flow configuration. ' +\n 'Guides through package selection, config scaffolding, and wiring.',\n argsSchema: {\n stepType: z\n .string()\n .optional()\n .describe(\n 'Type of step to add: source, destination, transformer, or store',\n ),\n flowPath: z\n .string()\n .optional()\n .describe('Path to the flow.json file to modify'),\n },\n },\n async ({ stepType, flowPath }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me add a ${stepType || 'new'} step to my flow${flowPath ? ` at ${flowPath}` : ''}.`,\n '',\n 'Follow these steps:',\n `1. ${stepType ? '' : 'Ask what type of step (source, destination, transformer, store). Then '}Use package_search to browse available packages for the selected type and platform.`,\n '2. Use package_get to read the package\\'s config schema (schemas.config contains the full config shape: base fields like consent/require/logger + package-specific settings). Use section=\"hints\" for additional guidance.',\n '3. Use package_get with section=\"examples\" to see working configuration examples.',\n '4. Scaffold the step config using the package schemas — include required settings with placeholder values.',\n '5. Wire the step into the flow: add to packages section (with version if needed), connect via next/before chains if needed.',\n '6. For destinations: configure mapping using nested entity → action keys. Event \"product add\" maps to `{ \"product\": { \"add\": { name: \"AddToCart\" } } }`. Use the setup-mapping prompt for guidance.',\n '7. Use flow_validate to verify the result.',\n '8. For server sources: check if the package supports `ingest` configuration via package_get. Ingest extracts request metadata (IP, user-agent, headers) using mapping syntax. Transformers like fingerprint depend on ingest data.',\n '9. When adding a transformer that uses ingest fields, verify the source has `ingest` configured — otherwise ingest fields resolve to empty values.',\n '',\n 'Important:',\n '- Read the walkeros://reference/flow-schema resource to understand connection rules.',\n '- Sources connect to pre-collector transformers via `next`.',\n '- Destinations connect to post-collector transformers via `before`.',\n '- Stores are passive — referenced via `$store:storeName` in env values.',\n '- Use variables ($var) for values that change between environments.',\n '- For required settings without defaults in the package schema, ask the user which value to use. Do not guess credentials, IDs, or environment-specific values.',\n '- If $meta.exports lists named exports, set the `code` field on the step to the chosen export name. If only one export exists, use it automatically.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerSetupMappingPrompt(server: McpServer) {\n server.registerPrompt(\n 'setup-mapping',\n {\n description:\n 'Set up event mapping for any step in a flow. Teaches mapping syntax and uses package examples as templates.',\n argsSchema: {\n stepName: z\n .string()\n .optional()\n .describe('Step name in the flow (e.g., \"gtag\", \"meta\", \"express\")'),\n },\n },\n async ({ stepName }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me set up mapping${stepName ? ` for the \"${stepName}\" step` : ''}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/mapping resource for syntax reference.',\n `2. ${stepName ? `Identify the package for \"${stepName}\" in the flow, then u` : 'U'}se package_get with section=\"examples\" to see the source output shape — mapping keys must match the actual events the source emits.`,\n '3. Ask whether this is source mapping (raw input → walkerOS events) or destination mapping (walkerOS events → vendor format).',\n '4. Ask which events to map (one at a time, not all at once).',\n '5. Generate one mapping rule using the package examples as templates. Validate it with flow_validate before moving to the next.',\n '6. Repeat for each event.',\n '',\n 'Mapping uses nested entity → action keys. Event \"product add\" maps to `{ \"product\": { \"add\": Rule } }`. Wildcards: `{ \"*\": { \"view\": Rule } }`.',\n '',\n 'Use $def references for shared mapping patterns across destinations.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerManageContractPrompt(server: McpServer) {\n server.registerPrompt(\n 'manage-contract',\n {\n description:\n 'Create or update event contracts for a flow. Can generate contracts from existing mappings or scaffold mappings from contracts.',\n argsSchema: {\n direction: z\n .string()\n .optional()\n .describe(\n 'Direction: \"from-mappings\" (extract contract from existing mappings), ' +\n '\"from-scratch\" (create new contract), or \"to-mappings\" (scaffold mappings from contract)',\n ),\n },\n },\n async ({ direction }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me ${direction === 'to-mappings' ? 'scaffold mappings from a contract' : direction === 'from-mappings' ? 'generate a contract from existing mappings' : 'manage event contracts'}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/contract resource to understand contract structure.',\n direction === 'from-mappings'\n ? '2. Read all destination mappings in the flow, extract referenced event fields, and generate a contract with those as required properties.'\n : direction === 'to-mappings'\n ? '2. Read the contract from the flow, then scaffold mapping stubs for each destination based on the contract fields.'\n : '2. Ask for entity-action names and required properties, or ask whether to generate from existing mappings.',\n '3. Use entity-action keying with wildcards (*.*, *.action, entity.*) for broad rules.',\n '4. Define JSON Schema for events, globals, context, custom, user, and consent.',\n '5. Use flow_validate to verify the contract.',\n '',\n 'Contracts and mappings are bidirectional:',\n '- **Contract → Mappings**: contract defines what events look like, mappings are scaffolded to match.',\n '- **Mappings → Contract**: existing mappings reveal which fields are used, contract formalizes them.',\n '',\n 'For server flows: if the contract references fields populated by ingest (e.g., user fingerprint hash), verify the source config.ingest extracts the needed request metadata.',\n '',\n 'Use $contract.name references to link contracts in the flow.',\n 'Contracts support extends for inheritance between event types.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerUseDefinitionsPrompt(server: McpServer) {\n server.registerPrompt(\n 'use-definitions',\n {\n description:\n 'Extract shared patterns into definitions and variables for DRY, environment-aware flow configurations.',\n argsSchema: {\n flowPath: z\n .string()\n .optional()\n .describe('Path to the flow.json file to analyze'),\n },\n },\n async ({ flowPath }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me extract shared patterns into definitions and variables${flowPath ? ` in ${flowPath}` : ''}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/variables resource to understand variable syntax.',\n '2. Analyze the flow config for repeated patterns (same mapping blocks, same config values).',\n '3. Extract repeated mapping patterns into the `definitions` section with `$def.name` references.',\n '4. Extract environment-specific values into `variables` with `$var.name` references.',\n '5. Show the cascade priority: step > settings > config.',\n '6. Use flow_validate to verify the result.',\n '',\n 'Variable types:',\n '- `$var.name` — variable substitution (cascade: step > settings > config)',\n '- `$env.NAME` and `$env.NAME:default` — environment variables',\n '- `$def.name` and `$def.name.path.deep` — definition references',\n '- `$contract.name` — contract references',\n '- `$code:(expr)` — inline JavaScript functions',\n '- `$store:storeId` — store injection in env values',\n '',\n 'Look for:',\n '- Same API keys or URLs across multiple destinations → $var or $env',\n '- Identical mapping rules in multiple destinations → $def',\n '- Environment-specific values (dev/staging/prod) → $var with overrides',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,gBAAgB;AAEzB,SAAS,eAAe;AAExB,SAAS,WAAW,gBAAgB;;;ACJpC,SAAS,SAAS;AAGX,IAAM,sBAAsB;AAAA,EACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,2BAA2B;AAAA,EACvD,MAAM,EACH,MAAM;AAAA,IACL,EAAE,KAAK,CAAC,YAAY,SAAS,SAAS,QAAQ,SAAS,CAAC;AAAA,IACxD,EAAE,OAAO,EAAE,MAAM,4CAA4C;AAAA,EAC/D,CAAC,EACA,SAAS,oBAAoB;AAAA,EAChC,QAAQ,EACL;AAAA,IACC,EAAE,OAAO;AAAA,MACP,MAAM,EAAE,OAAO;AAAA,MACf,SAAS,EAAE,OAAO;AAAA,MAClB,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA,MAC5B,MAAM,EAAE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uB,MAAM;AAC7B,yBAAyB,MAAM;AAC/B,qBAAqB,MAAM;AAC3B,yBAAyB,MAAM;AAC/B,0BAA0B,MAAM;AAChC,6BAA6B,MAAM;AACnC,qBAAqB,MAAM;AAC3B,qBAAqB,MAAM;AAC3B,+BAA+B,MAAM;AACrC,2BAA2B,MAAM;AACjC,sBAAsB,MAAM;AAC5B,2BAA2B,MAAM;AACjC,6BAA6B,MAAM;AACnC,6BAA6B,MAAM;AAEnC,IAAI,QAAQ,IAAI,gBAAgB;AAC9B,kBAAgB,MAAM;AACxB;AAEA,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,UAAQ,MAAM,2CAA2C;AAC3D;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,oCAAoC,KAAK;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["server","z","schemas","mcpResult","mcpError","server","schemas","z","result","mcpResult","mcpError","z","schemas","mcpResult","mcpError","server","schemas","z","summary","mcpResult","mcpError","z","schemas","mcpResult","mcpError","server","schemas","z","mcpError","mcpResult","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","loadJsonConfig","mcpResult","mcpError","server","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","server","z","mcpResult","name","mcpError","server","schemas","server","schemas","require","z","server","z","server","z","server","z","server"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/tools/validate.ts","../src/schemas/output.ts","../src/tools/bundle.ts","../src/tools/simulate.ts","../src/tools/push.ts","../src/tools/examples.ts","../src/tools/package.ts","../src/catalog.ts","../src/tools/flow-load.ts","../src/tools/feedback.ts","../src/tools/api.ts","../src/schemas/api-output.ts","../src/resources/package-schemas.ts","../src/resources/references.ts","../src/prompts/add-step.ts","../src/prompts/setup-mapping.ts","../src/prompts/manage-contract.ts","../src/prompts/use-definitions.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { registerFlowValidateTool } from './tools/validate.js';\nimport { registerFlowBundleTool } from './tools/bundle.js';\nimport { registerFlowSimulateTool } from './tools/simulate.js';\nimport { registerFlowPushTool } from './tools/push.js';\nimport { registerFlowExamplesTool } from './tools/examples.js';\nimport {\n registerPackageSearchTool,\n registerGetPackageSchemaTool,\n} from './tools/package.js';\nimport { registerFlowLoadTool } from './tools/flow-load.js';\nimport { registerFeedbackTool } from './tools/feedback.js';\nimport { registerApiTool } from './tools/api.js';\nimport { registerPackageSchemaResources } from './resources/package-schemas.js';\nimport { registerReferenceResources } from './resources/references.js';\nimport { registerAddStepPrompt } from './prompts/add-step.js';\nimport { registerSetupMappingPrompt } from './prompts/setup-mapping.js';\nimport { registerManageContractPrompt } from './prompts/manage-contract.js';\nimport { registerUseDefinitionsPrompt } from './prompts/use-definitions.js';\n\ndeclare const __VERSION__: string;\n\nconst server = new McpServer(\n {\n name: 'walkeros-flow',\n version: __VERSION__,\n },\n {\n instructions: `walkerOS is an open-source, privacy-first event data collection platform. Define event pipelines as code using JSON flow configurations.\n\n## Rules\n\n- **Never guess package names.** Always use \\`package_search\\` first to find exact names, then \\`package_get\\` for details.\n- **Never construct flow configs from memory.** Read \\`walkeros://reference/flow-schema\\` and use \\`package_get\\` for package-specific schemas.\n- **Always validate.** Run \\`flow_validate\\` after every config change. If validation fails, fix and re-validate.\n- **Simulate before deploying.** Use \\`flow_simulate\\` to test with mocked API calls before \\`flow_bundle\\` or \\`flow_push\\`.\n\n## Workflow\n\n1. \\`flow_load({ platform: \"web\" })\\` or \\`flow_load({ source: \"./flow.json\" })\\` — create or load\n2. \\`package_search({ type: \"destination\", platform: \"web\" })\\` — discover packages\n3. \\`package_get({ package: \"...\" })\\` — read schemas, hints, examples\n4. Use the \\`add-step\\` prompt — guided step addition\n5. Use the \\`setup-mapping\\` prompt — event transformation config\n6. \\`flow_validate({ type: \"flow\", input: \"flow.json\" })\\` — verify\n7. \\`flow_simulate({ configPath: \"flow.json\", event: \"...\" })\\` — test\n8. \\`flow_bundle({ configPath: \"flow.json\" })\\` — build\n9. \\`api({ action: \"deploy\", id: \"cfg_...\" })\\` — deploy (requires WALKEROS_TOKEN)\n\n## Architecture: Source → Collector → Destination(s)\n\nEvery component in a flow is a **step**: sources capture events, transformers process them, destinations deliver them, stores provide shared state. Steps connect via \\`next\\` (pre-collector) and \\`before\\` (post-collector) chains.\n\n## Flow Config Structure\n\n\\`\\`\\`json\n{\n \"version\": 3,\n \"flows\": {\n \"default\": {\n \"web\": {},\n \"sources\": { \"<name>\": { \"package\": \"<npm-package>\", \"config\": {} } },\n \"destinations\": { \"<name>\": { \"package\": \"<npm-package>\", \"config\": { \"settings\": {} } } }\n }\n }\n}\n\\`\\`\\`\n\n- \\`version: 3\\` is required\n- Each flow must have exactly one of \\`web: {}\\` or \\`server: {}\\`\n- Destination settings go inside \\`config.settings\\`, not directly on the destination\n- Event format: \\`{ name: \"entity action\", data: {...}, entity: \"...\", action: \"...\" }\\`\n\n## Key Concepts\n\n- **Mapping** transforms events using data/map/loop/set/condition rules. Same syntax on sources and destinations. Mapping rules use NESTED entity → action keying: event name \"product add\" maps to \\`{ \"product\": { \"add\": Rule } }\\`. Wildcards: \\`{ \"*\": { \"view\": Rule } }\\`.\n- **Contracts** define event schemas using entity-action keying. Can generate FROM mappings or scaffold mappings FROM contracts.\n- **Variables** (\\$var, \\$env, \\$def, \\$code, \\$store) enable DRY, environment-aware config. Use the \\`use-definitions\\` prompt to extract shared patterns.\n- **Consent** gates destinations, mapping rules, and individual fields. Privacy-first by design.\n\n## Simulation Tips\n\n- Destinations with \\`require: [\"consent\"]\\` stay **pending** until a \\`\"walker consent\"\\` event fires. Simulation will error \"not found\" for pending destinations — remove \\`require\\` from config when testing with \\`flow_simulate\\`.\n- Destinations with \\`consent: { marketing: true }\\` silently skip events that lack matching consent. Include \\`consent\\` in the event: \\`{ name: \"page view\", data: {...}, consent: { marketing: true } }\\`.\n- **Mapping** transforms event names and data at the destination level. Events without a matching mapping rule pass through unmodified.\n- **Policy** modifies the event before mapping runs — use it to inject computed fields or redact sensitive data.\n\n## Reference Resources\n\nRead these before constructing configs manually: \\`walkeros://reference/flow-schema\\`, \\`walkeros://reference/mapping\\`, \\`walkeros://reference/event-model\\`, \\`walkeros://reference/consent\\`, \\`walkeros://reference/variables\\`, \\`walkeros://reference/contract\\`, \\`walkeros://reference/examples\\`.`,\n },\n);\n\nregisterFlowValidateTool(server);\nregisterFlowBundleTool(server);\nregisterFlowSimulateTool(server);\nregisterFlowPushTool(server);\nregisterFlowExamplesTool(server);\nregisterPackageSearchTool(server);\nregisterGetPackageSchemaTool(server);\nregisterFlowLoadTool(server);\nregisterFeedbackTool(server);\nregisterPackageSchemaResources(server);\nregisterReferenceResources(server);\nregisterAddStepPrompt(server);\nregisterSetupMappingPrompt(server);\nregisterManageContractPrompt(server);\nregisterUseDefinitionsPrompt(server);\n\nif (process.env.WALKEROS_TOKEN) {\n registerApiTool(server);\n}\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('walkerOS Flow MCP server running on stdio');\n}\n\nmain().catch((error) => {\n console.error('Failed to start Flow MCP server:', error);\n process.exit(1);\n});\n","import { validate } from '@walkeros/cli';\nimport type { ValidateResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { ValidateOutputShape } from '../schemas/output.js';\n\nexport function registerFlowValidateTool(server: McpServer) {\n server.registerTool(\n 'flow_validate',\n {\n title: 'Validate Flow',\n description:\n 'Validate walkerOS events, flow configurations, mapping rules, or data contracts. ' +\n 'Accepts JSON strings, file paths, or URLs as input. ' +\n 'Returns validation results with errors, warnings, and details.',\n inputSchema: schemas.ValidateInputShape,\n outputSchema: ValidateOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ type, input, flow, path }) => {\n try {\n const result: ValidateResult = await validate(type, input, {\n flow,\n path,\n });\n const hints = result.valid\n ? {\n next: [\n 'Use flow_simulate to test event flow',\n 'Use flow_bundle to build',\n ],\n }\n : {\n next: [\n 'Fix errors above, then run flow_validate again',\n 'Read walkeros://reference/flow-schema for correct structure',\n ],\n };\n return mcpResult(result, hints);\n } catch (error) {\n return mcpError(\n error,\n 'Check the input parameter — expected a JSON string, file path, or URL',\n );\n }\n },\n );\n}\n","import { z } from 'zod';\n\n// CLI tool output shapes\nexport const ValidateOutputShape = {\n valid: z.boolean().describe('Whether validation passed'),\n type: z\n .union([\n z.enum(['contract', 'entry', 'event', 'flow', 'mapping']),\n z.string().regex(/^(destinations|sources|transformers)\\.\\w+$/),\n ])\n .describe('What was validated'),\n errors: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n value: z.unknown().optional(),\n code: z.string().optional(),\n }),\n )\n .describe('Validation errors'),\n warnings: z\n .array(\n z.object({\n path: z.string(),\n message: z.string(),\n suggestion: z.string().optional(),\n }),\n )\n .describe('Validation warnings'),\n details: z\n .record(z.string(), z.unknown())\n .describe('Additional validation details'),\n};\n\nexport const BundleOutputShape = {\n success: z.boolean().describe('Whether bundling succeeded'),\n totalSize: z.number().optional().describe('Total bundle size in bytes'),\n buildTime: z.number().optional().describe('Build time in milliseconds'),\n packages: z\n .array(\n z.object({\n name: z.string(),\n size: z.number(),\n }),\n )\n .optional()\n .describe('Per-package size breakdown'),\n treeshakingEffective: z\n .boolean()\n .optional()\n .describe('Whether tree-shaking was effective'),\n message: z.string().optional().describe('Status message'),\n};\n\nexport const SimulateOutputShape = {\n success: z.boolean().describe('Whether simulation succeeded'),\n error: z.string().optional().describe('Error message if failed'),\n summary: z.string().describe('One-line result summary'),\n destinations: z\n .record(\n z.string(),\n z.object({\n received: z\n .boolean()\n .describe('Whether destination received the event'),\n calls: z.number().describe('Number of API calls made'),\n payload: z\n .unknown()\n .optional()\n .describe('All intercepted API calls (only when verbose: true)'),\n }),\n )\n .optional()\n .describe('Per-destination results'),\n capturedEvents: z\n .array(z.record(z.string(), z.unknown()))\n .optional()\n .describe('Events captured by source simulation'),\n duration: z.number().optional().describe('Simulation duration in ms'),\n};\n\nexport const PushOutputShape = {\n success: z.boolean().describe('Whether push succeeded'),\n elbResult: z.unknown().optional().describe('Push result from the collector'),\n duration: z.number().describe('Push duration in milliseconds'),\n error: z.string().optional().describe('Error message if push failed'),\n};\n\n// Examples List output shape\nexport const ExamplesListOutputShape = {\n flow: z.string().describe('Flow name'),\n count: z.number().describe('Number of examples found'),\n examples: z\n .array(\n z.object({\n step: z.string().describe('Step location (e.g., \"destination.gtag\")'),\n stepType: z\n .enum(['source', 'transformer', 'destination'])\n .describe('Step type'),\n stepName: z.string().describe('Step name'),\n exampleName: z.string().describe('Example name'),\n hasIn: z.boolean().describe('Whether the example has an input value'),\n hasOut: z.boolean().describe('Whether the example has an output value'),\n hasMapping: z\n .boolean()\n .describe('Whether the example has a mapping configuration'),\n hasTrigger: z\n .boolean()\n .describe('Whether the example has trigger metadata'),\n in: z.unknown().optional().describe('Input event data'),\n out: z.unknown().optional().describe('Expected output data'),\n mapping: z\n .unknown()\n .optional()\n .describe('Mapping configuration for destinations'),\n trigger: z\n .object({\n type: z.string().optional(),\n options: z.unknown().optional(),\n })\n .optional()\n .describe('Trigger metadata for source simulation'),\n }),\n )\n .describe('Step examples'),\n};\n","import { z } from 'zod';\nimport { bundle, bundleRemote } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { BundleOutputShape } from '../schemas/output.js';\n\nexport function registerFlowBundleTool(server: McpServer) {\n server.registerTool(\n 'flow_bundle',\n {\n title: 'Bundle Flow',\n description:\n 'Bundle a walkerOS flow configuration into deployable JavaScript. ' +\n 'Resolves all destinations, sources, and transformers, then outputs ' +\n 'a tree-shaken production bundle. Returns bundle statistics. ' +\n 'Set remote: true to use the walkerOS cloud service instead of local build tools.',\n inputSchema: {\n ...schemas.BundleInputShape,\n remote: z\n .boolean()\n .optional()\n .describe(\n 'Use remote cloud bundling (requires WALKEROS_TOKEN). Default: false (local)',\n ),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Flow.Config JSON content (required when remote: true)'),\n },\n outputSchema: BundleOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async ({ configPath, flow, stats, output, remote, content }) => {\n try {\n if (remote) {\n if (!content)\n throw new Error('content is required when remote: true');\n const result = await bundleRemote({\n content: content as Record<string, unknown>,\n flowName: flow,\n });\n return mcpResult(\n { success: true, ...result },\n {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n },\n );\n }\n\n const result = await bundle(configPath, {\n flowName: flow,\n stats: stats ?? true,\n buildOverrides: output ? { output } : undefined,\n });\n\n if (!result) {\n return mcpResult(\n { success: false, message: 'Bundle produced no output' },\n {\n warnings: [\n 'The build returned no result. The flow may be empty or misconfigured.',\n ],\n next: ['Run flow_validate to check your configuration'],\n },\n );\n }\n\n const output_ = result as unknown as Record<string, unknown>;\n\n return mcpResult(\n { success: true, ...output_ },\n {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n },\n );\n } catch (error) {\n return mcpError(error, 'Run flow_validate for detailed error messages');\n }\n },\n );\n}\n","import { z } from 'zod';\nimport {\n simulateSource,\n simulateTransformer,\n simulateDestination,\n} from '@walkeros/cli';\nimport type { PushResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { SimulateOutputShape } from '../schemas/output.js';\n\ninterface DestinationSummary {\n received: boolean;\n calls: number;\n payload?: unknown;\n}\n\nexport function registerFlowSimulateTool(server: McpServer) {\n server.registerTool(\n 'flow_simulate',\n {\n title: 'Simulate Flow',\n description:\n 'Simulate events through a walkerOS flow without making real API calls. ' +\n 'For destinations: event is a walkerOS event { name: \"entity action\", data: {...} }. ' +\n 'For sources: event is { content: ..., trigger?: { type?, options? }, env?: {...} }. ' +\n 'Use step to target a specific step. ' +\n 'Use flow_examples to discover available test data. ' +\n 'IMPORTANT: Destinations with require (e.g. require: [\"consent\"]) stay pending until ' +\n 'that collector event fires — simulation will error \"not found\" if require is not satisfied. ' +\n 'Remove require from config or provide consent/user events before simulating. ' +\n 'Separately, destinations with consent (e.g. consent: { marketing: true }) only receive ' +\n 'events where the event includes matching consent. ' +\n 'Mapping transforms event names and data at the destination level. ' +\n 'Policy redacts or injects fields before mapping runs.',\n inputSchema: {\n configPath: schemas.SimulateInputShape.configPath,\n event: z\n .union([z.record(z.string(), z.unknown()), z.string()])\n .optional()\n .describe(\n 'For destinations: { name, data, consent? }. Include consent (e.g. { marketing: true }) ' +\n 'to satisfy destination consent requirements. ' +\n 'For sources: { content, trigger?, env? }. ' +\n 'Can also be a JSON string or file path.',\n ),\n flow: schemas.SimulateInputShape.flow,\n platform: schemas.SimulateInputShape.platform,\n step: schemas.SimulateInputShape.step,\n verbose: z\n .boolean()\n .optional()\n .describe('Include full payload per destination (default: false)'),\n },\n outputSchema: SimulateOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ configPath, event, flow, platform, step, verbose }) => {\n try {\n if (!event) {\n throw new Error(\n 'event is required. For sources provide { content, trigger? }, for destinations provide { name, data }.',\n );\n }\n\n if (!step) {\n throw new Error(\n 'step is required. Specify a target like \"source.browser\", \"destination.gtag\", or \"transformer.demo\".',\n );\n }\n\n // Resolve string event input (JSON string)\n let resolvedEvent: unknown = event;\n if (typeof event === 'string') {\n try {\n resolvedEvent = JSON.parse(event);\n } catch {\n throw new Error(\n 'Event string must be valid JSON. Got: ' +\n event.substring(0, 50),\n );\n }\n }\n\n // Parse step into type and id\n const dotIndex = step.indexOf('.');\n if (dotIndex === -1) {\n throw new Error(\n `Invalid step format \"${step}\". Use \"type.name\" (e.g. \"source.browser\", \"destination.gtag\").`,\n );\n }\n const stepType = step.substring(0, dotIndex);\n const stepId = step.substring(dotIndex + 1);\n\n let result: PushResult;\n\n switch (stepType) {\n case 'source':\n result = await simulateSource(configPath, resolvedEvent, {\n sourceId: stepId,\n flow,\n silent: true,\n });\n break;\n\n case 'transformer':\n result = await simulateTransformer(\n configPath,\n resolvedEvent as import('@walkeros/core').WalkerOS.DeepPartialEvent,\n {\n transformerId: stepId,\n flow,\n silent: true,\n },\n );\n break;\n\n case 'destination':\n result = await simulateDestination(\n configPath,\n resolvedEvent as import('@walkeros/core').WalkerOS.DeepPartialEvent,\n {\n destinationId: stepId,\n flow,\n silent: true,\n },\n );\n break;\n\n default:\n throw new Error(\n `Unknown step type \"${stepType}\". Use \"source\", \"transformer\", or \"destination\".`,\n );\n }\n\n // Source simulation returns captured events\n if (result.captured && result.captured.length > 0) {\n const eventCount = result.captured.length;\n const summary = `Source captured ${eventCount} event${eventCount !== 1 ? 's' : ''}`;\n\n return mcpResult(\n {\n success: result.success,\n error: result.error,\n summary,\n capturedEvents: result.captured,\n duration: result.duration,\n },\n {\n next:\n eventCount > 0\n ? [\n 'Use flow_simulate with a destination step to test downstream processing',\n ]\n : [\n 'Check source package examples with package_get, verify trigger type matches',\n ],\n },\n );\n }\n\n // Destination/transformer simulation\n const destinations: Record<string, DestinationSummary> = {};\n\n // Build destinations summary from elbResult.done\n if (\n result.elbResult &&\n typeof result.elbResult === 'object' &&\n 'done' in result.elbResult &&\n result.elbResult.done\n ) {\n const done = result.elbResult.done as Record<string, unknown>;\n for (const name of Object.keys(done)) {\n destinations[name] = { received: true, calls: 0 };\n }\n }\n\n // Also check usage (call tracking from mock envs)\n if (result.usage) {\n for (const [name, calls] of Object.entries(result.usage)) {\n const summary: DestinationSummary = {\n received: calls.length > 0,\n calls: calls.length,\n };\n if (verbose && calls.length > 0) {\n summary.payload = calls;\n }\n destinations[name] = summary;\n }\n }\n\n const destCount = Object.keys(destinations).length;\n const receivedCount = Object.values(destinations).filter(\n (d) => d.received,\n ).length;\n\n const warnings: string[] = [];\n if (stepType === 'destination' && destCount === 0) {\n warnings.push(\n 'Destination did not receive the event. Common causes: ' +\n '(1) destination config has consent: { marketing: true } but event lacks matching consent, ' +\n '(2) mapping rules do not match the event name, ' +\n '(3) policy redacted required fields. ' +\n 'Add consent to the event: { name: \"...\", data: {...}, consent: { marketing: true } }.',\n );\n }\n\n const summary =\n stepType === 'transformer'\n ? `Transformer processed event`\n : `${receivedCount}/${destCount} destinations received the event`;\n\n const resultObj = {\n success: result.success,\n error: result.error,\n summary,\n destinations: destCount > 0 ? destinations : undefined,\n duration: result.duration,\n };\n\n return mcpResult(resultObj, {\n next: ['Use flow_bundle to build for production'],\n ...(warnings.length > 0 ? { warnings } : {}),\n });\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\n let hint = 'Run flow_validate for detailed error messages';\n if (msg.includes('not found in collector')) {\n hint =\n 'If this destination has require: [\"consent\"] or require: [\"user\"], it stays ' +\n 'pending until that event fires. For simulation, either remove require from ' +\n 'the config or simulate with a flow that omits require on the target destination.';\n }\n return mcpError(error, hint);\n }\n },\n );\n}\n","import { z } from 'zod';\nimport { push } from '@walkeros/cli';\nimport type { PushResult } from '@walkeros/cli';\nimport { schemas } from '@walkeros/cli/dev';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { PushOutputShape } from '../schemas/output.js';\n\nexport function registerFlowPushTool(server: McpServer) {\n server.registerTool(\n 'flow_push',\n {\n title: 'Push Events',\n description:\n 'Push a real event through a walkerOS flow to actual destinations. ' +\n 'Makes real API calls to real endpoints. ' +\n 'Best suited for server-side flows — web flows should use flow_simulate for testing.',\n inputSchema: {\n configPath: schemas.PushInputShape.configPath,\n event: z\n .record(z.string(), z.unknown())\n .describe(\n 'Event object, e.g. { name: \"page view\", data: { title: \"Home\" } }',\n ),\n flow: schemas.PushInputShape.flow,\n platform: schemas.PushInputShape.platform,\n },\n outputSchema: PushOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async ({ configPath, event, flow, platform }) => {\n try {\n const result: PushResult = await push(configPath, event, {\n json: true,\n flow,\n platform,\n });\n\n if (!result.success) {\n return mcpError(\n new Error(result.error || 'Push failed'),\n 'Check destination configuration and connectivity.',\n );\n }\n\n return mcpResult(result);\n } catch (error) {\n return mcpError(\n error,\n 'Check configPath and event format. For web flows, use flow_simulate.',\n );\n }\n },\n );\n}\n","import { z } from 'zod';\nimport { loadJsonConfig } from '@walkeros/cli';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport type { Flow } from '@walkeros/core';\nimport { ExamplesListOutputShape } from '../schemas/output.js';\n\nexport function registerFlowExamplesTool(server: McpServer) {\n server.registerTool(\n 'flow_examples',\n {\n title: 'Flow Examples',\n description:\n 'List all step examples in a walkerOS flow configuration. ' +\n 'Shows example names, step locations, and in/out shapes. ' +\n 'Use this to discover available test fixtures and simulation data.',\n inputSchema: {\n configPath: z\n .string()\n .min(1)\n .describe(\n 'Path to flow configuration file, URL, or inline JSON string',\n ),\n flow: z\n .string()\n .optional()\n .describe('Flow name for multi-flow configs'),\n step: z\n .string()\n .optional()\n .describe('Filter to a specific step (e.g., \"destination.gtag\")'),\n full: z\n .boolean()\n .optional()\n .describe(\n 'Return full in/out/mapping data for each example (default: false, returns metadata only)',\n ),\n },\n outputSchema: ExamplesListOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ configPath, flow, step, full }) => {\n try {\n const rawConfig = await loadJsonConfig<Flow.Config>(configPath);\n\n // Resolve flow name\n const flowNames = Object.keys(rawConfig.flows || {});\n const flowName =\n flow || (flowNames.length === 1 ? flowNames[0] : undefined);\n\n if (!flowName) {\n throw new Error(\n `Multiple flows found. Specify flow parameter. Available: ${flowNames.join(', ')}`,\n );\n }\n\n const flowSettings = rawConfig.flows[flowName];\n if (!flowSettings) {\n throw new Error(`Flow \"${flowName}\" not found`);\n }\n\n // Collect all examples\n const examples: Array<{\n step: string;\n stepType: string;\n stepName: string;\n exampleName: string;\n hasIn: boolean;\n hasOut: boolean;\n hasMapping: boolean;\n hasTrigger: boolean;\n in?: unknown;\n out?: unknown;\n mapping?: unknown;\n trigger?: unknown;\n }> = [];\n\n const stepTypes = [\n { key: 'sources' as const, type: 'source' },\n { key: 'transformers' as const, type: 'transformer' },\n { key: 'destinations' as const, type: 'destination' },\n ];\n\n for (const { key, type } of stepTypes) {\n const refs = flowSettings[key] || {};\n for (const [name, ref] of Object.entries(refs)) {\n if (!ref.examples) continue;\n\n // Apply step filter\n if (step && `${type}.${name}` !== step) continue;\n\n for (const [exName, ex] of Object.entries(\n ref.examples as Flow.StepExamples,\n )) {\n examples.push({\n step: `${type}.${name}`,\n stepType: type,\n stepName: name,\n exampleName: exName,\n hasIn: ex.in !== undefined,\n hasOut: ex.out !== undefined,\n hasMapping: ex.mapping !== undefined,\n hasTrigger: ex.trigger !== undefined,\n ...(full\n ? {\n in: ex.in,\n out: ex.out,\n mapping: ex.mapping,\n trigger: ex.trigger,\n }\n : {}),\n });\n }\n }\n }\n\n const result = {\n flow: flowName,\n count: examples.length,\n examples,\n };\n\n const hints: { next: string[]; warnings?: string[] } = {\n next: ['Use flow_simulate with step and event to simulate'],\n };\n if (examples.length === 0) {\n hints.warnings = [\n 'No examples found. Add examples to step definitions in your flow config for testing.',\n ];\n }\n return mcpResult(result, hints);\n } catch (error) {\n return mcpError(error, 'Check configPath — expected a flow.json file');\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n fetchPackage,\n mergeConfigSchema,\n mcpResult,\n mcpError,\n} from '@walkeros/core';\nimport { fetchCatalog, normalizePlatform } from '../catalog.js';\n\nexport function registerPackageSearchTool(server: McpServer) {\n server.registerTool(\n 'package_search',\n {\n title: 'Search Package',\n description:\n 'Start here for package discovery. Never guess package names — use this tool first to find exact names. ' +\n 'Without package name: returns catalog filtered by type/platform. ' +\n 'With package name: returns metadata, hint keys, and example summaries.',\n inputSchema: {\n package: z\n .string()\n .min(1)\n .optional()\n .describe(\n 'Exact npm package name for detailed lookup (e.g., @walkeros/web-destination-snowplow)',\n ),\n type: z\n .enum(['source', 'destination', 'transformer', 'store'])\n .optional()\n .describe('Filter by package type (browse mode)'),\n platform: z\n .enum(['web', 'server'])\n .optional()\n .describe(\n 'Filter by platform (browse mode, includes universal packages)',\n ),\n version: z\n .string()\n .optional()\n .describe('Package version for detailed lookup (default: latest)'),\n },\n // No outputSchema: browse mode returns {catalog, count}, lookup returns metadata — incompatible shapes\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ package: packageName, type, platform, version }) => {\n const baseUrl = process.env.APP_URL || undefined;\n\n // Browse mode: no package specified → return catalog\n if (!packageName) {\n const catalog = await fetchCatalog({ type, platform, baseUrl });\n const result = { catalog, count: catalog.length };\n return mcpResult(result, {\n next: ['Use package_get for schemas and examples'],\n });\n }\n\n // Lookup mode: fetch specific package details\n try {\n const info = await fetchPackage(packageName, { version, baseUrl });\n\n const result = {\n package: info.packageName,\n version: info.version,\n description: info.description,\n type: info.type,\n platform: normalizePlatform(info.platform),\n hintKeys: info.hintKeys,\n exampleSummaries: info.exampleSummaries,\n };\n\n return mcpResult(result, {\n next: ['Use package_get for schemas and examples'],\n });\n } catch (error) {\n return mcpError(\n error,\n 'Package not found. Use package_search without parameters to browse available packages.',\n );\n }\n },\n );\n}\n\nexport function registerGetPackageSchemaTool(server: McpServer) {\n server.registerTool(\n 'package_get',\n {\n title: 'Get Package',\n description:\n 'Requires exact package name — do not guess names, use package_search first to find them. ' +\n 'Returns schemas + hint texts + example summaries by default (lightweight). ' +\n 'Use section parameter for full content: \"hints\" (with code blocks), \"examples\" (full in/out data), or \"all\".',\n inputSchema: {\n package: z\n .string()\n .min(1)\n .describe(\n 'Exact npm package name (e.g., @walkeros/web-destination-snowplow)',\n ),\n version: z\n .string()\n .optional()\n .describe('Package version (default: latest)'),\n section: z\n .enum(['hints', 'examples', 'all'])\n .optional()\n .describe(\n 'Section to expand with full content. Default: summary view with schemas + hint texts + example descriptions',\n ),\n },\n // No outputSchema — removed to avoid SDK -32602 crashes on unexpected field values\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ package: packageName, version, section }) => {\n const baseUrl = process.env.APP_URL || undefined;\n\n try {\n const info = await fetchPackage(packageName, { version, baseUrl });\n\n // Build merged schemas: base config + package settings → schemas.config\n const mergedSchemas: Record<string, unknown> = {};\n\n if (info.type) {\n mergedSchemas.config = mergeConfigSchema(\n info.type as 'source' | 'destination' | 'transformer' | 'store',\n info.schemas as Record<string, Record<string, unknown>>,\n );\n }\n\n // Keep non-settings schemas as siblings (mapping, ga4, tagger, etc.)\n for (const [key, value] of Object.entries(info.schemas)) {\n if (key !== 'settings') {\n mergedSchemas[key] = value;\n }\n }\n\n const result: Record<string, unknown> = {\n package: info.packageName,\n version: info.version,\n type: info.type,\n platform: normalizePlatform(info.platform),\n schemas: mergedSchemas,\n };\n\n // Hints\n if (info.hints) {\n if (section === 'hints' || section === 'all') {\n result.hints = info.hints;\n } else {\n const hintSummary: Record<string, { text: string }> = {};\n for (const [key, hint] of Object.entries(info.hints)) {\n const h = hint as { text: string };\n hintSummary[key] = { text: h.text };\n }\n result.hints = hintSummary;\n }\n }\n\n // Examples\n if (section === 'examples' || section === 'all') {\n result.examples = info.examples;\n } else {\n result.exampleSummaries = info.exampleSummaries;\n }\n\n return mcpResult(result);\n } catch (error) {\n return mcpError(\n error,\n 'Use package_search to browse available package names.',\n );\n }\n },\n );\n}\n","const NPM_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search';\nconst JSDELIVR_BASE = 'https://cdn.jsdelivr.net/npm';\nconst WALKEROS_JSON_PATH = 'dist/walkerOS.json';\nconst CACHE_TTL = 5 * 60 * 1000;\n\nexport interface CatalogEntry {\n name: string;\n version: string;\n description?: string;\n type: string;\n platform: string[];\n}\n\nlet cache: { entries: CatalogEntry[]; timestamp: number } | undefined;\n\nexport function clearCatalogCache() {\n cache = undefined;\n}\n\nexport function normalizePlatform(platform?: unknown): string[] {\n if (platform == null) return [];\n if (typeof platform === 'string') {\n return platform === 'universal' ? ['web', 'server'] : [platform];\n }\n if (Array.isArray(platform)) {\n return platform.filter((v): v is string => typeof v === 'string');\n }\n return [];\n}\n\nexport async function fetchCatalog(filters?: {\n type?: string;\n platform?: string;\n baseUrl?: string;\n}): Promise<CatalogEntry[]> {\n if (cache && Date.now() - cache.timestamp < CACHE_TTL) {\n return applyFilters(cache.entries, filters);\n }\n\n let entries: CatalogEntry[];\n try {\n entries = filters?.baseUrl\n ? await fetchCatalogFrom(filters.baseUrl, filters)\n : await fetchFromNpm();\n } catch {\n try {\n entries = await fetchFromNpm();\n } catch {\n return [];\n }\n }\n\n cache = { entries, timestamp: Date.now() };\n\n return applyFilters(entries, filters);\n}\n\nasync function fetchCatalogFrom(\n baseUrl: string,\n filters?: { type?: string; platform?: string },\n): Promise<CatalogEntry[]> {\n const params = new URLSearchParams();\n if (filters?.type) params.set('type', filters.type);\n if (filters?.platform) params.set('platform', filters.platform);\n\n const url = `${baseUrl}/api/packages${params.toString() ? `?${params}` : ''}`;\n const res = await fetch(url, { signal: AbortSignal.timeout(15000) });\n if (!res.ok) throw new Error(`Catalog fetch failed: ${res.status}`);\n\n const data = (await res.json()) as { catalog: CatalogEntry[] };\n return data.catalog;\n}\n\nasync function fetchFromNpm(): Promise<CatalogEntry[]> {\n const res = await fetch(`${NPM_SEARCH_URL}?text=@walkeros/&size=250`, {\n signal: AbortSignal.timeout(10000),\n });\n if (!res.ok) throw new Error(`npm search failed: ${res.status}`);\n\n const data = (await res.json()) as {\n objects: Array<{\n package: { name: string; version: string; description?: string };\n }>;\n };\n\n const metaResults = await Promise.allSettled(\n data.objects.map((obj) => enrichWithMeta(obj.package)),\n );\n\n return metaResults\n .filter(\n (r): r is PromiseFulfilledResult<CatalogEntry | undefined> =>\n r.status === 'fulfilled',\n )\n .map((r) => r.value)\n .filter((entry): entry is CatalogEntry => entry !== undefined);\n}\n\nasync function enrichWithMeta(pkg: {\n name: string;\n version: string;\n description?: string;\n}): Promise<CatalogEntry | undefined> {\n try {\n const res = await fetch(\n `${JSDELIVR_BASE}/${pkg.name}@${pkg.version}/${WALKEROS_JSON_PATH}`,\n { signal: AbortSignal.timeout(5000) },\n );\n if (!res.ok) return undefined;\n\n const json = (await res.json()) as { $meta?: Record<string, unknown> };\n const meta = json.$meta;\n if (!meta || typeof meta.type !== 'string') return undefined;\n\n return {\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n type: meta.type,\n platform: normalizePlatform(meta.platform),\n };\n } catch {\n return undefined;\n }\n}\n\nfunction applyFilters(\n entries: CatalogEntry[],\n filters?: { type?: string; platform?: string },\n): CatalogEntry[] {\n let results = entries;\n if (filters?.type) {\n results = results.filter((e) => e.type === filters.type);\n }\n if (filters?.platform) {\n // Empty platform means platform-agnostic → matches any filter\n results = results.filter(\n (e) => e.platform.length === 0 || e.platform.includes(filters.platform!),\n );\n }\n return results;\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { loadJsonConfig } from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\n\nconst WEB_SKELETON = {\n version: 3,\n flows: {\n default: {\n web: {},\n packages: {},\n sources: {},\n destinations: {},\n },\n },\n};\n\nconst SERVER_SKELETON = {\n version: 3,\n flows: {\n default: {\n server: {},\n packages: {},\n sources: {},\n destinations: {},\n },\n },\n};\n\nexport function registerFlowLoadTool(server: McpServer) {\n server.registerTool(\n 'flow_load',\n {\n title: 'Load or Create Flow',\n description:\n 'Load an existing flow configuration from a local file path, URL, or walkerOS API (by flow ID). ' +\n 'Or create a new empty flow by specifying a platform (web or server). ' +\n 'Use the add-step prompt to add sources, destinations, transformers, or stores to the flow.',\n inputSchema: {\n source: z\n .string()\n .optional()\n .describe(\n 'Flow source: local file path (./flow.json), URL (https://...), ' +\n 'inline JSON string, or API flow ID (cfg_...). Omit to create a new flow.',\n ),\n platform: z\n .enum(['web', 'server'])\n .optional()\n .describe(\n 'Platform for new flows. Required when source is omitted. ' +\n 'web = browser tracking, server = Node.js HTTP.',\n ),\n },\n outputSchema: {\n version: z.number().describe('Flow config version'),\n flows: z.record(z.string(), z.unknown()).describe('Flow definitions'),\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ source, platform }) => {\n try {\n if (source) {\n const config = await loadJsonConfig(source);\n return mcpResult(config, {\n next: [\n 'Use flow_validate to check',\n 'Use add-step prompt to modify',\n ],\n });\n }\n\n if (!platform) {\n return mcpError(\n new Error(\n 'Provide source (file path, URL, or flow ID) to load existing flow, ' +\n 'or platform (web/server) to create a new one.',\n ),\n );\n }\n\n const skeleton = platform === 'web' ? WEB_SKELETON : SERVER_SKELETON;\n return mcpResult(skeleton, {\n next: [\n 'Read walkeros://reference/flow-schema for config structure',\n 'Use add-step prompt to add sources and destinations',\n ],\n });\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\n if (msg.includes('not found') || msg.includes('ENOENT'))\n return mcpError(\n error,\n 'Check configPath — expected a flow.json file',\n );\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { feedback, readConfig, writeConfig } from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\n\ndeclare const __VERSION__: string;\n\nexport function registerFeedbackTool(server: McpServer) {\n server.registerTool(\n 'feedback',\n {\n title: 'Send Feedback',\n description: 'Send feedback about walkerOS',\n inputSchema: {\n text: z.string().describe('Your feedback text'),\n anonymous: z\n .boolean()\n .optional()\n .describe(\n 'Include user/project info? false = include, true = anonymous. Only needed on first call if not yet configured.',\n ),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async (params) => {\n try {\n const { text, anonymous: explicitAnonymous } = params;\n\n const config = readConfig();\n let anonymous = config?.anonymousFeedback;\n\n // First time: need user's consent choice\n if (anonymous === undefined && explicitAnonymous === undefined) {\n return mcpResult(\n { needsConsent: true },\n {\n next: [\n 'Ask the user if they want to include their info',\n 'Call feedback again with anonymous: true or false',\n ],\n },\n );\n }\n\n // Store preference if this is the first time\n if (anonymous === undefined && explicitAnonymous !== undefined) {\n anonymous = explicitAnonymous;\n const base = config ?? { token: '', email: '', appUrl: '' };\n writeConfig({ ...base, anonymousFeedback: anonymous });\n }\n\n // Use explicit override if provided, otherwise use stored value\n const isAnonymous = explicitAnonymous ?? anonymous ?? true;\n\n await feedback(text, { anonymous: isAnonymous, version: __VERSION__ });\n\n return mcpResult({ ok: true });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ServerNotification } from '@modelcontextprotocol/sdk/types.js';\nimport {\n whoami,\n listProjects,\n getProject,\n createProject,\n updateProject,\n deleteProject,\n listFlows,\n getFlow,\n createFlow,\n updateFlow,\n deleteFlow,\n duplicateFlow,\n deploy,\n getDeployment,\n listDeployments,\n getDeploymentBySlug,\n createDeployment as createDep,\n deleteDeployment as deleteDep,\n} from '@walkeros/cli';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { ApiOutputShape } from '../schemas/api-output.js';\n\nconst ACTIONS = [\n 'whoami',\n 'project.list',\n 'project.get',\n 'project.create',\n 'project.update',\n 'project.delete',\n 'flow.list',\n 'flow.get',\n 'flow.create',\n 'flow.update',\n 'flow.delete',\n 'flow.duplicate',\n 'deploy',\n 'deployment.get',\n 'deployment.list',\n 'deployment.create',\n 'deployment.delete',\n] as const;\n\nexport function registerApiTool(server: McpServer) {\n server.registerTool(\n 'api',\n {\n title: 'walkerOS Cloud API',\n description:\n 'Manage walkerOS cloud projects, flows, and deployments. Requires WALKEROS_TOKEN env var.\\n\\n' +\n 'Actions:\\n' +\n '- whoami — verify token, get user info\\n' +\n '- project.list/get/create/update/delete — manage projects\\n' +\n '- flow.list/get/create/update/delete/duplicate — manage flow configs\\n' +\n '- deploy — deploy a flow (auto-detects web/server)\\n' +\n '- deployment.get/list/create/delete — manage deployments\\n\\n' +\n 'Parameters vary by action. content = Flow.Config JSON for flow.create/update.',\n inputSchema: {\n action: z.enum(ACTIONS).describe('API action to perform'),\n projectId: z\n .string()\n .optional()\n .describe(\n 'Project ID (proj_...). Required for: project.get/update/delete, flow.create, flow.list. ' +\n 'Falls back to WALKEROS_PROJECT_ID env var.',\n ),\n flowId: z\n .string()\n .optional()\n .describe(\n 'Flow ID (flow_...) or config ID (cfg_...). Required for: ' +\n 'flow.get, flow.update, flow.delete, flow.duplicate, deploy. ' +\n 'For deployment.get/delete: can be a deployment slug.',\n ),\n name: z\n .string()\n .optional()\n .describe('Name for create/update operations'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Flow.Config JSON for flow operations'),\n patch: z\n .boolean()\n .optional()\n .describe('Use merge-patch for flow.update (default: true)'),\n wait: z\n .boolean()\n .optional()\n .describe('Wait for deploy to complete (default: true)'),\n flowName: z\n .string()\n .optional()\n .describe('Flow name for multi-settings flows'),\n fields: z\n .array(z.string())\n .optional()\n .describe('Dot-path field selectors for flow.get'),\n type: z\n .enum(['web', 'server'])\n .optional()\n .describe('Deployment type for deployment.create'),\n sort: z.string().optional().describe('Sort field for list operations'),\n order: z.enum(['asc', 'desc']).optional().describe('Sort order'),\n status: z\n .string()\n .optional()\n .describe('Status filter for deployment.list'),\n includeDeleted: z\n .boolean()\n .optional()\n .describe('Include deleted items in lists'),\n },\n outputSchema: ApiOutputShape,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n async (params, extra) => {\n const {\n action,\n projectId,\n flowId,\n name,\n content,\n patch,\n wait,\n flowName,\n fields,\n type,\n sort,\n order,\n status,\n includeDeleted,\n } = params;\n\n try {\n let data: unknown;\n\n switch (action) {\n // Auth\n case 'whoami': {\n data = await whoami();\n break;\n }\n\n // Projects\n case 'project.list': {\n data = await listProjects();\n break;\n }\n case 'project.get': {\n data = await getProject({ projectId });\n break;\n }\n case 'project.create': {\n if (!name) throw new Error('name required for project.create');\n data = await createProject({ name });\n break;\n }\n case 'project.update': {\n if (!name) throw new Error('name required for project.update');\n data = await updateProject({ projectId, name });\n break;\n }\n case 'project.delete': {\n data = await deleteProject({ projectId });\n break;\n }\n\n // Flows\n case 'flow.list': {\n data = await listFlows({\n projectId,\n sort: sort as 'name' | 'updated_at' | 'created_at' | undefined,\n order: order as 'asc' | 'desc' | undefined,\n includeDeleted,\n });\n break;\n }\n case 'flow.get': {\n if (!flowId) throw new Error('flowId required for flow.get');\n data = await getFlow({ flowId, projectId, fields });\n break;\n }\n case 'flow.create': {\n if (!name) throw new Error('name required for flow.create');\n if (!content) throw new Error('content required for flow.create');\n data = await createFlow({ name, content, projectId });\n break;\n }\n case 'flow.update': {\n if (!flowId) throw new Error('flowId required for flow.update');\n data = await updateFlow({\n flowId,\n name,\n content,\n projectId,\n mergePatch: patch ?? true,\n });\n break;\n }\n case 'flow.delete': {\n if (!flowId) throw new Error('flowId required for flow.delete');\n data = await deleteFlow({ flowId, projectId });\n break;\n }\n case 'flow.duplicate': {\n if (!flowId) throw new Error('flowId required for flow.duplicate');\n data = await duplicateFlow({ flowId, name, projectId });\n break;\n }\n\n // Deploy\n case 'deploy': {\n if (!flowId) throw new Error('flowId required for deploy');\n const progressToken = extra._meta?.progressToken;\n const DEPLOY_TIMEOUT_MS = 90_000;\n const timeoutSignal = AbortSignal.timeout(DEPLOY_TIMEOUT_MS);\n const combinedAbort = new AbortController();\n const onAbort = () => combinedAbort.abort();\n timeoutSignal.addEventListener('abort', onAbort);\n extra.signal?.addEventListener('abort', onAbort);\n data = await deploy({\n flowId,\n projectId,\n wait: wait ?? true,\n flowName,\n timeout: DEPLOY_TIMEOUT_MS,\n onStatus: (s: string, sub: string | null) => {\n if (!progressToken) return;\n const key = sub ? `${s}:${sub}` : s;\n const stages: Record<\n string,\n { progress: number; label: string }\n > = {\n 'bundling:building': {\n progress: 20,\n label: 'Building bundle...',\n },\n 'deploying:publishing': {\n progress: 60,\n label: 'Publishing to CDN...',\n },\n 'deploying:provisioning': {\n progress: 60,\n label: 'Provisioning container...',\n },\n 'deploying:starting': {\n progress: 80,\n label: 'Starting container...',\n },\n published: { progress: 100, label: 'Published' },\n active: { progress: 100, label: 'Active' },\n failed: { progress: 100, label: 'Failed' },\n };\n const stage = stages[key] ??\n stages[s] ?? { progress: 10, label: key };\n extra.sendNotification({\n method: 'notifications/progress',\n params: {\n progressToken,\n progress: stage.progress,\n total: 100,\n message: stage.label,\n },\n } as ServerNotification);\n },\n signal: combinedAbort.signal,\n });\n timeoutSignal.removeEventListener('abort', onAbort);\n extra.signal?.removeEventListener('abort', onAbort);\n const st = (data as Record<string, unknown>).status;\n const deployData = data as Record<string, unknown>;\n if (st === 'failed') {\n return mcpResult(\n { action, ok: false, data },\n {\n next: ['Run flow_validate to check your configuration'],\n },\n );\n } else {\n const publicUrl = deployData.publicUrl as string | undefined;\n const containerUrl = deployData.containerUrl as\n | string\n | undefined;\n const deployType = deployData.type as string | undefined;\n const nextHints: string[] = [];\n if (deployType === 'web' && publicUrl) {\n nextHints.push(`Bundle at ${publicUrl}`);\n nextHints.push(`Add <script src='${publicUrl}'></script>`);\n } else if (deployType === 'server' && containerUrl) {\n nextHints.push(`Container at ${containerUrl}`);\n nextHints.push(`Test: curl ${containerUrl}/health`);\n }\n if (nextHints.length > 0) {\n return mcpResult(\n { action, ok: true, data },\n {\n next: nextHints,\n },\n );\n }\n }\n break;\n }\n\n // Deployments\n case 'deployment.get': {\n if (!flowId)\n throw new Error(\n 'flowId (flowId or slug) required for deployment.get',\n );\n try {\n data = await getDeployment({ flowId, flowName });\n } catch {\n data = await getDeploymentBySlug({ slug: flowId });\n }\n break;\n }\n case 'deployment.list': {\n data = await listDeployments({\n projectId,\n type: type as 'web' | 'server' | undefined,\n status,\n });\n break;\n }\n case 'deployment.create': {\n if (!type)\n throw new Error(\n 'type (web/server) required for deployment.create',\n );\n data = await createDep({ type, label: name, projectId });\n break;\n }\n case 'deployment.delete': {\n if (!flowId)\n throw new Error('flowId (slug) required for deployment.delete');\n data = await deleteDep({ slug: flowId });\n break;\n }\n\n default:\n throw new Error(\n `Unknown action: ${action}. Use one of: ${ACTIONS.join(', ')}`,\n );\n }\n\n return mcpResult({ action, ok: true, data });\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\n const name = error instanceof Error ? error.name : '';\n\n // Deploy timeout — return helpful status instead of raw error\n if (\n action === 'deploy' &&\n (name === 'AbortError' ||\n name === 'TimeoutError' ||\n msg.includes('abort'))\n ) {\n return mcpResult(\n {\n action,\n ok: true,\n data: { status: 'deploying', flowId },\n },\n {\n next: [\n 'Use api(action: \"deployment.list\") to check current status',\n ],\n },\n );\n }\n\n if (\n msg.includes('401') ||\n msg.includes('403') ||\n msg.includes('Unauthorized')\n )\n return mcpError(\n error,\n 'Set WALKEROS_TOKEN env var or check token expiry',\n );\n if (msg.includes('required'))\n return mcpError(\n error,\n `See api tool description for ${action} parameters.`,\n );\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\n\nexport const ApiOutputShape = {\n action: z.string().describe('Action that was executed'),\n ok: z.boolean().describe('Whether the action succeeded'),\n data: z.unknown().describe('Action-specific result data'),\n};\n","import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { fetchPackageSchema } from '@walkeros/core';\nimport { fetchCatalog } from '../catalog.js';\n\nexport function registerPackageSchemaResources(server: McpServer) {\n const template = new ResourceTemplate('walkeros://schema/{packageName}', {\n list: async () => {\n const catalog = await fetchCatalog();\n return {\n resources: catalog.map((pkg) => ({\n uri: `walkeros://schema/${encodeURIComponent(pkg.name)}`,\n name: pkg.name,\n description: `Schema and examples for ${pkg.name}`,\n mimeType: 'application/json' as const,\n })),\n };\n },\n });\n\n server.registerResource(\n 'package-schema',\n template,\n {\n title: 'walkerOS Package Schema',\n description:\n 'JSON Schema and configuration examples for walkerOS packages',\n mimeType: 'application/json',\n },\n async (uri, { packageName }) => {\n const info = await fetchPackageSchema(\n decodeURIComponent(packageName as string),\n );\n return {\n contents: [\n {\n uri: uri.toString(),\n mimeType: 'application/json' as const,\n text: JSON.stringify(info, null, 2),\n },\n ],\n };\n },\n );\n}\n","/**\n * Reference resources — pure schema and structural data only.\n *\n * Design principle: resources are loaded into context and should contain\n * only schemas, type definitions, and structural references. Behavioral\n * guidance, tutorials, and step-by-step instructions belong in prompts.\n * Vendor-specific examples belong in packages (fetched via package_get).\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { schemas } from '@walkeros/core/dev';\nimport { fetchCatalog } from '../catalog.js';\n\nexport function registerReferenceResources(server: McpServer) {\n // Flow Schema reference (generated from Zod)\n server.resource(\n 'flow-schema',\n 'walkeros://reference/flow-schema',\n {\n description:\n 'JSON Schema for Flow.Config — the complete flow configuration structure',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/flow-schema',\n text: JSON.stringify(schemas.configJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Event Model reference (generated from Zod)\n server.resource(\n 'event-model',\n 'walkeros://reference/event-model',\n {\n description:\n 'JSON Schema for walkerOS events: entity-action naming, data, context, globals, user, consent',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/event-model',\n text: JSON.stringify(schemas.eventJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Mapping reference (generated from Zod — composite of related schemas)\n server.resource(\n 'mapping',\n 'walkeros://reference/mapping',\n {\n description:\n 'JSON Schemas for walkerOS mapping: rules, valueConfig, rule, policy',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/mapping',\n text: JSON.stringify(\n {\n rules: schemas.rulesJsonSchema,\n valueConfig: schemas.valueConfigJsonSchema,\n rule: schemas.ruleJsonSchema,\n policy: schemas.policyJsonSchema,\n },\n null,\n 2,\n ),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Consent reference (generated from Zod)\n server.resource(\n 'consent',\n 'walkeros://reference/consent',\n {\n description:\n 'JSON Schema for walkerOS consent: destination-level, rule-level, and field-level consent gating',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/consent',\n text: JSON.stringify(schemas.consentJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Variables reference (hand-maintained — runtime interpolation patterns not captured in Zod schemas)\n server.resource(\n 'variables',\n 'walkeros://reference/variables',\n {\n description:\n 'walkerOS variable patterns: $var, $env, $def, $contract, $code, $store substitution',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/variables',\n text: JSON.stringify(\n {\n patterns: {\n '$var.name':\n 'Variable substitution — cascade: step settings > flow settings > config variables',\n '$env.NAME':\n 'Environment variable — $env.GA_ID reads process.env.GA_ID',\n '$env.NAME:default':\n 'Environment variable with fallback — $env.GA_ID:G-DEFAULT',\n '$def.name':\n 'Definition reference — reusable config blocks from definitions section',\n '$def.name.path.deep':\n 'Nested definition access — $def.ga4Events.purchase',\n '$contract.name':\n 'Contract reference — links to named contract for validation',\n '$contract.name.path':\n 'Nested contract access — $contract.ecommerce.product',\n '$code:(expr)':\n 'Inline JavaScript — $code:(event) => event.data.price * 100',\n '$store:storeId':\n 'Store injection in env values — wires runtime store access',\n },\n cascade: {\n priority: [\n '1. Step-level settings (highest)',\n '2. Flow-level settings',\n '3. Config-level variables (lowest)',\n ],\n example: {\n variables: { apiKey: 'default-key' },\n flows: {\n production: {\n destinations: {\n api: {\n config: { key: '$var.apiKey' },\n settings: { apiKey: 'prod-key' },\n },\n },\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Contract reference (generated from Zod)\n server.resource(\n 'contract',\n 'walkeros://reference/contract',\n {\n description:\n 'JSON Schema for walkerOS contracts: event schema validation with entity-action keying',\n mimeType: 'application/json',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://reference/contract',\n text: JSON.stringify(schemas.contractJsonSchema, null, 2),\n mimeType: 'application/json',\n },\n ],\n }),\n );\n\n // Examples reference (loaded from @walkeros/cli at runtime)\n server.resource(\n 'examples',\n 'walkeros://reference/examples',\n {\n description:\n 'Complete flow config example: web + server flows, mapping, contracts, step examples',\n mimeType: 'application/json',\n },\n async () => {\n let example: string;\n try {\n const { readFileSync } = await import('fs');\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const examplePath =\n require.resolve('@walkeros/cli/examples/flow-complete.json');\n example = readFileSync(examplePath, 'utf-8');\n } catch {\n example = JSON.stringify({ error: 'Example not found' });\n }\n return {\n contents: [\n {\n uri: 'walkeros://reference/examples',\n text: example,\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n\n // API reference (OpenAPI spec)\n server.resource(\n 'api',\n 'walkeros://reference/api',\n {\n description: 'walkerOS cloud API — OpenAPI 3.1 specification',\n mimeType: 'application/json',\n },\n async () => {\n let openApiSpec: string;\n try {\n const { readFileSync } = await import('fs');\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const specPath = require.resolve('@walkeros/cli/openapi/spec.json');\n openApiSpec = readFileSync(specPath, 'utf-8');\n } catch {\n openApiSpec = JSON.stringify({ error: 'OpenAPI spec not found' });\n }\n return {\n contents: [\n {\n uri: 'walkeros://reference/api',\n text: openApiSpec,\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n\n // Packages catalog resource\n server.resource(\n 'packages',\n 'walkeros://reference/packages',\n {\n description:\n 'Complete walkerOS package catalog — all sources, destinations, transformers, and stores',\n mimeType: 'application/json',\n },\n async () => {\n const catalog = await fetchCatalog();\n return {\n contents: [\n {\n uri: 'walkeros://reference/packages',\n text: JSON.stringify(catalog, null, 2),\n mimeType: 'application/json',\n },\n ],\n };\n },\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerAddStepPrompt(server: McpServer) {\n server.registerPrompt(\n 'add-step',\n {\n description:\n 'Add a source, destination, transformer, or store step to a flow configuration. ' +\n 'Guides through package selection, config scaffolding, and wiring.',\n argsSchema: {\n stepType: z\n .string()\n .optional()\n .describe(\n 'Type of step to add: source, destination, transformer, or store',\n ),\n flowPath: z\n .string()\n .optional()\n .describe('Path to the flow.json file to modify'),\n },\n },\n async ({ stepType, flowPath }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me add a ${stepType || 'new'} step to my flow${flowPath ? ` at ${flowPath}` : ''}.`,\n '',\n 'Follow these steps:',\n `1. ${stepType ? '' : 'Ask what type of step (source, destination, transformer, store). Then '}Use package_search to browse available packages for the selected type and platform.`,\n '2. Use package_get to read the package\\'s config schema (schemas.config contains the full config shape: base fields like consent/require/logger + package-specific settings). Use section=\"hints\" for additional guidance.',\n '3. Use package_get with section=\"examples\" to see working configuration examples.',\n '4. Scaffold the step config using the package schemas — include required settings with placeholder values.',\n '5. Wire the step into the flow: add to packages section (with version if needed), connect via next/before chains if needed.',\n '6. For destinations: configure mapping using nested entity → action keys. Event \"product add\" maps to `{ \"product\": { \"add\": { name: \"AddToCart\" } } }`. Use the setup-mapping prompt for guidance.',\n '7. For destinations: if consent-gated loading is needed, add require: [\"consent\"] to config. ' +\n 'Note: require delays initialization until a \"walker consent\" event fires. ' +\n 'When simulating with flow_simulate, destinations with require will error \"not found\" — ' +\n 'remove require temporarily or test without it. ' +\n 'For per-event consent filtering, add consent: { marketing: true } to config.',\n '8. Use flow_validate to verify the result.',\n '9. For server sources: check if the package supports `ingest` configuration via package_get. Ingest extracts request metadata (IP, user-agent, headers) using mapping syntax. Transformers like fingerprint depend on ingest data.',\n '10. When adding a transformer that uses ingest fields, verify the source has `ingest` configured — otherwise ingest fields resolve to empty values.',\n '',\n 'Important:',\n '- Read the walkeros://reference/flow-schema resource to understand connection rules.',\n '- Sources connect to pre-collector transformers via `next`.',\n '- Destinations connect to post-collector transformers via `before`.',\n '- Stores are passive — referenced via `$store:storeName` in env values.',\n '- Use variables ($var) for values that change between environments.',\n '- For required settings without defaults in the package schema, ask the user which value to use. Do not guess credentials, IDs, or environment-specific values.',\n '- If $meta.exports lists named exports, set the `code` field on the step to the chosen export name. If only one export exists, use it automatically.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerSetupMappingPrompt(server: McpServer) {\n server.registerPrompt(\n 'setup-mapping',\n {\n description:\n 'Set up event mapping for any step in a flow. Teaches mapping syntax and uses package examples as templates.',\n argsSchema: {\n stepName: z\n .string()\n .optional()\n .describe('Step name in the flow (e.g., \"gtag\", \"meta\", \"express\")'),\n },\n },\n async ({ stepName }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me set up mapping${stepName ? ` for the \"${stepName}\" step` : ''}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/mapping resource for syntax reference.',\n `2. ${stepName ? `Identify the package for \"${stepName}\" in the flow, then u` : 'U'}se package_get with section=\"examples\" to see the source output shape — mapping keys must match the actual events the source emits.`,\n '3. Ask whether this is source mapping (raw input → walkerOS events) or destination mapping (walkerOS events → vendor format).',\n '4. Ask which events to map (one at a time, not all at once).',\n '5. Generate one mapping rule using the package examples as templates. Validate it with flow_validate before moving to the next.',\n '6. Repeat for each event.',\n '',\n 'Mapping uses nested entity → action keys. Event \"product add\" maps to `{ \"product\": { \"add\": Rule } }`. Wildcards: `{ \"*\": { \"view\": Rule } }`.',\n '',\n 'Use $def references for shared mapping patterns across destinations.',\n '',\n 'Policy and consent in mapping:',\n '- config.policy runs BEFORE mapping rules — use it to inject or redact fields on the event.',\n '- rule.policy runs after config.policy but before data transformation — use for event-specific pre-processing.',\n '- config.consent gates ALL events to this destination. rule.consent gates specific event types.',\n '- Individual value configs support consent: { marketing: true } for field-level gating.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerManageContractPrompt(server: McpServer) {\n server.registerPrompt(\n 'manage-contract',\n {\n description:\n 'Create or update event contracts for a flow. Can generate contracts from existing mappings or scaffold mappings from contracts.',\n argsSchema: {\n direction: z\n .string()\n .optional()\n .describe(\n 'Direction: \"from-mappings\" (extract contract from existing mappings), ' +\n '\"from-scratch\" (create new contract), or \"to-mappings\" (scaffold mappings from contract)',\n ),\n },\n },\n async ({ direction }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me ${direction === 'to-mappings' ? 'scaffold mappings from a contract' : direction === 'from-mappings' ? 'generate a contract from existing mappings' : 'manage event contracts'}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/contract resource to understand contract structure.',\n direction === 'from-mappings'\n ? '2. Read all destination mappings in the flow, extract referenced event fields, and generate a contract with those as required properties.'\n : direction === 'to-mappings'\n ? '2. Read the contract from the flow, then scaffold mapping stubs for each destination based on the contract fields.'\n : '2. Ask for entity-action names and required properties, or ask whether to generate from existing mappings.',\n '3. Use entity-action keying with wildcards (*.*, *.action, entity.*) for broad rules.',\n '4. Define JSON Schema for events, globals, context, custom, user, and consent.',\n '5. Use flow_validate to verify the contract.',\n '',\n 'Contracts and mappings are bidirectional:',\n '- **Contract → Mappings**: contract defines what events look like, mappings are scaffolded to match.',\n '- **Mappings → Contract**: existing mappings reveal which fields are used, contract formalizes them.',\n '',\n 'For server flows: if the contract references fields populated by ingest (e.g., user fingerprint hash), verify the source config.ingest extracts the needed request metadata.',\n '',\n 'Use $contract.name references to link contracts in the flow.',\n 'Contracts support extends for inheritance between event types.',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerUseDefinitionsPrompt(server: McpServer) {\n server.registerPrompt(\n 'use-definitions',\n {\n description:\n 'Extract shared patterns into definitions and variables for DRY, environment-aware flow configurations.',\n argsSchema: {\n flowPath: z\n .string()\n .optional()\n .describe('Path to the flow.json file to analyze'),\n },\n },\n async ({ flowPath }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Help me extract shared patterns into definitions and variables${flowPath ? ` in ${flowPath}` : ''}.`,\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/variables resource to understand variable syntax.',\n '2. Analyze the flow config for repeated patterns (same mapping blocks, same config values).',\n '3. Extract repeated mapping patterns into the `definitions` section with `$def.name` references.',\n '4. Extract environment-specific values into `variables` with `$var.name` references.',\n '5. Show the cascade priority: step > settings > config.',\n '6. Use flow_validate to verify the result.',\n '',\n 'Variable types:',\n '- `$var.name` — variable substitution (cascade: step > settings > config)',\n '- `$env.NAME` and `$env.NAME:default` — environment variables',\n '- `$def.name` and `$def.name.path.deep` — definition references',\n '- `$contract.name` — contract references',\n '- `$code:(expr)` — inline JavaScript functions',\n '- `$store:storeId` — store injection in env values',\n '',\n 'Look for:',\n '- Same API keys or URLs across multiple destinations → $var or $env',\n '- Identical mapping rules in multiple destinations → $def',\n '- Environment-specific values (dev/staging/prod) → $var with overrides',\n ].join('\\n'),\n },\n },\n ],\n }),\n );\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,gBAAgB;AAEzB,SAAS,eAAe;AAExB,SAAS,WAAW,gBAAgB;;;ACJpC,SAAS,SAAS;AAGX,IAAM,sBAAsB;AAAA,EACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,2BAA2B;AAAA,EACvD,MAAM,EACH,MAAM;AAAA,IACL,EAAE,KAAK,CAAC,YAAY,SAAS,SAAS,QAAQ,SAAS,CAAC;AAAA,IACxD,EAAE,OAAO,EAAE,MAAM,4CAA4C;AAAA,EAC/D,CAAC,EACA,SAAS,oBAAoB;AAAA,EAChC,QAAQ,EACL;AAAA,IACC,EAAE,OAAO;AAAA,MACP,MAAM,EAAE,OAAO;AAAA,MACf,SAAS,EAAE,OAAO;AAAA,MAClB,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA,MAC5B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,IAC5B,CAAC;AAAA,EACH,EACC,SAAS,mBAAmB;AAAA,EAC/B,UAAU,EACP;AAAA,IACC,EAAE,OAAO;AAAA,MACP,MAAM,EAAE,OAAO;AAAA,MACf,SAAS,EAAE,OAAO;AAAA,MAClB,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,IAClC,CAAC;AAAA,EACH,EACC,SAAS,qBAAqB;AAAA,EACjC,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B,SAAS,+BAA+B;AAC7C;AAEO,IAAM,oBAAoB;AAAA,EAC/B,SAAS,EAAE,QAAQ,EAAE,SAAS,4BAA4B;AAAA,EAC1D,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,4BAA4B;AAAA,EACtE,W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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8DhB;AACF;AAEA,yBAAyB,MAAM;AAC/B,uBAAuB,MAAM;AAC7B,yBAAyB,MAAM;AAC/B,qBAAqB,MAAM;AAC3B,yBAAyB,MAAM;AAC/B,0BAA0B,MAAM;AAChC,6BAA6B,MAAM;AACnC,qBAAqB,MAAM;AAC3B,qBAAqB,MAAM;AAC3B,+BAA+B,MAAM;AACrC,2BAA2B,MAAM;AACjC,sBAAsB,MAAM;AAC5B,2BAA2B,MAAM;AACjC,6BAA6B,MAAM;AACnC,6BAA6B,MAAM;AAEnC,IAAI,QAAQ,IAAI,gBAAgB;AAC9B,kBAAgB,MAAM;AACxB;AAEA,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,UAAQ,MAAM,2CAA2C;AAC3D;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,oCAAoC,KAAK;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["server","z","schemas","mcpResult","mcpError","server","schemas","z","result","mcpResult","mcpError","z","schemas","mcpResult","mcpError","server","schemas","z","summary","mcpResult","mcpError","z","schemas","mcpResult","mcpError","server","schemas","z","mcpError","mcpResult","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","loadJsonConfig","mcpResult","mcpError","server","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","server","z","mcpResult","name","mcpError","server","schemas","server","schemas","require","z","server","z","server","z","server","z","server"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-next-1775064795590",
|
|
4
4
|
"description": "MCP server for walkerOS flow development - discover packages, scaffold configs, validate, bundle, simulate, and test event pipelines",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
34
|
-
"@walkeros/cli": "
|
|
35
|
-
"@walkeros/core": "
|
|
34
|
+
"@walkeros/cli": "3.2.0-next-1775064795590",
|
|
35
|
+
"@walkeros/core": "3.2.0-next-1775064795590"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"zod": "^4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^20.0.0",
|
|
42
|
-
"@walkeros/config": "
|
|
42
|
+
"@walkeros/config": "3.2.0-next-1775064795590"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|