@walkeros/mcp 3.0.1 → 3.0.2
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 +107 -57
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -278,7 +278,7 @@ function registerFlowSimulateTool(server2) {
|
|
|
278
278
|
"flow_simulate",
|
|
279
279
|
{
|
|
280
280
|
title: "Simulate Flow",
|
|
281
|
-
description: 'Simulate events through a walkerOS flow without making real API calls. Events must be in walkerOS format (post-source): { name: "entity action", data: {...} }.
|
|
281
|
+
description: 'Simulate events through a walkerOS flow without making real API calls. Events must be in walkerOS event format (post-source output): { name: "entity action", data: {...} }. Use package_get on your source to check its output shape. Use the example parameter to load event input from a step example and compare output.',
|
|
282
282
|
inputSchema: schemas3.SimulateInputShape,
|
|
283
283
|
outputSchema: SimulateOutputShape,
|
|
284
284
|
annotations: {
|
|
@@ -322,7 +322,7 @@ function registerFlowSimulateTool(server2) {
|
|
|
322
322
|
}
|
|
323
323
|
if (destCount > 0 && receivedCount === 0) {
|
|
324
324
|
warnings.push(
|
|
325
|
-
|
|
325
|
+
"No destinations received the event. Check: mapping keys use nested entity\u2192action structure (not dot-separated), event name matches, consent is granted. Use package_get on the destination for mapping examples."
|
|
326
326
|
);
|
|
327
327
|
}
|
|
328
328
|
const summary = `${receivedCount}/${destCount} destinations received the event`;
|
|
@@ -354,7 +354,7 @@ function registerFlowPushTool(server2) {
|
|
|
354
354
|
"flow_push",
|
|
355
355
|
{
|
|
356
356
|
title: "Push Events",
|
|
357
|
-
description: "Push a real event through a walkerOS flow to actual destinations.
|
|
357
|
+
description: "Push a real event through a walkerOS flow to actual destinations. Makes real API calls to real endpoints. Best suited for server-side flows \u2014 web flows should use flow_simulate for testing.",
|
|
358
358
|
inputSchema: schemas4.PushInputShape,
|
|
359
359
|
outputSchema: PushOutputShape,
|
|
360
360
|
annotations: {
|
|
@@ -374,7 +374,7 @@ function registerFlowPushTool(server2) {
|
|
|
374
374
|
if (!result.success) {
|
|
375
375
|
return mcpError4(
|
|
376
376
|
new Error(result.error || "Push failed"),
|
|
377
|
-
"Check destination configuration and
|
|
377
|
+
"Check destination configuration and connectivity."
|
|
378
378
|
);
|
|
379
379
|
}
|
|
380
380
|
const summary = `Pushed event${result.duration ? ` (${result.duration}ms)` : ""}`;
|
|
@@ -382,7 +382,7 @@ function registerFlowPushTool(server2) {
|
|
|
382
382
|
} catch (error) {
|
|
383
383
|
return mcpError4(
|
|
384
384
|
error,
|
|
385
|
-
"Check configPath and event format. For web
|
|
385
|
+
"Check configPath and event format. For web flows, use flow_simulate."
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -906,8 +906,63 @@ function registerFlowLoadTool(server2) {
|
|
|
906
906
|
);
|
|
907
907
|
}
|
|
908
908
|
|
|
909
|
+
// src/tools/feedback.ts
|
|
910
|
+
import { z as z6 } from "zod";
|
|
911
|
+
import { feedback, readConfig, writeConfig } from "@walkeros/cli";
|
|
912
|
+
import { mcpResult as mcpResult8, mcpError as mcpError8 } from "@walkeros/core";
|
|
913
|
+
function registerFeedbackTool(server2) {
|
|
914
|
+
server2.registerTool(
|
|
915
|
+
"feedback",
|
|
916
|
+
{
|
|
917
|
+
title: "Send Feedback",
|
|
918
|
+
description: "Send feedback about walkerOS",
|
|
919
|
+
inputSchema: {
|
|
920
|
+
text: z6.string().describe("Your feedback text"),
|
|
921
|
+
anonymous: z6.boolean().optional().describe(
|
|
922
|
+
"Include user/project info? false = include, true = anonymous. Only needed on first call if not yet configured."
|
|
923
|
+
)
|
|
924
|
+
},
|
|
925
|
+
annotations: {
|
|
926
|
+
readOnlyHint: false,
|
|
927
|
+
destructiveHint: false,
|
|
928
|
+
idempotentHint: false,
|
|
929
|
+
openWorldHint: true
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
async (params) => {
|
|
933
|
+
try {
|
|
934
|
+
const { text, anonymous: explicitAnonymous } = params;
|
|
935
|
+
const config = readConfig();
|
|
936
|
+
let anonymous = config?.anonymousFeedback;
|
|
937
|
+
if (anonymous === void 0 && explicitAnonymous === void 0) {
|
|
938
|
+
return mcpResult8(
|
|
939
|
+
{ needsConsent: true },
|
|
940
|
+
'Before sending feedback, ask the user: "Would you like to include your user and project info with feedback? This is a one-time choice." Then call feedback again with the anonymous parameter set.',
|
|
941
|
+
{
|
|
942
|
+
next: [
|
|
943
|
+
"Ask the user if they want to include their info",
|
|
944
|
+
"Call feedback again with anonymous: true or false"
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
if (anonymous === void 0 && explicitAnonymous !== void 0) {
|
|
950
|
+
anonymous = explicitAnonymous;
|
|
951
|
+
const base = config ?? { token: "", email: "", appUrl: "" };
|
|
952
|
+
writeConfig({ ...base, anonymousFeedback: anonymous });
|
|
953
|
+
}
|
|
954
|
+
const isAnonymous = explicitAnonymous ?? anonymous ?? true;
|
|
955
|
+
await feedback(text, { anonymous: isAnonymous });
|
|
956
|
+
return mcpResult8({ ok: true }, "Feedback sent. Thanks!");
|
|
957
|
+
} catch (error) {
|
|
958
|
+
return mcpError8(error);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
|
|
909
964
|
// src/tools/api.ts
|
|
910
|
-
import { z as
|
|
965
|
+
import { z as z8 } from "zod";
|
|
911
966
|
import {
|
|
912
967
|
whoami,
|
|
913
968
|
listProjects,
|
|
@@ -928,14 +983,14 @@ import {
|
|
|
928
983
|
createDeployment as createDep,
|
|
929
984
|
deleteDeployment as deleteDep
|
|
930
985
|
} from "@walkeros/cli";
|
|
931
|
-
import { mcpResult as
|
|
986
|
+
import { mcpResult as mcpResult9, mcpError as mcpError9 } from "@walkeros/core";
|
|
932
987
|
|
|
933
988
|
// src/schemas/api-output.ts
|
|
934
|
-
import { z as
|
|
989
|
+
import { z as z7 } from "zod";
|
|
935
990
|
var ApiOutputShape = {
|
|
936
|
-
action:
|
|
937
|
-
ok:
|
|
938
|
-
data:
|
|
991
|
+
action: z7.string().describe("Action that was executed"),
|
|
992
|
+
ok: z7.boolean().describe("Whether the action succeeded"),
|
|
993
|
+
data: z7.unknown().describe("Action-specific result data")
|
|
939
994
|
};
|
|
940
995
|
|
|
941
996
|
// src/tools/api.ts
|
|
@@ -965,19 +1020,19 @@ function registerApiTool(server2) {
|
|
|
965
1020
|
title: "walkerOS Cloud API",
|
|
966
1021
|
description: "Manage walkerOS cloud projects, flows, and deployments. Requires WALKEROS_TOKEN env var.\n\nActions:\n- whoami \u2014 verify token, get user info\n- project.list/get/create/update/delete \u2014 manage projects\n- flow.list/get/create/update/delete/duplicate \u2014 manage flow configs\n- deploy \u2014 deploy a flow (auto-detects web/server)\n- deployment.get/list/create/delete \u2014 manage deployments\n\nParameters vary by action. id = flowId/projectId/slug depending on context. content = Flow.Config JSON for flow.create/update.",
|
|
967
1022
|
inputSchema: {
|
|
968
|
-
action:
|
|
969
|
-
id:
|
|
970
|
-
name:
|
|
971
|
-
content:
|
|
972
|
-
patch:
|
|
973
|
-
wait:
|
|
974
|
-
flowName:
|
|
975
|
-
fields:
|
|
976
|
-
type:
|
|
977
|
-
sort:
|
|
978
|
-
order:
|
|
979
|
-
status:
|
|
980
|
-
includeDeleted:
|
|
1023
|
+
action: z8.enum(ACTIONS).describe("API action to perform"),
|
|
1024
|
+
id: z8.string().optional().describe("Resource ID (flowId, projectId, or deployment slug)"),
|
|
1025
|
+
name: z8.string().optional().describe("Name for create/update operations"),
|
|
1026
|
+
content: z8.record(z8.string(), z8.unknown()).optional().describe("Flow.Config JSON for flow operations"),
|
|
1027
|
+
patch: z8.boolean().optional().describe("Use merge-patch for flow.update (default: true)"),
|
|
1028
|
+
wait: z8.boolean().optional().describe("Wait for deploy to complete (default: true)"),
|
|
1029
|
+
flowName: z8.string().optional().describe("Flow name for multi-settings flows"),
|
|
1030
|
+
fields: z8.array(z8.string()).optional().describe("Dot-path field selectors for flow.get"),
|
|
1031
|
+
type: z8.enum(["web", "server"]).optional().describe("Deployment type for deployment.create"),
|
|
1032
|
+
sort: z8.string().optional().describe("Sort field for list operations"),
|
|
1033
|
+
order: z8.enum(["asc", "desc"]).optional().describe("Sort order"),
|
|
1034
|
+
status: z8.string().optional().describe("Status filter for deployment.list"),
|
|
1035
|
+
includeDeleted: z8.boolean().optional().describe("Include deleted items in lists")
|
|
981
1036
|
},
|
|
982
1037
|
outputSchema: ApiOutputShape,
|
|
983
1038
|
annotations: {
|
|
@@ -1121,7 +1176,7 @@ function registerApiTool(server2) {
|
|
|
1121
1176
|
const deployData = data;
|
|
1122
1177
|
if (st === "failed") {
|
|
1123
1178
|
const msg = `Deploy failed: ${deployData.errorMessage ?? "unknown error"}`;
|
|
1124
|
-
return
|
|
1179
|
+
return mcpResult9({ action, ok: false, data }, msg, {
|
|
1125
1180
|
next: ["Run flow_validate to check your configuration"]
|
|
1126
1181
|
});
|
|
1127
1182
|
} else {
|
|
@@ -1138,7 +1193,7 @@ function registerApiTool(server2) {
|
|
|
1138
1193
|
nextHints.push(`Test: curl ${containerUrl}/health`);
|
|
1139
1194
|
}
|
|
1140
1195
|
if (nextHints.length > 0) {
|
|
1141
|
-
return
|
|
1196
|
+
return mcpResult9({ action, ok: true, data }, summary, {
|
|
1142
1197
|
next: nextHints
|
|
1143
1198
|
});
|
|
1144
1199
|
}
|
|
@@ -1189,20 +1244,20 @@ function registerApiTool(server2) {
|
|
|
1189
1244
|
`Unknown action: ${action}. Use one of: ${ACTIONS.join(", ")}`
|
|
1190
1245
|
);
|
|
1191
1246
|
}
|
|
1192
|
-
return
|
|
1247
|
+
return mcpResult9({ action, ok: true, data }, summary);
|
|
1193
1248
|
} catch (error) {
|
|
1194
1249
|
const msg = error instanceof Error ? error.message : "";
|
|
1195
1250
|
if (msg.includes("401") || msg.includes("403") || msg.includes("Unauthorized"))
|
|
1196
|
-
return
|
|
1251
|
+
return mcpError9(
|
|
1197
1252
|
error,
|
|
1198
1253
|
"Set WALKEROS_TOKEN env var or check token expiry"
|
|
1199
1254
|
);
|
|
1200
1255
|
if (msg.includes("required"))
|
|
1201
|
-
return
|
|
1256
|
+
return mcpError9(
|
|
1202
1257
|
error,
|
|
1203
1258
|
`See api tool description for ${action} parameters.`
|
|
1204
1259
|
);
|
|
1205
|
-
return
|
|
1260
|
+
return mcpError9(error);
|
|
1206
1261
|
}
|
|
1207
1262
|
}
|
|
1208
1263
|
);
|
|
@@ -1475,17 +1530,17 @@ function registerReferenceResources(server2) {
|
|
|
1475
1530
|
}
|
|
1476
1531
|
|
|
1477
1532
|
// src/prompts/add-step.ts
|
|
1478
|
-
import { z as
|
|
1533
|
+
import { z as z9 } from "zod";
|
|
1479
1534
|
function registerAddStepPrompt(server2) {
|
|
1480
1535
|
server2.registerPrompt(
|
|
1481
1536
|
"add-step",
|
|
1482
1537
|
{
|
|
1483
1538
|
description: "Add a source, destination, transformer, or store step to a flow configuration. Guides through package selection, config scaffolding, and wiring.",
|
|
1484
1539
|
argsSchema: {
|
|
1485
|
-
stepType:
|
|
1540
|
+
stepType: z9.string().optional().describe(
|
|
1486
1541
|
"Type of step to add: source, destination, transformer, or store"
|
|
1487
1542
|
),
|
|
1488
|
-
flowPath:
|
|
1543
|
+
flowPath: z9.string().optional().describe("Path to the flow.json file to modify")
|
|
1489
1544
|
}
|
|
1490
1545
|
},
|
|
1491
1546
|
async ({ stepType, flowPath }) => ({
|
|
@@ -1505,6 +1560,8 @@ function registerAddStepPrompt(server2) {
|
|
|
1505
1560
|
"5. Wire the step into the flow: add to packages section (with version if needed), connect via next/before chains if needed.",
|
|
1506
1561
|
'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.',
|
|
1507
1562
|
"7. Use flow_validate to verify the result.",
|
|
1563
|
+
"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.",
|
|
1564
|
+
"9. When adding a transformer that uses ingest fields, verify the source has `ingest` configured \u2014 otherwise ingest fields resolve to empty values.",
|
|
1508
1565
|
"",
|
|
1509
1566
|
"Important:",
|
|
1510
1567
|
"- Read the walkeros://reference/flow-schema resource to understand connection rules.",
|
|
@@ -1523,14 +1580,14 @@ function registerAddStepPrompt(server2) {
|
|
|
1523
1580
|
}
|
|
1524
1581
|
|
|
1525
1582
|
// src/prompts/setup-mapping.ts
|
|
1526
|
-
import { z as
|
|
1583
|
+
import { z as z10 } from "zod";
|
|
1527
1584
|
function registerSetupMappingPrompt(server2) {
|
|
1528
1585
|
server2.registerPrompt(
|
|
1529
1586
|
"setup-mapping",
|
|
1530
1587
|
{
|
|
1531
1588
|
description: "Set up event mapping for any step in a flow. Teaches mapping syntax and uses package examples as templates.",
|
|
1532
1589
|
argsSchema: {
|
|
1533
|
-
stepName:
|
|
1590
|
+
stepName: z10.string().optional().describe('Step name in the flow (e.g., "gtag", "meta", "express")')
|
|
1534
1591
|
}
|
|
1535
1592
|
},
|
|
1536
1593
|
async ({ stepName }) => ({
|
|
@@ -1542,25 +1599,15 @@ function registerSetupMappingPrompt(server2) {
|
|
|
1542
1599
|
text: [
|
|
1543
1600
|
`Help me set up mapping${stepName ? ` for the "${stepName}" step` : ""}.`,
|
|
1544
1601
|
"",
|
|
1545
|
-
"IMPORTANT \u2014 Mapping key structure:",
|
|
1546
|
-
"Mapping uses NESTED entity \u2192 action keys, NOT dot-separated strings.",
|
|
1547
|
-
'Event name "product add" splits into entity "product" and action "add".',
|
|
1548
|
-
'Config structure: `{ "mapping": { "product": { "add": { name: "AddToCart", data: { ... } } } } }`',
|
|
1549
|
-
'Wildcards: `{ "*": { "view": Rule } }` matches any entity with action "view".',
|
|
1550
|
-
"",
|
|
1551
1602
|
"Follow these steps:",
|
|
1552
|
-
"1. Read the walkeros://reference/mapping resource for
|
|
1553
|
-
`2. ${stepName ? `Identify the package for "${stepName}" in the flow, then u` : "U"}se package_get with section="examples" to see
|
|
1554
|
-
|
|
1555
|
-
"4.
|
|
1556
|
-
"5.
|
|
1603
|
+
"1. Read the walkeros://reference/mapping resource for syntax reference.",
|
|
1604
|
+
`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 \u2014 mapping keys must match the actual events the source emits.`,
|
|
1605
|
+
"3. Ask whether this is source mapping (raw input \u2192 walkerOS events) or destination mapping (walkerOS events \u2192 vendor format).",
|
|
1606
|
+
"4. Ask which events to map (one at a time, not all at once).",
|
|
1607
|
+
"5. Generate one mapping rule using the package examples as templates. Validate it with flow_validate before moving to the next.",
|
|
1608
|
+
"6. Repeat for each event.",
|
|
1557
1609
|
"",
|
|
1558
|
-
|
|
1559
|
-
"- **Source mapping**: normalizes raw input \u2192 walkerOS events",
|
|
1560
|
-
"- **Destination mapping**: transforms walkerOS events \u2192 vendor format",
|
|
1561
|
-
"",
|
|
1562
|
-
"Key mapping operators: data (extract), map (object transform), loop (array processing), ",
|
|
1563
|
-
"set (create array), fn ($code function), condition (conditional), consent (consent-gated).",
|
|
1610
|
+
'Mapping uses nested entity \u2192 action keys. Event "product add" maps to `{ "product": { "add": Rule } }`. Wildcards: `{ "*": { "view": Rule } }`.',
|
|
1564
1611
|
"",
|
|
1565
1612
|
"Use $def references for shared mapping patterns across destinations."
|
|
1566
1613
|
].join("\n")
|
|
@@ -1572,14 +1619,14 @@ function registerSetupMappingPrompt(server2) {
|
|
|
1572
1619
|
}
|
|
1573
1620
|
|
|
1574
1621
|
// src/prompts/manage-contract.ts
|
|
1575
|
-
import { z as
|
|
1622
|
+
import { z as z11 } from "zod";
|
|
1576
1623
|
function registerManageContractPrompt(server2) {
|
|
1577
1624
|
server2.registerPrompt(
|
|
1578
1625
|
"manage-contract",
|
|
1579
1626
|
{
|
|
1580
1627
|
description: "Create or update event contracts for a flow. Can generate contracts from existing mappings or scaffold mappings from contracts.",
|
|
1581
1628
|
argsSchema: {
|
|
1582
|
-
direction:
|
|
1629
|
+
direction: z11.string().optional().describe(
|
|
1583
1630
|
'Direction: "from-mappings" (extract contract from existing mappings), "from-scratch" (create new contract), or "to-mappings" (scaffold mappings from contract)'
|
|
1584
1631
|
)
|
|
1585
1632
|
}
|
|
@@ -1604,6 +1651,8 @@ function registerManageContractPrompt(server2) {
|
|
|
1604
1651
|
"- **Contract \u2192 Mappings**: contract defines what events look like, mappings are scaffolded to match.",
|
|
1605
1652
|
"- **Mappings \u2192 Contract**: existing mappings reveal which fields are used, contract formalizes them.",
|
|
1606
1653
|
"",
|
|
1654
|
+
"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.",
|
|
1655
|
+
"",
|
|
1607
1656
|
"Use $contract.name references to link contracts in the flow.",
|
|
1608
1657
|
"Contracts support extends for inheritance between event types."
|
|
1609
1658
|
].join("\n")
|
|
@@ -1615,14 +1664,14 @@ function registerManageContractPrompt(server2) {
|
|
|
1615
1664
|
}
|
|
1616
1665
|
|
|
1617
1666
|
// src/prompts/use-definitions.ts
|
|
1618
|
-
import { z as
|
|
1667
|
+
import { z as z12 } from "zod";
|
|
1619
1668
|
function registerUseDefinitionsPrompt(server2) {
|
|
1620
1669
|
server2.registerPrompt(
|
|
1621
1670
|
"use-definitions",
|
|
1622
1671
|
{
|
|
1623
1672
|
description: "Extract shared patterns into definitions and variables for DRY, environment-aware flow configurations.",
|
|
1624
1673
|
argsSchema: {
|
|
1625
|
-
flowPath:
|
|
1674
|
+
flowPath: z12.string().optional().describe("Path to the flow.json file to analyze")
|
|
1626
1675
|
}
|
|
1627
1676
|
},
|
|
1628
1677
|
async ({ flowPath }) => ({
|
|
@@ -1666,7 +1715,7 @@ function registerUseDefinitionsPrompt(server2) {
|
|
|
1666
1715
|
var server = new McpServer(
|
|
1667
1716
|
{
|
|
1668
1717
|
name: "walkeros-flow",
|
|
1669
|
-
version: "3.0.
|
|
1718
|
+
version: "3.0.2"
|
|
1670
1719
|
},
|
|
1671
1720
|
{
|
|
1672
1721
|
instructions: `walkerOS is an open-source, privacy-first event data collection platform. Define event pipelines as code using JSON flow configurations.
|
|
@@ -1734,6 +1783,7 @@ registerFlowExamplesTool(server);
|
|
|
1734
1783
|
registerPackageSearchTool(server);
|
|
1735
1784
|
registerGetPackageSchemaTool(server);
|
|
1736
1785
|
registerFlowLoadTool(server);
|
|
1786
|
+
registerFeedbackTool(server);
|
|
1737
1787
|
registerPackageSchemaResources(server);
|
|
1738
1788
|
registerReferenceResources(server);
|
|
1739
1789
|
registerAddStepPrompt(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/registry.ts","../src/tools/flow-load.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 { 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\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.\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);\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 summary = result.valid\n ? 'Valid'\n : `Invalid: ${result.errors.length} errors, ${result.warnings.length} warnings`;\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, summary, 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', '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.unknown().optional().describe('Transformed payload sent'),\n }),\n )\n .optional()\n .describe('Per-destination results'),\n exampleMatch: z\n .object({\n name: z.string(),\n step: z.string(),\n match: z.boolean(),\n diff: z.string().optional(),\n })\n .optional()\n .describe('Example comparison result when using example parameter'),\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 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 }),\n )\n .describe('Step examples'),\n};\n\n// Package Search output shape (lightweight metadata + content keys)\nexport const PackageSearchOutputShape = {\n package: z.string().describe('Package name'),\n version: z.string().describe('Package version'),\n description: z.string().optional().describe('Package description'),\n type: z\n .string()\n .optional()\n .describe('Package type (destination, source, transformer)'),\n platform: z.string().optional().describe('Target platform (web, server)'),\n hintKeys: z\n .array(z.string())\n .describe('Available hint keys (use package_get section=hints to read)'),\n exampleSummaries: z\n .array(\n z.object({\n name: z.string().describe('Example name'),\n description: z.string().optional().describe('What this example shows'),\n }),\n )\n .describe(\n 'Step example names and descriptions (use package_get section=examples to read full content)',\n ),\n};\n\n// Package Schema output shape (full details, supports progressive disclosure)\nexport const PackageSchemaOutputShape = {\n package: z.string().describe('Package name'),\n version: z.string().describe('Package version'),\n type: z.string().describe('Package type (destination, source, transformer)'),\n platform: z.string().describe('Target platform (web, server)'),\n schemas: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('JSON Schemas for settings and mapping'),\n examples: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\n 'Full configuration examples (included when section=examples or section=all)',\n ),\n exampleSummaries: z\n .array(\n z.object({\n name: z.string().describe('Example name'),\n description: z.string().optional().describe('What this example shows'),\n }),\n )\n .optional()\n .describe(\n 'Example names and descriptions (included in default/summary mode)',\n ),\n hints: z\n .record(\n z.string(),\n z.object({\n text: z.string(),\n code: z\n .array(\n z.object({\n lang: z.string().optional(),\n code: z.string(),\n }),\n )\n .optional(),\n }),\n )\n .optional()\n .describe(\n 'Hints — text only in summary mode, with code blocks when section=hints or section=all',\n ),\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 const r = result as Record<string, unknown>;\n const size = r.totalSize ?? r.size;\n const time = r.buildTime;\n const summary = `Bundled${size ? ` (${formatBytes(size as number)}` : ''}${time ? `, ${time}ms)` : size ? ')' : ''}`;\n return mcpResult({ success: true, ...result }, summary, {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\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 '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 const size = output_.totalSize as number | undefined;\n const time = output_.buildTime as number | undefined;\n const summary = `Bundled${size ? ` (${formatBytes(size)}` : ''}${time ? `, ${time}ms)` : size ? ')' : ''}`;\n\n return mcpResult({ success: true, ...output_ }, summary, {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n });\n } catch (error) {\n return mcpError(error, 'Run flow_validate for detailed error messages');\n }\n },\n );\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return `${(bytes / 1024).toFixed(1)} KB`;\n}\n","import { 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 'Events must be in walkerOS format (post-source): { name: \"entity action\", data: {...} }. ' +\n 'Raw source input (dataLayer pushes, HTTP requests) must first be converted to walkerOS events. ' +\n 'Check source package examples to see what events a source outputs. ' +\n 'Use the example parameter to load event input from a step example and compare output.',\n inputSchema: schemas.SimulateInputShape,\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, example, step }) => {\n try {\n if (!event && !example) {\n throw new Error('Either event or example must be provided');\n }\n\n const raw: SimulationResult = await simulate(configPath, event, {\n json: true,\n flow,\n platform,\n example,\n step,\n });\n\n // Summarize per-destination\n const destinations: Record<string, DestinationSummary> = {};\n\n if (raw.usage) {\n for (const [name, calls] of Object.entries(raw.usage)) {\n destinations[name] = {\n received: calls.length > 0,\n calls: calls.length,\n payload: calls.length > 0 ? calls[calls.length - 1] : undefined,\n };\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(\n 'No destinations found in flow configuration. Check that your flow defines at least one destination.',\n );\n }\n if (destCount > 0 && receivedCount === 0) {\n warnings.push(\n 'No destinations received the event. Most common cause: mapping keys must be NESTED entity → action objects — event \"product add\" needs { \"product\": { \"add\": Rule } }, not \"product.add\". Also check event name match and consent settings.',\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 exampleMatch: raw.exampleMatch,\n duration: raw.duration,\n };\n\n return mcpResult(result, summary, {\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 { 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 'WARNING: This makes real API calls to real endpoints. ' +\n 'Note: Web destinations (gtag, meta, etc.) require browser globals that are not available in Node.js. ' +\n 'For web flows, use flow_simulate to test. flow_push works best for server-side flows.',\n inputSchema: schemas.PushInputShape,\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 network connectivity. For web destinations, use flow_simulate instead.',\n );\n }\n\n const summary = `Pushed event${result.duration ? ` (${result.duration}ms)` : ''}`;\n\n return mcpResult(result, summary);\n } catch (error) {\n return mcpError(\n error,\n 'Check configPath and event format. For web destinations, use flow_simulate instead.',\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('Path to flow configuration file'),\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 in?: unknown;\n out?: unknown;\n mapping?: 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 ...(full\n ? { in: ex.in, out: ex.out, mapping: ex.mapping }\n : {}),\n });\n }\n }\n }\n\n // Count unique steps\n const stepSet = new Set(examples.map((e) => e.step));\n\n const result = {\n flow: flowName,\n count: examples.length,\n examples,\n };\n\n const totalExamples = examples.length;\n const summary = `${totalExamples} examples across ${stepSet.size} steps`;\n const hints: { next: string[]; warnings?: string[] } = {\n next: ['Use flow_simulate with example parameter to test'],\n };\n if (totalExamples === 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, summary, 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 { fetchPackage, mcpResult, mcpError } from '@walkeros/core';\nimport { PackageSchemaOutputShape } from '../schemas/output.js';\nimport { filterRegistry } from '../registry.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 = filterRegistry({ type, platform });\n const result = { catalog, count: catalog.length };\n const summary = `${catalog.length} packages found`;\n return mcpResult(result, summary, {\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: info.platform,\n hintKeys: info.hintKeys,\n exampleSummaries: info.exampleSummaries,\n };\n\n const summary = `${info.packageName} v${info.version}`;\n return mcpResult(result, summary, {\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 outputSchema: PackageSchemaOutputShape,\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 const result: Record<string, unknown> = {\n package: info.packageName,\n version: info.version,\n type: info.type,\n platform: info.platform,\n schemas: info.schemas,\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 const schemaCount = Object.keys(info.schemas).length;\n const exampleCount = info.exampleSummaries.length;\n const summary = `${info.packageName} — ${schemaCount} schemas, ${exampleCount} examples`;\n\n return mcpResult(result, summary);\n } catch (error) {\n return mcpError(\n error,\n 'Use package_search to browse available package names.',\n );\n }\n },\n );\n}\n","export interface PackageRegistryEntry {\n name: string;\n type: 'source' | 'destination' | 'transformer' | 'store';\n platform: 'web' | 'server' | 'universal';\n description: string;\n}\n\nexport const PACKAGE_REGISTRY: PackageRegistryEntry[] = [\n // Web Destinations\n {\n name: '@walkeros/web-destination-gtag',\n type: 'destination',\n platform: 'web',\n description: 'Google destination (GA4, Ads, GTM via gtag.js)',\n },\n {\n name: '@walkeros/web-destination-meta',\n type: 'destination',\n platform: 'web',\n description: 'Meta (Facebook) Pixel',\n },\n {\n name: '@walkeros/web-destination-plausible',\n type: 'destination',\n platform: 'web',\n description: 'Plausible Analytics',\n },\n {\n name: '@walkeros/web-destination-snowplow',\n type: 'destination',\n platform: 'web',\n description: 'Snowplow Analytics',\n },\n {\n name: '@walkeros/web-destination-piwikpro',\n type: 'destination',\n platform: 'web',\n description: 'Piwik PRO Analytics',\n },\n {\n name: '@walkeros/web-destination-api',\n type: 'destination',\n platform: 'web',\n description: 'Generic HTTP API destination',\n },\n\n // Server Destinations\n {\n name: '@walkeros/server-destination-gcp',\n type: 'destination',\n platform: 'server',\n description: 'Google Cloud Platform (BigQuery)',\n },\n {\n name: '@walkeros/server-destination-aws',\n type: 'destination',\n platform: 'server',\n description: 'AWS (Firehose)',\n },\n {\n name: '@walkeros/server-destination-meta',\n type: 'destination',\n platform: 'server',\n description: 'Meta Conversions API (server-side)',\n },\n {\n name: '@walkeros/server-destination-api',\n type: 'destination',\n platform: 'server',\n description: 'Generic HTTP API destination (server)',\n },\n {\n name: '@walkeros/server-destination-datamanager',\n type: 'destination',\n platform: 'server',\n description: 'Google Data Manager',\n },\n\n // Web Sources\n {\n name: '@walkeros/web-source-browser',\n type: 'source',\n platform: 'web',\n description: 'Browser DOM event capture (clicks, page views, forms)',\n },\n {\n name: '@walkeros/web-source-datalayer',\n type: 'source',\n platform: 'web',\n description: 'Google Tag Manager dataLayer bridge',\n },\n {\n name: '@walkeros/web-source-session',\n type: 'source',\n platform: 'web',\n description: 'Session tracking source',\n },\n\n // CMP Sources\n {\n name: '@walkeros/web-source-cmp-cookiefirst',\n type: 'source',\n platform: 'web',\n description: 'CookieFirst consent management',\n },\n {\n name: '@walkeros/web-source-cmp-cookiepro',\n type: 'source',\n platform: 'web',\n description: 'CookiePro/OneTrust consent management',\n },\n {\n name: '@walkeros/web-source-cmp-usercentrics',\n type: 'source',\n platform: 'web',\n description: 'Usercentrics consent management',\n },\n\n // Server Sources\n {\n name: '@walkeros/server-source-express',\n type: 'source',\n platform: 'server',\n description: 'Express.js HTTP event endpoint',\n },\n {\n name: '@walkeros/server-source-fetch',\n type: 'source',\n platform: 'server',\n description: 'Web Fetch API source (Cloudflare, Vercel Edge, Deno, Bun)',\n },\n {\n name: '@walkeros/server-source-aws',\n type: 'source',\n platform: 'server',\n description: 'AWS sources (Lambda, API Gateway, Function URLs)',\n },\n {\n name: '@walkeros/server-source-gcp',\n type: 'source',\n platform: 'server',\n description: 'GCP sources (Cloud Functions)',\n },\n\n // Transformers\n {\n name: '@walkeros/transformer-router',\n type: 'transformer',\n platform: 'universal',\n description: 'Route events to different destination subsets',\n },\n {\n name: '@walkeros/transformer-validator',\n type: 'transformer',\n platform: 'universal',\n description: 'Event validation using JSON Schema',\n },\n {\n name: '@walkeros/server-transformer-fingerprint',\n type: 'transformer',\n platform: 'server',\n description: 'Device fingerprinting for anonymous user identification',\n },\n {\n name: '@walkeros/server-transformer-cache',\n type: 'transformer',\n platform: 'server',\n description: 'HTTP response caching with LRU eviction',\n },\n {\n name: '@walkeros/server-transformer-file',\n type: 'transformer',\n platform: 'server',\n description: 'File serving transformer for static files',\n },\n\n // Stores\n {\n name: '@walkeros/store-memory',\n type: 'store',\n platform: 'universal',\n description: 'In-memory key-value store with LRU eviction and TTL',\n },\n {\n name: '@walkeros/server-store-fs',\n type: 'store',\n platform: 'server',\n description: 'File system key-value store',\n },\n {\n name: '@walkeros/server-store-s3',\n type: 'store',\n platform: 'server',\n description: 'AWS S3 key-value store',\n },\n {\n name: '@walkeros/server-store-gcs',\n type: 'store',\n platform: 'server',\n description: 'Google Cloud Storage key-value store',\n },\n];\n\nexport function filterRegistry(filters?: {\n type?: string;\n platform?: string;\n}): PackageRegistryEntry[] {\n let results = PACKAGE_REGISTRY;\n if (filters?.type) {\n results = results.filter((p) => p.type === filters.type);\n }\n if (filters?.platform) {\n results = results.filter(\n (p) => p.platform === filters.platform || p.platform === 'universal',\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 '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(\n config,\n `Loaded flow from ${source}. Use flow_validate to check, or add-step prompt to modify.`,\n {\n next: [\n 'Use flow_validate to check',\n 'Use add-step prompt to modify',\n ],\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(\n skeleton,\n `Created empty ${platform} flow. Use the add-step prompt to add sources, destinations, and transformers.`,\n {\n next: [\n 'Read walkeros://reference/flow-schema for config structure',\n 'Use add-step prompt to add sources and destinations',\n ],\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 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. id = flowId/projectId/slug depending on context. ' +\n 'content = Flow.Config JSON for flow.create/update.',\n inputSchema: {\n action: z.enum(ACTIONS).describe('API action to perform'),\n id: z\n .string()\n .optional()\n .describe('Resource ID (flowId, projectId, or deployment slug)'),\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 id,\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 let summary: string;\n\n switch (action) {\n // Auth\n case 'whoami': {\n data = await whoami();\n summary = `Authenticated as ${(data as Record<string, unknown>).email}`;\n break;\n }\n\n // Projects\n case 'project.list': {\n data = await listProjects();\n summary = `${(((data as Record<string, unknown>).projects as unknown[]) ?? []).length} projects`;\n break;\n }\n case 'project.get': {\n data = await getProject({ projectId: id });\n summary = `Project \"${(data as Record<string, unknown>).name}\"`;\n break;\n }\n case 'project.create': {\n if (!name) throw new Error('name required for project.create');\n data = await createProject({ name });\n summary = `Created project \"${name}\"`;\n break;\n }\n case 'project.update': {\n if (!name) throw new Error('name required for project.update');\n data = await updateProject({ projectId: id, name });\n summary = `Updated project \"${name}\"`;\n break;\n }\n case 'project.delete': {\n data = await deleteProject({ projectId: id });\n summary = `Deleted project ${id ?? 'default'}`;\n break;\n }\n\n // Flows\n case 'flow.list': {\n data = await listFlows({\n projectId: id,\n sort: sort as 'name' | 'updated_at' | 'created_at' | undefined,\n order: order as 'asc' | 'desc' | undefined,\n includeDeleted,\n });\n summary = `${(((data as Record<string, unknown>).flows as unknown[]) ?? []).length} flows`;\n break;\n }\n case 'flow.get': {\n if (!id) throw new Error('id required for flow.get');\n data = await getFlow({ flowId: id, fields });\n summary = `Flow \"${(data as Record<string, unknown>).name}\" (${id})`;\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 });\n summary = `Created flow \"${name}\" (${(data as Record<string, unknown>).id})`;\n break;\n }\n case 'flow.update': {\n if (!id) throw new Error('id required for flow.update');\n data = await updateFlow({\n flowId: id,\n name,\n content,\n mergePatch: patch ?? true,\n });\n summary = `Updated flow ${id}`;\n break;\n }\n case 'flow.delete': {\n if (!id) throw new Error('id required for flow.delete');\n data = await deleteFlow({ flowId: id });\n summary = `Deleted flow ${id}`;\n break;\n }\n case 'flow.duplicate': {\n if (!id) throw new Error('id required for flow.duplicate');\n data = await duplicateFlow({ flowId: id, name });\n summary = `Duplicated flow ${id}`;\n break;\n }\n\n // Deploy\n case 'deploy': {\n if (!id) throw new Error('id (flowId) required for deploy');\n const progressToken = extra._meta?.progressToken;\n data = await deploy({\n flowId: id,\n wait: wait ?? true,\n flowName,\n onStatus: (s: string, sub: string | null) => {\n if (!progressToken) return;\n const stages: Record<string, number> = {\n bundling: 15,\n deploying: 55,\n published: 100,\n active: 100,\n failed: 100,\n };\n extra.sendNotification({\n method: 'notifications/progress',\n params: {\n progressToken,\n progress: stages[s] ?? 0,\n total: 100,\n message: sub ? `${s}:${sub}` : s,\n },\n } as ServerNotification);\n },\n signal: extra.signal,\n });\n const st = (data as Record<string, unknown>).status;\n const deployData = data as Record<string, unknown>;\n if (st === 'failed') {\n const msg = `Deploy failed: ${deployData.errorMessage ?? 'unknown error'}`;\n return mcpResult({ action, ok: false, data }, msg, {\n next: ['Run flow_validate to check your configuration'],\n });\n } else {\n summary = `Deployed flow ${id} — status: ${st}`;\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({ action, ok: true, data }, summary, {\n next: nextHints,\n });\n }\n }\n break;\n }\n\n // Deployments\n case 'deployment.get': {\n if (!id)\n throw new Error(\n 'id (flowId or slug) required for deployment.get',\n );\n try {\n data = await getDeployment({ flowId: id, flowName });\n } catch {\n data = await getDeploymentBySlug({ slug: id });\n }\n summary = `Deployment ${(data as Record<string, unknown>).slug ?? id} — ${(data as Record<string, unknown>).status}`;\n break;\n }\n case 'deployment.list': {\n data = await listDeployments({\n projectId: id,\n type: type as 'web' | 'server' | undefined,\n status,\n });\n summary = `${(((data as Record<string, unknown>).deployments as unknown[]) ?? []).length} deployments`;\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: id });\n summary = `Created ${type} deployment ${(data as Record<string, unknown>).slug}`;\n break;\n }\n case 'deployment.delete': {\n if (!id)\n throw new Error('id (slug) required for deployment.delete');\n data = await deleteDep({ slug: id });\n summary = `Deleted deployment ${id}`;\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 }, summary);\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\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 { PACKAGE_REGISTRY } from '../registry.js';\n\nexport function registerPackageSchemaResources(server: McpServer) {\n const template = new ResourceTemplate('walkeros://schema/{packageName}', {\n list: async () => ({\n resources: PACKAGE_REGISTRY.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 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","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { schemas } from '@walkeros/core/dev';\nimport { PACKAGE_REGISTRY } from '../registry.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 contents: [\n {\n uri: 'walkeros://reference/packages',\n text: JSON.stringify(PACKAGE_REGISTRY, null, 2),\n mimeType: 'application/json',\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 with section=\"hints\" to read the selected package\\'s configuration 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 '',\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 'IMPORTANT — Mapping key structure:',\n 'Mapping uses NESTED entity → action keys, NOT dot-separated strings.',\n 'Event name \"product add\" splits into entity \"product\" and action \"add\".',\n 'Config structure: `{ \"mapping\": { \"product\": { \"add\": { name: \"AddToCart\", data: { ... } } } } }`',\n 'Wildcards: `{ \"*\": { \"view\": Rule } }` matches any entity with action \"view\".',\n '',\n 'Follow these steps:',\n '1. Read the walkeros://reference/mapping resource for full syntax reference.',\n `2. ${stepName ? `Identify the package for \"${stepName}\" in the flow, then u` : 'U'}se package_get with section=\"examples\" to see how events are mapped for this package.`,\n '3. Ask which events I want to map (e.g., \"product view\", \"order complete\").',\n '4. Generate mapping rules using the package examples as templates.',\n '5. Use flow_validate to verify the mapping.',\n '',\n 'Mapping operates at two levels:',\n '- **Source mapping**: normalizes raw input → walkerOS events',\n '- **Destination mapping**: transforms walkerOS events → vendor format',\n '',\n 'Key mapping operators: data (extract), map (object transform), loop (array processing), ',\n 'set (create array), fn ($code function), condition (conditional), consent (consent-gated).',\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 '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,QAAQ,SAAS,CAAC;AAAA,IAC/C,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,IAC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5BA,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,cAAc;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuDhB;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,+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","size","time","summary","mcpResult","mcpError","schemas","mcpResult","mcpError","server","schemas","mcpResult","mcpError","schemas","mcpResult","mcpError","server","schemas","mcpError","mcpResult","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","mcpResult","mcpError","server","z","mcpResult","mcpError","z","loadJsonConfig","mcpResult","mcpError","server","z","mcpResult","mcpError","z","server","z","mcpResult","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/registry.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\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.\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 summary = result.valid\n ? 'Valid'\n : `Invalid: ${result.errors.length} errors, ${result.warnings.length} warnings`;\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, summary, 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', '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.unknown().optional().describe('Transformed payload sent'),\n }),\n )\n .optional()\n .describe('Per-destination results'),\n exampleMatch: z\n .object({\n name: z.string(),\n step: z.string(),\n match: z.boolean(),\n diff: z.string().optional(),\n })\n .optional()\n .describe('Example comparison result when using example parameter'),\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 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 }),\n )\n .describe('Step examples'),\n};\n\n// Package Search output shape (lightweight metadata + content keys)\nexport const PackageSearchOutputShape = {\n package: z.string().describe('Package name'),\n version: z.string().describe('Package version'),\n description: z.string().optional().describe('Package description'),\n type: z\n .string()\n .optional()\n .describe('Package type (destination, source, transformer)'),\n platform: z.string().optional().describe('Target platform (web, server)'),\n hintKeys: z\n .array(z.string())\n .describe('Available hint keys (use package_get section=hints to read)'),\n exampleSummaries: z\n .array(\n z.object({\n name: z.string().describe('Example name'),\n description: z.string().optional().describe('What this example shows'),\n }),\n )\n .describe(\n 'Step example names and descriptions (use package_get section=examples to read full content)',\n ),\n};\n\n// Package Schema output shape (full details, supports progressive disclosure)\nexport const PackageSchemaOutputShape = {\n package: z.string().describe('Package name'),\n version: z.string().describe('Package version'),\n type: z.string().describe('Package type (destination, source, transformer)'),\n platform: z.string().describe('Target platform (web, server)'),\n schemas: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('JSON Schemas for settings and mapping'),\n examples: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\n 'Full configuration examples (included when section=examples or section=all)',\n ),\n exampleSummaries: z\n .array(\n z.object({\n name: z.string().describe('Example name'),\n description: z.string().optional().describe('What this example shows'),\n }),\n )\n .optional()\n .describe(\n 'Example names and descriptions (included in default/summary mode)',\n ),\n hints: z\n .record(\n z.string(),\n z.object({\n text: z.string(),\n code: z\n .array(\n z.object({\n lang: z.string().optional(),\n code: z.string(),\n }),\n )\n .optional(),\n }),\n )\n .optional()\n .describe(\n 'Hints — text only in summary mode, with code blocks when section=hints or section=all',\n ),\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 const r = result as Record<string, unknown>;\n const size = r.totalSize ?? r.size;\n const time = r.buildTime;\n const summary = `Bundled${size ? ` (${formatBytes(size as number)}` : ''}${time ? `, ${time}ms)` : size ? ')' : ''}`;\n return mcpResult({ success: true, ...result }, summary, {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\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 '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 const size = output_.totalSize as number | undefined;\n const time = output_.buildTime as number | undefined;\n const summary = `Bundled${size ? ` (${formatBytes(size)}` : ''}${time ? `, ${time}ms)` : size ? ')' : ''}`;\n\n return mcpResult({ success: true, ...output_ }, summary, {\n next: [\n 'Use flow_simulate to test',\n \"Use api({ action: 'deploy' }) to publish\",\n ],\n });\n } catch (error) {\n return mcpError(error, 'Run flow_validate for detailed error messages');\n }\n },\n );\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return `${(bytes / 1024).toFixed(1)} KB`;\n}\n","import { 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 'Events must be in walkerOS event format (post-source output): { name: \"entity action\", data: {...} }. ' +\n 'Use package_get on your source to check its output shape. ' +\n 'Use the example parameter to load event input from a step example and compare output.',\n inputSchema: schemas.SimulateInputShape,\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, example, step }) => {\n try {\n if (!event && !example) {\n throw new Error('Either event or example must be provided');\n }\n\n const raw: SimulationResult = await simulate(configPath, event, {\n json: true,\n flow,\n platform,\n example,\n step,\n });\n\n // Summarize per-destination\n const destinations: Record<string, DestinationSummary> = {};\n\n if (raw.usage) {\n for (const [name, calls] of Object.entries(raw.usage)) {\n destinations[name] = {\n received: calls.length > 0,\n calls: calls.length,\n payload: calls.length > 0 ? calls[calls.length - 1] : undefined,\n };\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(\n 'No destinations found in flow configuration. Check that your flow defines at least one destination.',\n );\n }\n if (destCount > 0 && receivedCount === 0) {\n warnings.push(\n 'No destinations received the event. Check: mapping keys use nested entity→action structure (not dot-separated), event name matches, consent is granted. Use package_get on the destination for mapping examples.',\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 exampleMatch: raw.exampleMatch,\n duration: raw.duration,\n };\n\n return mcpResult(result, summary, {\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 { 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: schemas.PushInputShape,\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 const summary = `Pushed event${result.duration ? ` (${result.duration}ms)` : ''}`;\n\n return mcpResult(result, summary);\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('Path to flow configuration file'),\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 in?: unknown;\n out?: unknown;\n mapping?: 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 ...(full\n ? { in: ex.in, out: ex.out, mapping: ex.mapping }\n : {}),\n });\n }\n }\n }\n\n // Count unique steps\n const stepSet = new Set(examples.map((e) => e.step));\n\n const result = {\n flow: flowName,\n count: examples.length,\n examples,\n };\n\n const totalExamples = examples.length;\n const summary = `${totalExamples} examples across ${stepSet.size} steps`;\n const hints: { next: string[]; warnings?: string[] } = {\n next: ['Use flow_simulate with example parameter to test'],\n };\n if (totalExamples === 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, summary, 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 { fetchPackage, mcpResult, mcpError } from '@walkeros/core';\nimport { PackageSchemaOutputShape } from '../schemas/output.js';\nimport { filterRegistry } from '../registry.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 = filterRegistry({ type, platform });\n const result = { catalog, count: catalog.length };\n const summary = `${catalog.length} packages found`;\n return mcpResult(result, summary, {\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: info.platform,\n hintKeys: info.hintKeys,\n exampleSummaries: info.exampleSummaries,\n };\n\n const summary = `${info.packageName} v${info.version}`;\n return mcpResult(result, summary, {\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 outputSchema: PackageSchemaOutputShape,\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 const result: Record<string, unknown> = {\n package: info.packageName,\n version: info.version,\n type: info.type,\n platform: info.platform,\n schemas: info.schemas,\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 const schemaCount = Object.keys(info.schemas).length;\n const exampleCount = info.exampleSummaries.length;\n const summary = `${info.packageName} — ${schemaCount} schemas, ${exampleCount} examples`;\n\n return mcpResult(result, summary);\n } catch (error) {\n return mcpError(\n error,\n 'Use package_search to browse available package names.',\n );\n }\n },\n );\n}\n","export interface PackageRegistryEntry {\n name: string;\n type: 'source' | 'destination' | 'transformer' | 'store';\n platform: 'web' | 'server' | 'universal';\n description: string;\n}\n\nexport const PACKAGE_REGISTRY: PackageRegistryEntry[] = [\n // Web Destinations\n {\n name: '@walkeros/web-destination-gtag',\n type: 'destination',\n platform: 'web',\n description: 'Google destination (GA4, Ads, GTM via gtag.js)',\n },\n {\n name: '@walkeros/web-destination-meta',\n type: 'destination',\n platform: 'web',\n description: 'Meta (Facebook) Pixel',\n },\n {\n name: '@walkeros/web-destination-plausible',\n type: 'destination',\n platform: 'web',\n description: 'Plausible Analytics',\n },\n {\n name: '@walkeros/web-destination-snowplow',\n type: 'destination',\n platform: 'web',\n description: 'Snowplow Analytics',\n },\n {\n name: '@walkeros/web-destination-piwikpro',\n type: 'destination',\n platform: 'web',\n description: 'Piwik PRO Analytics',\n },\n {\n name: '@walkeros/web-destination-api',\n type: 'destination',\n platform: 'web',\n description: 'Generic HTTP API destination',\n },\n\n // Server Destinations\n {\n name: '@walkeros/server-destination-gcp',\n type: 'destination',\n platform: 'server',\n description: 'Google Cloud Platform (BigQuery)',\n },\n {\n name: '@walkeros/server-destination-aws',\n type: 'destination',\n platform: 'server',\n description: 'AWS (Firehose)',\n },\n {\n name: '@walkeros/server-destination-meta',\n type: 'destination',\n platform: 'server',\n description: 'Meta Conversions API (server-side)',\n },\n {\n name: '@walkeros/server-destination-api',\n type: 'destination',\n platform: 'server',\n description: 'Generic HTTP API destination (server)',\n },\n {\n name: '@walkeros/server-destination-datamanager',\n type: 'destination',\n platform: 'server',\n description: 'Google Data Manager',\n },\n\n // Web Sources\n {\n name: '@walkeros/web-source-browser',\n type: 'source',\n platform: 'web',\n description: 'Browser DOM event capture (clicks, page views, forms)',\n },\n {\n name: '@walkeros/web-source-datalayer',\n type: 'source',\n platform: 'web',\n description: 'Google Tag Manager dataLayer bridge',\n },\n {\n name: '@walkeros/web-source-session',\n type: 'source',\n platform: 'web',\n description: 'Session tracking source',\n },\n\n // CMP Sources\n {\n name: '@walkeros/web-source-cmp-cookiefirst',\n type: 'source',\n platform: 'web',\n description: 'CookieFirst consent management',\n },\n {\n name: '@walkeros/web-source-cmp-cookiepro',\n type: 'source',\n platform: 'web',\n description: 'CookiePro/OneTrust consent management',\n },\n {\n name: '@walkeros/web-source-cmp-usercentrics',\n type: 'source',\n platform: 'web',\n description: 'Usercentrics consent management',\n },\n\n // Server Sources\n {\n name: '@walkeros/server-source-express',\n type: 'source',\n platform: 'server',\n description: 'Express.js HTTP event endpoint',\n },\n {\n name: '@walkeros/server-source-fetch',\n type: 'source',\n platform: 'server',\n description: 'Web Fetch API source (Cloudflare, Vercel Edge, Deno, Bun)',\n },\n {\n name: '@walkeros/server-source-aws',\n type: 'source',\n platform: 'server',\n description: 'AWS sources (Lambda, API Gateway, Function URLs)',\n },\n {\n name: '@walkeros/server-source-gcp',\n type: 'source',\n platform: 'server',\n description: 'GCP sources (Cloud Functions)',\n },\n\n // Transformers\n {\n name: '@walkeros/transformer-router',\n type: 'transformer',\n platform: 'universal',\n description: 'Route events to different destination subsets',\n },\n {\n name: '@walkeros/transformer-validator',\n type: 'transformer',\n platform: 'universal',\n description: 'Event validation using JSON Schema',\n },\n {\n name: '@walkeros/server-transformer-fingerprint',\n type: 'transformer',\n platform: 'server',\n description: 'Device fingerprinting for anonymous user identification',\n },\n {\n name: '@walkeros/server-transformer-cache',\n type: 'transformer',\n platform: 'server',\n description: 'HTTP response caching with LRU eviction',\n },\n {\n name: '@walkeros/server-transformer-file',\n type: 'transformer',\n platform: 'server',\n description: 'File serving transformer for static files',\n },\n\n // Stores\n {\n name: '@walkeros/store-memory',\n type: 'store',\n platform: 'universal',\n description: 'In-memory key-value store with LRU eviction and TTL',\n },\n {\n name: '@walkeros/server-store-fs',\n type: 'store',\n platform: 'server',\n description: 'File system key-value store',\n },\n {\n name: '@walkeros/server-store-s3',\n type: 'store',\n platform: 'server',\n description: 'AWS S3 key-value store',\n },\n {\n name: '@walkeros/server-store-gcs',\n type: 'store',\n platform: 'server',\n description: 'Google Cloud Storage key-value store',\n },\n];\n\nexport function filterRegistry(filters?: {\n type?: string;\n platform?: string;\n}): PackageRegistryEntry[] {\n let results = PACKAGE_REGISTRY;\n if (filters?.type) {\n results = results.filter((p) => p.type === filters.type);\n }\n if (filters?.platform) {\n results = results.filter(\n (p) => p.platform === filters.platform || p.platform === 'universal',\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 '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(\n config,\n `Loaded flow from ${source}. Use flow_validate to check, or add-step prompt to modify.`,\n {\n next: [\n 'Use flow_validate to check',\n 'Use add-step prompt to modify',\n ],\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(\n skeleton,\n `Created empty ${platform} flow. Use the add-step prompt to add sources, destinations, and transformers.`,\n {\n next: [\n 'Read walkeros://reference/flow-schema for config structure',\n 'Use add-step prompt to add sources and destinations',\n ],\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\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 'Before sending feedback, ask the user: \"Would you like to include your user and project info with feedback? This is a one-time choice.\" Then call feedback again with the anonymous parameter set.',\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 });\n\n return mcpResult({ ok: true }, 'Feedback sent. Thanks!');\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. id = flowId/projectId/slug depending on context. ' +\n 'content = Flow.Config JSON for flow.create/update.',\n inputSchema: {\n action: z.enum(ACTIONS).describe('API action to perform'),\n id: z\n .string()\n .optional()\n .describe('Resource ID (flowId, projectId, or deployment slug)'),\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 id,\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 let summary: string;\n\n switch (action) {\n // Auth\n case 'whoami': {\n data = await whoami();\n summary = `Authenticated as ${(data as Record<string, unknown>).email}`;\n break;\n }\n\n // Projects\n case 'project.list': {\n data = await listProjects();\n summary = `${(((data as Record<string, unknown>).projects as unknown[]) ?? []).length} projects`;\n break;\n }\n case 'project.get': {\n data = await getProject({ projectId: id });\n summary = `Project \"${(data as Record<string, unknown>).name}\"`;\n break;\n }\n case 'project.create': {\n if (!name) throw new Error('name required for project.create');\n data = await createProject({ name });\n summary = `Created project \"${name}\"`;\n break;\n }\n case 'project.update': {\n if (!name) throw new Error('name required for project.update');\n data = await updateProject({ projectId: id, name });\n summary = `Updated project \"${name}\"`;\n break;\n }\n case 'project.delete': {\n data = await deleteProject({ projectId: id });\n summary = `Deleted project ${id ?? 'default'}`;\n break;\n }\n\n // Flows\n case 'flow.list': {\n data = await listFlows({\n projectId: id,\n sort: sort as 'name' | 'updated_at' | 'created_at' | undefined,\n order: order as 'asc' | 'desc' | undefined,\n includeDeleted,\n });\n summary = `${(((data as Record<string, unknown>).flows as unknown[]) ?? []).length} flows`;\n break;\n }\n case 'flow.get': {\n if (!id) throw new Error('id required for flow.get');\n data = await getFlow({ flowId: id, fields });\n summary = `Flow \"${(data as Record<string, unknown>).name}\" (${id})`;\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 });\n summary = `Created flow \"${name}\" (${(data as Record<string, unknown>).id})`;\n break;\n }\n case 'flow.update': {\n if (!id) throw new Error('id required for flow.update');\n data = await updateFlow({\n flowId: id,\n name,\n content,\n mergePatch: patch ?? true,\n });\n summary = `Updated flow ${id}`;\n break;\n }\n case 'flow.delete': {\n if (!id) throw new Error('id required for flow.delete');\n data = await deleteFlow({ flowId: id });\n summary = `Deleted flow ${id}`;\n break;\n }\n case 'flow.duplicate': {\n if (!id) throw new Error('id required for flow.duplicate');\n data = await duplicateFlow({ flowId: id, name });\n summary = `Duplicated flow ${id}`;\n break;\n }\n\n // Deploy\n case 'deploy': {\n if (!id) throw new Error('id (flowId) required for deploy');\n const progressToken = extra._meta?.progressToken;\n data = await deploy({\n flowId: id,\n wait: wait ?? true,\n flowName,\n onStatus: (s: string, sub: string | null) => {\n if (!progressToken) return;\n const stages: Record<string, number> = {\n bundling: 15,\n deploying: 55,\n published: 100,\n active: 100,\n failed: 100,\n };\n extra.sendNotification({\n method: 'notifications/progress',\n params: {\n progressToken,\n progress: stages[s] ?? 0,\n total: 100,\n message: sub ? `${s}:${sub}` : s,\n },\n } as ServerNotification);\n },\n signal: extra.signal,\n });\n const st = (data as Record<string, unknown>).status;\n const deployData = data as Record<string, unknown>;\n if (st === 'failed') {\n const msg = `Deploy failed: ${deployData.errorMessage ?? 'unknown error'}`;\n return mcpResult({ action, ok: false, data }, msg, {\n next: ['Run flow_validate to check your configuration'],\n });\n } else {\n summary = `Deployed flow ${id} — status: ${st}`;\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({ action, ok: true, data }, summary, {\n next: nextHints,\n });\n }\n }\n break;\n }\n\n // Deployments\n case 'deployment.get': {\n if (!id)\n throw new Error(\n 'id (flowId or slug) required for deployment.get',\n );\n try {\n data = await getDeployment({ flowId: id, flowName });\n } catch {\n data = await getDeploymentBySlug({ slug: id });\n }\n summary = `Deployment ${(data as Record<string, unknown>).slug ?? id} — ${(data as Record<string, unknown>).status}`;\n break;\n }\n case 'deployment.list': {\n data = await listDeployments({\n projectId: id,\n type: type as 'web' | 'server' | undefined,\n status,\n });\n summary = `${(((data as Record<string, unknown>).deployments as unknown[]) ?? []).length} deployments`;\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: id });\n summary = `Created ${type} deployment ${(data as Record<string, unknown>).slug}`;\n break;\n }\n case 'deployment.delete': {\n if (!id)\n throw new Error('id (slug) required for deployment.delete');\n data = await deleteDep({ slug: id });\n summary = `Deleted deployment ${id}`;\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 }, summary);\n } catch (error) {\n const msg = error instanceof Error ? error.message : '';\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 { PACKAGE_REGISTRY } from '../registry.js';\n\nexport function registerPackageSchemaResources(server: McpServer) {\n const template = new ResourceTemplate('walkeros://schema/{packageName}', {\n list: async () => ({\n resources: PACKAGE_REGISTRY.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 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 { PACKAGE_REGISTRY } from '../registry.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 contents: [\n {\n uri: 'walkeros://reference/packages',\n text: JSON.stringify(PACKAGE_REGISTRY, null, 2),\n mimeType: 'application/json',\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 with section=\"hints\" to read the selected package\\'s configuration 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,QAAQ,SAAS,CAAC;AAAA,IAC/C,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,EAA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B,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","size","time","summary","mcpResult","mcpError","schemas","mcpResult","mcpError","server","schemas","mcpResult","mcpError","schemas","mcpResult","mcpError","server","schemas","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","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.0.
|
|
3
|
+
"version": "3.0.2",
|
|
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,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
34
|
-
"@walkeros/cli": "^3.0.
|
|
35
|
-
"@walkeros/core": "^3.0.
|
|
34
|
+
"@walkeros/cli": "^3.0.2",
|
|
35
|
+
"@walkeros/core": "^3.0.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"zod": "^4.0"
|