@secondlayer/mcp 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ Add to your Claude Desktop or Cursor config:
19
19
  "command": "npx",
20
20
  "args": ["@secondlayer/mcp"],
21
21
  "env": {
22
- "SECONDLAYER_API_KEY": "sl_live_..."
22
+ "SL_SERVICE_KEY": "sl_live_..."
23
23
  }
24
24
  }
25
25
  }
@@ -29,7 +29,7 @@ Add to your Claude Desktop or Cursor config:
29
29
  ## Quick Start — HTTP (Remote)
30
30
 
31
31
  ```bash
32
- export SECONDLAYER_API_KEY=sl_live_...
32
+ export SL_SERVICE_KEY=sl_live_...
33
33
  export SECONDLAYER_MCP_SECRET=your-secret
34
34
  npx @secondlayer/mcp-http
35
35
  # Listening on port 3100
@@ -39,7 +39,7 @@ npx @secondlayer/mcp-http
39
39
 
40
40
  | Variable | Required | Default | Description |
41
41
  | --- | --- | --- | --- |
42
- | `SECONDLAYER_API_KEY` | Yes | — | API key |
42
+ | `SL_SERVICE_KEY` | Yes | — | Tenant service key. `SECONDLAYER_API_KEY` is still accepted as a deprecated alias. |
43
43
  | `SECONDLAYER_MCP_PORT` | No | `3100` | HTTP transport port |
44
44
  | `SECONDLAYER_MCP_SECRET` | No | — | Bearer token for HTTP auth. Disabled if unset. |
45
45
 
package/dist/bin-http.js CHANGED
@@ -91,11 +91,26 @@ function registerResources(server) {
91
91
  // src/lib/client.ts
92
92
  import { SecondLayer } from "@secondlayer/sdk";
93
93
  var instance = null;
94
+ var legacyEnvWarned = false;
95
+ function readServiceKey() {
96
+ const canonical = process.env.SL_SERVICE_KEY;
97
+ if (canonical)
98
+ return canonical;
99
+ const legacy = process.env.SECONDLAYER_API_KEY;
100
+ if (legacy) {
101
+ if (!legacyEnvWarned) {
102
+ legacyEnvWarned = true;
103
+ console.error("[mcp] SECONDLAYER_API_KEY is deprecated — use SL_SERVICE_KEY going forward.");
104
+ }
105
+ return legacy;
106
+ }
107
+ return;
108
+ }
94
109
  function getClient() {
95
110
  if (!instance) {
96
- const apiKey = process.env.SECONDLAYER_API_KEY;
111
+ const apiKey = readServiceKey();
97
112
  if (!apiKey) {
98
- throw new Error("SECONDLAYER_API_KEY environment variable is required. " + "Get your key at https://app.secondlayer.tools/settings/api-keys");
113
+ throw new Error("SL_SERVICE_KEY environment variable is required. " + "Get your key from `sl instance info` or the dashboard.");
99
114
  }
100
115
  const baseUrl = process.env.SECONDLAYER_API_URL;
101
116
  instance = new SecondLayer({
@@ -107,9 +122,9 @@ function getClient() {
107
122
  return instance;
108
123
  }
109
124
  async function apiRequest(method, path, body) {
110
- const apiKey = process.env.SECONDLAYER_API_KEY;
125
+ const apiKey = readServiceKey();
111
126
  if (!apiKey)
112
- throw new Error("SECONDLAYER_API_KEY required");
127
+ throw new Error("SL_SERVICE_KEY required");
113
128
  const baseUrl = process.env.SECONDLAYER_API_URL || "https://api.secondlayer.tools";
114
129
  const res = await fetch(`${baseUrl}${path}`, {
115
130
  method,
@@ -337,6 +352,292 @@ function registerSubgraphTools(server) {
337
352
  });
338
353
  }
339
354
 
355
+ // src/tools/workflows.ts
356
+ import { bundleWorkflowCode } from "@secondlayer/bundler";
357
+ import {
358
+ generateWorkflowCode
359
+ } from "@secondlayer/scaffold";
360
+ import { VersionConflictError } from "@secondlayer/sdk";
361
+ import { createPatch } from "diff";
362
+ import { z as z3 } from "zod/v4";
363
+ function registerWorkflowTools(server) {
364
+ defineTool(server, "workflows_list", "List all workflows. Returns summary fields only.", {}, async () => {
365
+ const { workflows } = await getClient().workflows.list();
366
+ return {
367
+ content: [
368
+ {
369
+ type: "text",
370
+ text: JSON.stringify(workflows, null, 2)
371
+ }
372
+ ]
373
+ };
374
+ });
375
+ defineTool(server, "workflows_get", "Get full details of a workflow by name.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
376
+ const detail = await getClient().workflows.get(name);
377
+ return {
378
+ content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
379
+ };
380
+ });
381
+ defineTool(server, "workflows_get_definition", "Return the deployed TypeScript source of a workflow plus its stored version. Returns `sourceCode: null` + `readOnly: true` for workflows deployed before source capture.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
382
+ const source = await getClient().workflows.getSource(name);
383
+ return {
384
+ content: [{ type: "text", text: JSON.stringify(source, null, 2) }]
385
+ };
386
+ });
387
+ defineTool(server, "workflows_propose_edit", "Validate a proposed edit WITHOUT deploying. Fetches the current stored source, bundles the proposed source, computes a unified diff, and returns everything for review. Use this when you want to show the user a diff before committing — pair it with workflows_deploy(expectedVersion=...) to persist.", {
388
+ name: z3.string().describe("Workflow name"),
389
+ proposedCode: z3.string().describe("New TypeScript source — must compile and validate."),
390
+ expectedVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Version the proposer is editing from (for audit).")
391
+ }, async ({ name, proposedCode, expectedVersion }) => {
392
+ const current = await getClient().workflows.getSource(name);
393
+ if (current.sourceCode === null) {
394
+ return {
395
+ isError: true,
396
+ content: [
397
+ {
398
+ type: "text",
399
+ text: JSON.stringify({
400
+ error: "Workflow has no stored source. Redeploy via CLI first.",
401
+ readOnly: true,
402
+ version: current.version
403
+ }, null, 2)
404
+ }
405
+ ]
406
+ };
407
+ }
408
+ let bundleValid = false;
409
+ let validation;
410
+ let bundleSize = 0;
411
+ try {
412
+ const bundled = await bundleWorkflowCode(proposedCode);
413
+ bundleValid = true;
414
+ bundleSize = Buffer.byteLength(bundled.handlerCode, "utf8");
415
+ validation = {
416
+ name: bundled.name,
417
+ triggerType: bundled.trigger.type
418
+ };
419
+ } catch (err) {
420
+ validation = {
421
+ error: err instanceof Error ? err.message : String(err)
422
+ };
423
+ }
424
+ const diffText = createPatch(`${name}.ts`, current.sourceCode, proposedCode, `v${current.version}`, "proposed");
425
+ return {
426
+ content: [
427
+ {
428
+ type: "text",
429
+ text: JSON.stringify({
430
+ currentVersion: current.version,
431
+ expectedVersion,
432
+ currentSource: current.sourceCode,
433
+ proposedSource: proposedCode,
434
+ diffText,
435
+ bundleValid,
436
+ validation,
437
+ bundleSize
438
+ }, null, 2)
439
+ }
440
+ ]
441
+ };
442
+ });
443
+ defineTool(server, "workflows_tail_run", "Tail a workflow run via SSE and return a compacted log. Resolves as soon as the run completes, `limit` events are collected, or `timeoutMs` elapses (default 60s). MCP is not streaming-first — use this for short-lived follow-ups, not long tails.", {
444
+ name: z3.string().describe("Workflow name"),
445
+ runId: z3.string().describe("Run id"),
446
+ limit: z3.number().int().positive().max(200).optional().describe("Max step events to collect (default 50)"),
447
+ timeoutMs: z3.number().int().positive().max(5 * 60 * 1000).optional().describe("Hard timeout in ms (default 60000, max 300000)")
448
+ }, async ({ name, runId, limit, timeoutMs }) => {
449
+ const cap = limit ?? 50;
450
+ const deadline = timeoutMs ?? 60000;
451
+ const events = [];
452
+ let finalStatus = null;
453
+ let stoppedBy = "timeout";
454
+ const controller = new AbortController;
455
+ const timer = setTimeout(() => {
456
+ stoppedBy = "timeout";
457
+ controller.abort();
458
+ }, deadline);
459
+ try {
460
+ await getClient().workflows.streamRun(name, runId, (event) => {
461
+ if (event.type === "step") {
462
+ events.push(event.step);
463
+ if (events.length >= cap) {
464
+ stoppedBy = "limit";
465
+ controller.abort();
466
+ }
467
+ } else if (event.type === "done") {
468
+ finalStatus = event.done.status;
469
+ stoppedBy = "done";
470
+ }
471
+ }, controller.signal);
472
+ } catch (err) {
473
+ if (!(err instanceof Error) || err.name !== "AbortError") {
474
+ throw err;
475
+ }
476
+ } finally {
477
+ clearTimeout(timer);
478
+ }
479
+ return {
480
+ content: [
481
+ {
482
+ type: "text",
483
+ text: JSON.stringify({
484
+ runId,
485
+ finalStatus,
486
+ stoppedBy,
487
+ eventCount: events.length,
488
+ events
489
+ }, null, 2)
490
+ }
491
+ ]
492
+ };
493
+ });
494
+ defineTool(server, "workflows_pause_all", "Pause ALL active workflows for the authenticated account. Irreversible only by calling pause/resume per workflow. Returns the list of affected workflows.", {}, async () => {
495
+ const result = await getClient().workflows.pauseAll();
496
+ return {
497
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
498
+ };
499
+ });
500
+ defineTool(server, "workflows_cancel_run", "Cancel an in-flight workflow run. Marks the run as cancelled and removes any pending queue entry. No-ops if the run is already terminal.", { runId: z3.string().describe("Run id to cancel") }, async ({ runId }) => {
501
+ const result = await getClient().workflows.cancelRun(runId);
502
+ return {
503
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
504
+ };
505
+ });
506
+ defineTool(server, "workflows_rollback", "Roll a workflow back to a prior version. The restored handler is re-published as a NEW version (audit trail), so no history is lost. Pass toVersion to pick a specific bundle; omit to roll back to the immediate previous version on disk. Last 3 versions are retained.", {
507
+ name: z3.string().describe("Workflow name"),
508
+ toVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Target version to restore. Must be one of the retained bundles on disk.")
509
+ }, async ({ name, toVersion }) => {
510
+ const result = await getClient().workflows.rollback(name, toVersion);
511
+ return {
512
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
513
+ };
514
+ });
515
+ defineTool(server, "workflows_delete", "Delete a workflow permanently.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
516
+ await getClient().workflows.delete(name);
517
+ return {
518
+ content: [{ type: "text", text: `Deleted workflow "${name}"` }]
519
+ };
520
+ });
521
+ defineTool(server, "workflows_trigger", "Trigger a workflow run. Optionally pass input as a JSON string.", {
522
+ name: z3.string().describe("Workflow name"),
523
+ input: z3.string().optional().describe("Input as JSON string")
524
+ }, async ({ name, input }) => {
525
+ const parsed = input ? JSON.parse(input) : undefined;
526
+ const result = await getClient().workflows.trigger(name, parsed);
527
+ return {
528
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
529
+ };
530
+ });
531
+ defineTool(server, "workflows_pause", "Pause a running workflow.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
532
+ await getClient().workflows.pause(name);
533
+ return {
534
+ content: [{ type: "text", text: `Paused workflow "${name}"` }]
535
+ };
536
+ });
537
+ defineTool(server, "workflows_resume", "Resume a paused workflow.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
538
+ await getClient().workflows.resume(name);
539
+ return {
540
+ content: [{ type: "text", text: `Resumed workflow "${name}"` }]
541
+ };
542
+ });
543
+ defineTool(server, "workflows_scaffold", "Generate a compilable defineWorkflow() skeleton from a typed intent. Returns the TypeScript source; pass it to workflows_deploy to persist. Placeholders inside the source must be filled in before running a real workflow.", {
544
+ name: z3.string().regex(/^[a-z][a-z0-9-]*$/).describe("Workflow name (lowercase, hyphens)"),
545
+ trigger: z3.discriminatedUnion("type", [
546
+ z3.object({
547
+ type: z3.literal("event"),
548
+ filterType: z3.string().optional()
549
+ }),
550
+ z3.object({
551
+ type: z3.literal("schedule"),
552
+ cron: z3.string().min(1),
553
+ timezone: z3.string().optional()
554
+ }),
555
+ z3.object({ type: z3.literal("manual") })
556
+ ]).describe("Trigger shape"),
557
+ steps: z3.array(z3.enum(["run", "query", "ai", "deliver"])).describe("Ordered list of step kinds to include in the handler"),
558
+ deliveryTarget: z3.enum(["webhook", "slack", "email", "discord", "telegram"]).optional().describe("Delivery target used when steps includes `deliver`")
559
+ }, async ({ name, trigger, steps, deliveryTarget }) => {
560
+ const code = generateWorkflowCode({
561
+ name,
562
+ trigger,
563
+ steps,
564
+ deliveryTarget
565
+ });
566
+ return { content: [{ type: "text", text: code }] };
567
+ });
568
+ defineTool(server, "workflows_deploy", "Deploy a workflow from TypeScript source. Pass the full defineWorkflow() source — it will be bundled, validated, and deployed. Use expectedVersion for optimistic concurrency, or dryRun to validate without persisting.", {
569
+ code: z3.string().describe("TypeScript source code containing a defineWorkflow() call"),
570
+ expectedVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Stored version the client expects (major.minor.patch). Server returns 409 on mismatch."),
571
+ dryRun: z3.boolean().optional().describe("If true, validate and bundle only — do not persist.")
572
+ }, async ({ code, expectedVersion, dryRun }) => {
573
+ let bundled;
574
+ try {
575
+ bundled = await bundleWorkflowCode(code);
576
+ } catch (err) {
577
+ return {
578
+ isError: true,
579
+ content: [
580
+ {
581
+ type: "text",
582
+ text: err instanceof Error ? err.message : String(err)
583
+ }
584
+ ]
585
+ };
586
+ }
587
+ const base = {
588
+ name: bundled.name,
589
+ trigger: bundled.trigger,
590
+ handlerCode: bundled.handlerCode,
591
+ sourceCode: bundled.sourceCode,
592
+ retries: bundled.retries,
593
+ timeout: bundled.timeout,
594
+ expectedVersion
595
+ };
596
+ try {
597
+ const result = dryRun ? await getClient().workflows.deploy({ ...base, dryRun: true }) : await getClient().workflows.deploy(base);
598
+ return {
599
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
600
+ };
601
+ } catch (err) {
602
+ if (err instanceof VersionConflictError) {
603
+ return {
604
+ isError: true,
605
+ content: [
606
+ {
607
+ type: "text",
608
+ text: JSON.stringify({
609
+ error: err.message,
610
+ code: "VERSION_CONFLICT",
611
+ currentVersion: err.currentVersion,
612
+ expectedVersion: err.expectedVersion
613
+ }, null, 2)
614
+ }
615
+ ]
616
+ };
617
+ }
618
+ throw err;
619
+ }
620
+ });
621
+ defineTool(server, "workflows_runs", "List runs for a workflow. Optionally filter by status and limit results.", {
622
+ name: z3.string().describe("Workflow name"),
623
+ status: z3.enum(["running", "completed", "failed", "cancelled"]).optional().describe("Filter by run status"),
624
+ limit: z3.number().optional().describe("Max runs to return (default 20)")
625
+ }, async ({ name, status, limit }) => {
626
+ const { runs } = await getClient().workflows.listRuns(name, {
627
+ status,
628
+ limit
629
+ });
630
+ return {
631
+ content: [
632
+ {
633
+ type: "text",
634
+ text: JSON.stringify(runs, null, 2)
635
+ }
636
+ ]
637
+ };
638
+ });
639
+ }
640
+
340
641
  // src/server.ts
341
642
  var __dirname2 = dirname(fileURLToPath(import.meta.url));
342
643
  var pkg = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
@@ -347,6 +648,7 @@ function createServer() {
347
648
  });
348
649
  registerScaffoldTools(server);
349
650
  registerSubgraphTools(server);
651
+ registerWorkflowTools(server);
350
652
  registerAccountTools(server);
351
653
  registerResources(server);
352
654
  return server;
@@ -438,5 +740,5 @@ httpServer.listen(port, () => {
438
740
  console.error("Warning: SECONDLAYER_MCP_SECRET not set, authentication disabled");
439
741
  });
440
742
 
441
- //# debugId=DFBEBA63DCCFB17E64756E2164756E21
743
+ //# debugId=AFBB40D279D464E664756E2164756E21
442
744
  //# sourceMappingURL=bin-http.js.map
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/bin-http.ts", "../src/server.ts", "../src/resources.ts", "../src/lib/client.ts", "../src/lib/format.ts", "../src/lib/tool.ts", "../src/tools/account.ts", "../src/tools/scaffold.ts", "../src/tools/subgraphs.ts"],
3
+ "sources": ["../src/bin-http.ts", "../src/server.ts", "../src/resources.ts", "../src/lib/client.ts", "../src/lib/format.ts", "../src/lib/tool.ts", "../src/tools/account.ts", "../src/tools/scaffold.ts", "../src/tools/subgraphs.ts", "../src/tools/workflows.ts"],
4
4
  "sourcesContent": [
5
5
  "#!/usr/bin/env node\nimport {\n\ttype IncomingMessage,\n\ttype ServerResponse,\n\tcreateServer as createHttpServer,\n} from \"node:http\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { createServer } from \"./server.ts\";\n\nconst port = Number.parseInt(process.env.SECONDLAYER_MCP_PORT || \"3100\");\nconst secret = process.env.SECONDLAYER_MCP_SECRET;\nconst sessions = new Map<string, StreamableHTTPServerTransport>();\n\nfunction authenticate(req: IncomingMessage): boolean {\n\tif (!secret) return true;\n\treturn req.headers.authorization === `Bearer ${secret}`;\n}\n\nconst httpServer = createHttpServer(\n\tasync (req: IncomingMessage, res: ServerResponse) => {\n\t\t// Only handle /mcp endpoint\n\t\tconst url = new URL(req.url ?? \"/\", `http://localhost:${port}`);\n\t\tif (url.pathname !== \"/mcp\") {\n\t\t\tres.writeHead(404).end(JSON.stringify({ error: \"Not found\" }));\n\t\t\treturn;\n\t\t}\n\n\t\t// Auth check\n\t\tif (!authenticate(req)) {\n\t\t\tres.writeHead(401).end(JSON.stringify({ error: \"Unauthorized\" }));\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = req.headers[\"mcp-session-id\"] as string | undefined;\n\n\t\tif (req.method === \"POST\") {\n\t\t\t// Read body with 1MB limit\n\t\t\tconst MAX_BODY = 1_048_576;\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tlet totalSize = 0;\n\t\t\tfor await (const chunk of req) {\n\t\t\t\ttotalSize += (chunk as Buffer).length;\n\t\t\t\tif (totalSize > MAX_BODY) {\n\t\t\t\t\tres\n\t\t\t\t\t\t.writeHead(413)\n\t\t\t\t\t\t.end(JSON.stringify({ error: \"Request body too large\" }));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tchunks.push(chunk as Buffer);\n\t\t\t}\n\t\t\tlet body: any;\n\t\t\ttry {\n\t\t\t\tbody = JSON.parse(Buffer.concat(chunks).toString());\n\t\t\t} catch {\n\t\t\t\tres.writeHead(400).end(JSON.stringify({ error: \"Invalid JSON\" }));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check if this is an initialize request (new session)\n\t\t\tconst isInitialize = Array.isArray(body)\n\t\t\t\t? body.some((m: { method?: string }) => m.method === \"initialize\")\n\t\t\t\t: body.method === \"initialize\";\n\n\t\t\tif (isInitialize) {\n\t\t\t\t// Create new session\n\t\t\t\tconst transport = new StreamableHTTPServerTransport({\n\t\t\t\t\tsessionIdGenerator: () => crypto.randomUUID(),\n\t\t\t\t});\n\t\t\t\tconst server = createServer();\n\t\t\t\tawait server.connect(transport);\n\n\t\t\t\t// Store session after handling (sessionId is set after first request)\n\t\t\t\tawait transport.handleRequest(req, res, body);\n\n\t\t\t\tif (transport.sessionId) {\n\t\t\t\t\tsessions.set(transport.sessionId, transport);\n\t\t\t\t\ttransport.onclose = () => {\n\t\t\t\t\t\tif (transport.sessionId) sessions.delete(transport.sessionId);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Existing session\n\t\t\tif (!sessionId || !sessions.has(sessionId)) {\n\t\t\t\tres\n\t\t\t\t\t.writeHead(400)\n\t\t\t\t\t.end(JSON.stringify({ error: \"Invalid or missing session ID\" }));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait sessions.get(sessionId)!.handleRequest(req, res, body);\n\t\t} else if (req.method === \"GET\") {\n\t\t\t// SSE stream for existing session\n\t\t\tif (!sessionId || !sessions.has(sessionId)) {\n\t\t\t\tres\n\t\t\t\t\t.writeHead(400)\n\t\t\t\t\t.end(JSON.stringify({ error: \"Invalid or missing session ID\" }));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait sessions.get(sessionId)!.handleRequest(req, res);\n\t\t} else if (req.method === \"DELETE\") {\n\t\t\t// Session teardown\n\t\t\tif (sessionId && sessions.has(sessionId)) {\n\t\t\t\tconst transport = sessions.get(sessionId)!;\n\t\t\t\tawait transport.handleRequest(req, res);\n\t\t\t\tawait transport.close();\n\t\t\t\tsessions.delete(sessionId);\n\t\t\t} else {\n\t\t\t\tres\n\t\t\t\t\t.writeHead(400)\n\t\t\t\t\t.end(JSON.stringify({ error: \"Invalid or missing session ID\" }));\n\t\t\t}\n\t\t} else {\n\t\t\tres.writeHead(405).end(JSON.stringify({ error: \"Method not allowed\" }));\n\t\t}\n\t},\n);\n\nhttpServer.listen(port, () => {\n\tconsole.error(`SecondLayer MCP HTTP server listening on port ${port}`);\n\tif (!secret)\n\t\tconsole.error(\n\t\t\t\"Warning: SECONDLAYER_MCP_SECRET not set, authentication disabled\",\n\t\t);\n});\n",
6
- "import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { registerResources } from \"./resources.ts\";\nimport { registerAccountTools } from \"./tools/account.ts\";\nimport { registerScaffoldTools } from \"./tools/scaffold.ts\";\nimport { registerSubgraphTools } from \"./tools/subgraphs.ts\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(\n\treadFileSync(join(__dirname, \"../package.json\"), \"utf-8\"),\n);\n\nexport function createServer(): McpServer {\n\tconst server = new McpServer({\n\t\tname: \"secondlayer\",\n\t\tversion: pkg.version,\n\t});\n\n\tregisterScaffoldTools(server);\n\tregisterSubgraphTools(server);\n\tregisterAccountTools(server);\n\tregisterResources(server);\n\n\treturn server;\n}\n",
6
+ "import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { registerResources } from \"./resources.ts\";\nimport { registerAccountTools } from \"./tools/account.ts\";\nimport { registerScaffoldTools } from \"./tools/scaffold.ts\";\nimport { registerSubgraphTools } from \"./tools/subgraphs.ts\";\nimport { registerWorkflowTools } from \"./tools/workflows.ts\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(\n\treadFileSync(join(__dirname, \"../package.json\"), \"utf-8\"),\n);\n\nexport function createServer(): McpServer {\n\tconst server = new McpServer({\n\t\tname: \"secondlayer\",\n\t\tversion: pkg.version,\n\t});\n\n\tregisterScaffoldTools(server);\n\tregisterSubgraphTools(server);\n\tregisterWorkflowTools(server);\n\tregisterAccountTools(server);\n\tregisterResources(server);\n\n\treturn server;\n}\n",
7
7
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\n/** Filter types for blockchain events — SubgraphFilter vocabulary. */\nconst FILTERS_REFERENCE = [\n\t{\n\t\ttype: \"stx_transfer\",\n\t\tfields: [\"sender\", \"recipient\", \"minAmount\", \"maxAmount\"],\n\t},\n\t{ type: \"stx_mint\", fields: [\"recipient\", \"minAmount\"] },\n\t{ type: \"stx_burn\", fields: [\"sender\", \"minAmount\"] },\n\t{ type: \"stx_lock\", fields: [\"lockedAddress\", \"minAmount\"] },\n\t{\n\t\ttype: \"ft_transfer\",\n\t\tfields: [\n\t\t\t\"sender\",\n\t\t\t\"recipient\",\n\t\t\t\"assetIdentifier\",\n\t\t\t\"minAmount\",\n\t\t\t\"maxAmount\",\n\t\t],\n\t},\n\t{ type: \"ft_mint\", fields: [\"recipient\", \"assetIdentifier\", \"minAmount\"] },\n\t{ type: \"ft_burn\", fields: [\"sender\", \"assetIdentifier\", \"minAmount\"] },\n\t{\n\t\ttype: \"nft_transfer\",\n\t\tfields: [\"sender\", \"recipient\", \"assetIdentifier\", \"tokenId\"],\n\t},\n\t{ type: \"nft_mint\", fields: [\"recipient\", \"assetIdentifier\", \"tokenId\"] },\n\t{ type: \"nft_burn\", fields: [\"sender\", \"assetIdentifier\", \"tokenId\"] },\n\t{ type: \"contract_call\", fields: [\"contract\", \"function\"] },\n\t{ type: \"contract_deploy\", fields: [\"contract\"] },\n\t{ type: \"print_event\", fields: [\"contract\", \"event\", \"contains\"] },\n];\n\nconst COLUMN_TYPES = [\n\t{\n\t\ttype: \"uint\",\n\t\tsqlType: \"bigint\",\n\t\tdescription: \"Unsigned integer (Clarity uint)\",\n\t},\n\t{\n\t\ttype: \"int\",\n\t\tsqlType: \"bigint\",\n\t\tdescription: \"Signed integer (Clarity int)\",\n\t},\n\t{ type: \"text\", sqlType: \"text\", description: \"UTF-8 string\" },\n\t{\n\t\ttype: \"principal\",\n\t\tsqlType: \"text\",\n\t\tdescription: \"Stacks address (standard or contract)\",\n\t},\n\t{ type: \"bool\", sqlType: \"boolean\", description: \"Boolean value\" },\n\t{ type: \"json\", sqlType: \"jsonb\", description: \"Arbitrary JSON data\" },\n\t{\n\t\toptions: [\"nullable\", \"indexed\", \"search\"],\n\t\tdescription:\n\t\t\t\"Column options: nullable allows NULL, indexed creates a B-tree index, search enables full-text search\",\n\t},\n];\n\nexport function registerResources(server: McpServer) {\n\tserver.resource(\n\t\t\"filters\",\n\t\t\"secondlayer://filters\",\n\t\t{ description: \"Event filter types and their available fields\" },\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\turi: \"secondlayer://filters\",\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify(FILTERS_REFERENCE, null, 2),\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.resource(\n\t\t\"column-types\",\n\t\t\"secondlayer://column-types\",\n\t\t{ description: \"Subgraph column types, SQL mappings, and options\" },\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\turi: \"secondlayer://column-types\",\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify(COLUMN_TYPES, null, 2),\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
8
- "import { SecondLayer } from \"@secondlayer/sdk\";\n\nlet instance: SecondLayer | null = null;\n\n/** Lazy SDK singleton from SECONDLAYER_API_KEY env var. */\nexport function getClient(): SecondLayer {\n\tif (!instance) {\n\t\tconst apiKey = process.env.SECONDLAYER_API_KEY;\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\n\t\t\t\t\"SECONDLAYER_API_KEY environment variable is required. \" +\n\t\t\t\t\t\"Get your key at https://app.secondlayer.tools/settings/api-keys\",\n\t\t\t);\n\t\t}\n\t\tconst baseUrl = process.env.SECONDLAYER_API_URL;\n\t\tinstance = new SecondLayer({\n\t\t\tapiKey,\n\t\t\torigin: \"mcp\",\n\t\t\t...(baseUrl ? { baseUrl } : {}),\n\t\t});\n\t}\n\treturn instance;\n}\n\n/** Raw fetch helper for API endpoints not covered by the SDK. */\nexport async function apiRequest<T>(\n\tmethod: string,\n\tpath: string,\n\tbody?: unknown,\n): Promise<T> {\n\tconst apiKey = process.env.SECONDLAYER_API_KEY;\n\tif (!apiKey) throw new Error(\"SECONDLAYER_API_KEY required\");\n\tconst baseUrl =\n\t\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\n\tconst res = await fetch(`${baseUrl}${path}`, {\n\t\tmethod,\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t\tbody: body ? JSON.stringify(body) : undefined,\n\t});\n\tif (!res.ok) {\n\t\tconst text = await res.text().catch(() => \"\");\n\t\tthrow Object.assign(new Error(text || `HTTP ${res.status}`), {\n\t\t\tstatus: res.status,\n\t\t});\n\t}\n\tif (res.status === 204) return undefined as T;\n\treturn res.json() as Promise<T>;\n}\n",
8
+ "import { SecondLayer } from \"@secondlayer/sdk\";\n\nlet instance: SecondLayer | null = null;\nlet legacyEnvWarned = false;\n\n/**\n * Read the tenant service key from env. `SL_SERVICE_KEY` is canonical;\n * `SECONDLAYER_API_KEY` is accepted as a deprecated alias and logs once\n * per process so users notice without breaking their setup.\n */\nfunction readServiceKey(): string | undefined {\n\tconst canonical = process.env.SL_SERVICE_KEY;\n\tif (canonical) return canonical;\n\tconst legacy = process.env.SECONDLAYER_API_KEY;\n\tif (legacy) {\n\t\tif (!legacyEnvWarned) {\n\t\t\tlegacyEnvWarned = true;\n\t\t\tconsole.error(\n\t\t\t\t\"[mcp] SECONDLAYER_API_KEY is deprecated — use SL_SERVICE_KEY going forward.\",\n\t\t\t);\n\t\t}\n\t\treturn legacy;\n\t}\n\treturn undefined;\n}\n\n/** Lazy SDK singleton from SL_SERVICE_KEY (or SECONDLAYER_API_KEY) env var. */\nexport function getClient(): SecondLayer {\n\tif (!instance) {\n\t\tconst apiKey = readServiceKey();\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\n\t\t\t\t\"SL_SERVICE_KEY environment variable is required. \" +\n\t\t\t\t\t\"Get your key from `sl instance info` or the dashboard.\",\n\t\t\t);\n\t\t}\n\t\tconst baseUrl = process.env.SECONDLAYER_API_URL;\n\t\tinstance = new SecondLayer({\n\t\t\tapiKey,\n\t\t\torigin: \"mcp\",\n\t\t\t...(baseUrl ? { baseUrl } : {}),\n\t\t});\n\t}\n\treturn instance;\n}\n\n/** Raw fetch helper for API endpoints not covered by the SDK. */\nexport async function apiRequest<T>(\n\tmethod: string,\n\tpath: string,\n\tbody?: unknown,\n): Promise<T> {\n\tconst apiKey = readServiceKey();\n\tif (!apiKey) throw new Error(\"SL_SERVICE_KEY required\");\n\tconst baseUrl =\n\t\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\n\tconst res = await fetch(`${baseUrl}${path}`, {\n\t\tmethod,\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t\tbody: body ? JSON.stringify(body) : undefined,\n\t});\n\tif (!res.ok) {\n\t\tconst text = await res.text().catch(() => \"\");\n\t\tthrow Object.assign(new Error(text || `HTTP ${res.status}`), {\n\t\t\tstatus: res.status,\n\t\t});\n\t}\n\tif (res.status === 204) return undefined as T;\n\treturn res.json() as Promise<T>;\n}\n",
9
9
  "/** Summarize a subgraph for list responses. */\nexport function formatSubgraphSummary(s: {\n\tname: string;\n\tstatus: string;\n\ttables: string[] | Record<string, unknown>;\n\tlastProcessedBlock: number;\n}) {\n\treturn {\n\t\tname: s.name,\n\t\tstatus: s.status,\n\t\ttables: Array.isArray(s.tables) ? s.tables : Object.keys(s.tables),\n\t\tlastProcessedBlock: s.lastProcessedBlock,\n\t};\n}\n\n/** Cap array length and return truncation metadata. */\nexport function withCap<T>(\n\titems: T[],\n\tcap: number,\n): { items: T[]; truncated: boolean; total: number } {\n\treturn {\n\t\titems: items.slice(0, cap),\n\t\ttruncated: items.length > cap,\n\t\ttotal: items.length,\n\t};\n}\n\n/** Build MCP text response with JSON-serialized payload. */\nexport function jsonResponse(\n\tdata: unknown,\n\tisError?: boolean,\n): { content: Array<{ type: \"text\"; text: string }>; isError?: boolean } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: JSON.stringify(data, null, 2) }],\n\t\t...(isError && { isError: true }),\n\t};\n}\n\n/** Build MCP text response with plain text payload. */\nexport function textResponse(\n\ttext: string,\n\tisError?: boolean,\n): { content: Array<{ type: \"text\"; text: string }>; isError?: boolean } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text }],\n\t\t...(isError && { isError: true }),\n\t};\n}\n",
10
10
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\ninterface ToolResult {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tisError?: boolean;\n}\n\n/**\n * Type-safe wrapper around McpServer.tool() that avoids TS2589.\n *\n * The MCP SDK's Zod-generic `tool()` signature recurses past TypeScript's\n * instantiation depth limit when schemas contain discriminated unions or\n * nested optionals. This helper isolates the boundary cast to one place\n * so tool files stay fully typed via the explicit `T` generic.\n *\n * Schema is typed as Record<string, unknown> to prevent TypeScript from\n * resolving the deeply recursive ZodRawShapeCompat constraint. Zod still\n * validates at runtime.\n */\nexport function defineTool<T>(\n\tserver: McpServer,\n\tname: string,\n\tdescription: string,\n\tschema: Record<string, unknown>,\n\thandler: (args: T) => Promise<ToolResult> | ToolResult,\n): void {\n\tconst wrappedHandler = async (args: T): Promise<ToolResult> => {\n\t\ttry {\n\t\t\treturn await handler(args);\n\t\t} catch (err: unknown) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tconst status =\n\t\t\t\terr instanceof Error && \"status\" in err ? (err as any).status : 0;\n\t\t\tconst type =\n\t\t\t\tstatus === 401\n\t\t\t\t\t? \"unauthorized\"\n\t\t\t\t\t: status === 404\n\t\t\t\t\t\t? \"not_found\"\n\t\t\t\t\t\t: status === 429\n\t\t\t\t\t\t\t? \"rate_limited\"\n\t\t\t\t\t\t\t: status >= 500\n\t\t\t\t\t\t\t\t? \"server_error\"\n\t\t\t\t\t\t\t\t: \"error\";\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify({ error: { type, status, message } }),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tisError: true,\n\t\t\t};\n\t\t}\n\t};\n\t(server.tool as Function)(name, description, schema, wrappedHandler);\n}\n",
11
11
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { apiRequest } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerAccountTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"account_whoami\",\n\t\t\"Show the authenticated account's email and plan.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst result = await apiRequest<{ email: string; plan: string }>(\n\t\t\t\t\"GET\",\n\t\t\t\t\"/api/accounts/me\",\n\t\t\t);\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n}\n",
12
12
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { generateSubgraphCode } from \"@secondlayer/scaffold\";\nimport type { AbiFunction, AbiMap } from \"@secondlayer/scaffold\";\nimport { z } from \"zod/v4\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nconst API_BASE =\n\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\n\nasync function fetchAbi(\n\tcontractId: string,\n): Promise<{ functions: AbiFunction[]; maps: AbiMap[] }> {\n\tconst res = await fetch(`${API_BASE}/api/node/contracts/${contractId}/abi`, {\n\t\tsignal: AbortSignal.timeout(10_000),\n\t});\n\tif (!res.ok) {\n\t\tif (res.status === 404)\n\t\t\tthrow new Error(`Contract not found: ${contractId}`);\n\t\tthrow new Error(`Failed to fetch ABI: HTTP ${res.status}`);\n\t}\n\tconst abi = (await res.json()) as {\n\t\tfunctions?: AbiFunction[];\n\t\tmaps?: AbiMap[];\n\t};\n\treturn {\n\t\tfunctions: abi.functions ?? [],\n\t\tmaps: abi.maps ?? [],\n\t};\n}\n\nexport function registerScaffoldTools(server: McpServer) {\n\tdefineTool<{ contractId: string; subgraphName?: string }>(\n\t\tserver,\n\t\t\"scaffold_from_contract\",\n\t\t\"Generate a subgraph scaffold from a deployed Stacks contract. Fetches the ABI automatically.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Fully qualified contract ID (e.g. SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01)\",\n\t\t\t\t),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the subgraph name (defaults to contract name)\"),\n\t\t},\n\t\tasync ({ contractId, subgraphName }) => {\n\t\t\tconst { functions, maps } = await fetchAbi(contractId);\n\t\t\tconst code = generateSubgraphCode(\n\t\t\t\tcontractId,\n\t\t\t\tfunctions,\n\t\t\t\tsubgraphName,\n\t\t\t\tmaps,\n\t\t\t);\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n\n\tdefineTool<{ abi: string; contractId: string; subgraphName?: string }>(\n\t\tserver,\n\t\t\"scaffold_from_abi\",\n\t\t\"Generate a subgraph scaffold from a provided ABI JSON. Use when you already have the ABI.\",\n\t\t{\n\t\t\tabi: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"ABI JSON string (the full contract ABI object)\"),\n\t\t\tcontractId: z.string().describe(\"Fully qualified contract ID\"),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the subgraph name\"),\n\t\t},\n\t\tasync ({ abi, contractId, subgraphName }) => {\n\t\t\tlet parsed: { functions?: AbiFunction[]; maps?: AbiMap[] };\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(abi);\n\t\t\t} catch {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"Invalid ABI JSON\" }],\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst code = generateSubgraphCode(\n\t\t\t\tcontractId,\n\t\t\t\tparsed.functions ?? [],\n\t\t\t\tsubgraphName,\n\t\t\t\tparsed.maps ?? [],\n\t\t\t);\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n}\n",
13
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { formatSubgraphSummary, withCap } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerSubgraphTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await getClient().subgraphs.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(data.map(formatSubgraphSummary), null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_get\",\n\t\t\"Get full details of a subgraph including schema, health, and table columns.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().subgraphs.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttable: string;\n\t\tfilters?: Record<string, string>;\n\t\tsort?: string;\n\t\torder?: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tfields?: string;\n\t\tcount?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_query\",\n\t\t'Query rows from a subgraph table (max 200 rows). Filters support operators: \"amount.gte\": \"1000\", \"sender.neq\": \"SP...\", \"name.like\": \"%token%\". Available operators: eq, neq, gt, gte, lt, lte, like.',\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\ttable: z.string().describe(\"Table name\"),\n\t\t\tfilters: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Column filters — plain values or with operators (e.g. {\"amount.gte\": \"1000\", \"sender\": \"SP...\"})',\n\t\t\t\t),\n\t\t\tsort: z.string().optional().describe(\"Column to sort by\"),\n\t\t\torder: z.enum([\"asc\", \"desc\"]).optional().describe(\"Sort order\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max rows (default 50, max 200)\"),\n\t\t\toffset: z.number().optional().describe(\"Offset for pagination\"),\n\t\t\tfields: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Comma-separated column list to return (e.g. \"sender,amount\")',\n\t\t\t\t),\n\t\t\tcount: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, return row count instead of rows\"),\n\t\t},\n\t\tasync ({\n\t\t\tname,\n\t\t\ttable,\n\t\t\tfilters,\n\t\t\tsort,\n\t\t\torder,\n\t\t\tlimit,\n\t\t\toffset,\n\t\t\tfields,\n\t\t\tcount,\n\t\t}) => {\n\t\t\tif (count) {\n\t\t\t\tconst result = await getClient().subgraphs.queryTableCount(\n\t\t\t\t\tname,\n\t\t\t\t\ttable,\n\t\t\t\t\t{ filters, sort, order },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst rows = await getClient().subgraphs.queryTable(name, table, {\n\t\t\t\tfilters,\n\t\t\t\tsort,\n\t\t\t\torder,\n\t\t\t\tlimit: limit ?? 50,\n\t\t\t\toffset,\n\t\t\t\tfields,\n\t\t\t});\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst result = withCap(\n\t\t\t\trows as Record<string, unknown>[],\n\t\t\t\tcap > 200 ? 200 : cap,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; fromBlock?: number; toBlock?: number }>(\n\t\tserver,\n\t\t\"subgraphs_reindex\",\n\t\t\"Reindex a subgraph from a specific block range.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\tfromBlock: z\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Start block (defaults to beginning)\"),\n\t\t\ttoBlock: z.number().optional().describe(\"End block (defaults to latest)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await getClient().subgraphs.reindex(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_delete\",\n\t\t\"Delete a subgraph permanently.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await getClient().subgraphs.delete(name);\n\t\t\treturn { content: [{ type: \"text\", text: result.message }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; reindex?: boolean }>(\n\t\tserver,\n\t\t\"subgraphs_deploy\",\n\t\t\"Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineSubgraph() call\"),\n\t\t\treindex: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Force reindex on breaking schema change (drops and rebuilds all data)\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, reindex }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\tconst result = await getClient().subgraphs.deploy({\n\t\t\t\tname: bundled.name,\n\t\t\t\tversion: bundled.version,\n\t\t\t\tdescription: bundled.description,\n\t\t\t\tsources: bundled.sources,\n\t\t\t\tschema: bundled.schema,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: code,\n\t\t\t\treindex,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_read_source\",\n\t\t\"Fetch the deployed TypeScript source of a subgraph (plus its stored version). Returns a readOnly payload for subgraphs deployed before source capture — in that case the caller should redeploy via CLI before editing.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().subgraphs.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n}\n"
13
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { formatSubgraphSummary, withCap } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerSubgraphTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await getClient().subgraphs.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(data.map(formatSubgraphSummary), null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_get\",\n\t\t\"Get full details of a subgraph including schema, health, and table columns.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().subgraphs.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttable: string;\n\t\tfilters?: Record<string, string>;\n\t\tsort?: string;\n\t\torder?: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tfields?: string;\n\t\tcount?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_query\",\n\t\t'Query rows from a subgraph table (max 200 rows). Filters support operators: \"amount.gte\": \"1000\", \"sender.neq\": \"SP...\", \"name.like\": \"%token%\". Available operators: eq, neq, gt, gte, lt, lte, like.',\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\ttable: z.string().describe(\"Table name\"),\n\t\t\tfilters: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Column filters — plain values or with operators (e.g. {\"amount.gte\": \"1000\", \"sender\": \"SP...\"})',\n\t\t\t\t),\n\t\t\tsort: z.string().optional().describe(\"Column to sort by\"),\n\t\t\torder: z.enum([\"asc\", \"desc\"]).optional().describe(\"Sort order\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max rows (default 50, max 200)\"),\n\t\t\toffset: z.number().optional().describe(\"Offset for pagination\"),\n\t\t\tfields: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Comma-separated column list to return (e.g. \"sender,amount\")',\n\t\t\t\t),\n\t\t\tcount: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, return row count instead of rows\"),\n\t\t},\n\t\tasync ({\n\t\t\tname,\n\t\t\ttable,\n\t\t\tfilters,\n\t\t\tsort,\n\t\t\torder,\n\t\t\tlimit,\n\t\t\toffset,\n\t\t\tfields,\n\t\t\tcount,\n\t\t}) => {\n\t\t\tif (count) {\n\t\t\t\tconst result = await getClient().subgraphs.queryTableCount(\n\t\t\t\t\tname,\n\t\t\t\t\ttable,\n\t\t\t\t\t{ filters, sort, order },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst rows = await getClient().subgraphs.queryTable(name, table, {\n\t\t\t\tfilters,\n\t\t\t\tsort,\n\t\t\t\torder,\n\t\t\t\tlimit: limit ?? 50,\n\t\t\t\toffset,\n\t\t\t\tfields,\n\t\t\t});\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst result = withCap(\n\t\t\t\trows as Record<string, unknown>[],\n\t\t\t\tcap > 200 ? 200 : cap,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; fromBlock?: number; toBlock?: number }>(\n\t\tserver,\n\t\t\"subgraphs_reindex\",\n\t\t\"Reindex a subgraph from a specific block range.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\tfromBlock: z\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Start block (defaults to beginning)\"),\n\t\t\ttoBlock: z.number().optional().describe(\"End block (defaults to latest)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await getClient().subgraphs.reindex(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_delete\",\n\t\t\"Delete a subgraph permanently.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await getClient().subgraphs.delete(name);\n\t\t\treturn { content: [{ type: \"text\", text: result.message }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; reindex?: boolean }>(\n\t\tserver,\n\t\t\"subgraphs_deploy\",\n\t\t\"Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineSubgraph() call\"),\n\t\t\treindex: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Force reindex on breaking schema change (drops and rebuilds all data)\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, reindex }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\tconst result = await getClient().subgraphs.deploy({\n\t\t\t\tname: bundled.name,\n\t\t\t\tversion: bundled.version,\n\t\t\t\tdescription: bundled.description,\n\t\t\t\tsources: bundled.sources,\n\t\t\t\tschema: bundled.schema,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: code,\n\t\t\t\treindex,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_read_source\",\n\t\t\"Fetch the deployed TypeScript source of a subgraph (plus its stored version). Returns a readOnly payload for subgraphs deployed before source capture — in that case the caller should redeploy via CLI before editing.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().subgraphs.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n}\n",
14
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleWorkflowCode } from \"@secondlayer/bundler\";\nimport {\n\ttype ScaffoldDeliveryTarget,\n\ttype ScaffoldStepKind,\n\tgenerateWorkflowCode,\n} from \"@secondlayer/scaffold\";\nimport { VersionConflictError } from \"@secondlayer/sdk\";\nimport { createPatch } from \"diff\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerWorkflowTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"workflows_list\",\n\t\t\"List all workflows. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { workflows } = await getClient().workflows.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(workflows, null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_get\",\n\t\t\"Get full details of a workflow by name.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().workflows.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_get_definition\",\n\t\t\"Return the deployed TypeScript source of a workflow plus its stored version. Returns `sourceCode: null` + `readOnly: true` for workflows deployed before source capture.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().workflows.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\tproposedCode: string;\n\t\texpectedVersion?: string;\n\t}>(\n\t\tserver,\n\t\t\"workflows_propose_edit\",\n\t\t\"Validate a proposed edit WITHOUT deploying. Fetches the current stored source, bundles the proposed source, computes a unified diff, and returns everything for review. Use this when you want to show the user a diff before committing — pair it with workflows_deploy(expectedVersion=...) to persist.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tproposedCode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"New TypeScript source — must compile and validate.\"),\n\t\t\texpectedVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Version the proposer is editing from (for audit).\"),\n\t\t},\n\t\tasync ({ name, proposedCode, expectedVersion }) => {\n\t\t\tconst current = await getClient().workflows.getSource(name);\n\t\t\tif (current.sourceCode === null) {\n\t\t\t\treturn {\n\t\t\t\t\tisError: true,\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\t\t\t\"Workflow has no stored source. Redeploy via CLI first.\",\n\t\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\t\tversion: current.version,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet bundleValid = false;\n\t\t\tlet validation: { name: string; triggerType: string } | { error: string };\n\t\t\tlet bundleSize = 0;\n\t\t\ttry {\n\t\t\t\tconst bundled = await bundleWorkflowCode(proposedCode);\n\t\t\t\tbundleValid = true;\n\t\t\t\tbundleSize = Buffer.byteLength(bundled.handlerCode, \"utf8\");\n\t\t\t\tvalidation = {\n\t\t\t\t\tname: bundled.name,\n\t\t\t\t\ttriggerType: bundled.trigger.type,\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tvalidation = {\n\t\t\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst diffText = createPatch(\n\t\t\t\t`${name}.ts`,\n\t\t\t\tcurrent.sourceCode,\n\t\t\t\tproposedCode,\n\t\t\t\t`v${current.version}`,\n\t\t\t\t\"proposed\",\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcurrentVersion: current.version,\n\t\t\t\t\t\t\t\texpectedVersion,\n\t\t\t\t\t\t\t\tcurrentSource: current.sourceCode,\n\t\t\t\t\t\t\t\tproposedSource: proposedCode,\n\t\t\t\t\t\t\t\tdiffText,\n\t\t\t\t\t\t\t\tbundleValid,\n\t\t\t\t\t\t\t\tvalidation,\n\t\t\t\t\t\t\t\tbundleSize,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\trunId: string;\n\t\tlimit?: number;\n\t\ttimeoutMs?: number;\n\t}>(\n\t\tserver,\n\t\t\"workflows_tail_run\",\n\t\t\"Tail a workflow run via SSE and return a compacted log. Resolves as soon as the run completes, `limit` events are collected, or `timeoutMs` elapses (default 60s). MCP is not streaming-first — use this for short-lived follow-ups, not long tails.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\trunId: z.string().describe(\"Run id\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.positive()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max step events to collect (default 50)\"),\n\t\t\ttimeoutMs: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.positive()\n\t\t\t\t.max(5 * 60 * 1000)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Hard timeout in ms (default 60000, max 300000)\"),\n\t\t},\n\t\tasync ({ name, runId, limit, timeoutMs }) => {\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst deadline = timeoutMs ?? 60_000;\n\n\t\t\tconst events: Array<Record<string, unknown>> = [];\n\t\t\tlet finalStatus: string | null = null;\n\t\t\tlet stoppedBy: \"done\" | \"limit\" | \"timeout\" = \"timeout\";\n\n\t\t\tconst controller = new AbortController();\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tstoppedBy = \"timeout\";\n\t\t\t\tcontroller.abort();\n\t\t\t}, deadline);\n\n\t\t\ttry {\n\t\t\t\tawait getClient().workflows.streamRun(\n\t\t\t\t\tname,\n\t\t\t\t\trunId,\n\t\t\t\t\t(event) => {\n\t\t\t\t\t\tif (event.type === \"step\") {\n\t\t\t\t\t\t\tevents.push(event.step as unknown as Record<string, unknown>);\n\t\t\t\t\t\t\tif (events.length >= cap) {\n\t\t\t\t\t\t\t\tstoppedBy = \"limit\";\n\t\t\t\t\t\t\t\tcontroller.abort();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (event.type === \"done\") {\n\t\t\t\t\t\t\tfinalStatus = event.done.status;\n\t\t\t\t\t\t\tstoppedBy = \"done\";\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontroller.signal,\n\t\t\t\t);\n\t\t\t} catch (err) {\n\t\t\t\tif (!(err instanceof Error) || err.name !== \"AbortError\") {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\tfinalStatus,\n\t\t\t\t\t\t\t\tstoppedBy,\n\t\t\t\t\t\t\t\teventCount: events.length,\n\t\t\t\t\t\t\t\tevents,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"workflows_pause_all\",\n\t\t\"Pause ALL active workflows for the authenticated account. Irreversible only by calling pause/resume per workflow. Returns the list of affected workflows.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst result = await getClient().workflows.pauseAll();\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ runId: string }>(\n\t\tserver,\n\t\t\"workflows_cancel_run\",\n\t\t\"Cancel an in-flight workflow run. Marks the run as cancelled and removes any pending queue entry. No-ops if the run is already terminal.\",\n\t\t{ runId: z.string().describe(\"Run id to cancel\") },\n\t\tasync ({ runId }) => {\n\t\t\tconst result = await getClient().workflows.cancelRun(runId);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; toVersion?: string }>(\n\t\tserver,\n\t\t\"workflows_rollback\",\n\t\t\"Roll a workflow back to a prior version. The restored handler is re-published as a NEW version (audit trail), so no history is lost. Pass toVersion to pick a specific bundle; omit to roll back to the immediate previous version on disk. Last 3 versions are retained.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\ttoVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Target version to restore. Must be one of the retained bundles on disk.\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ name, toVersion }) => {\n\t\t\tconst result = await getClient().workflows.rollback(name, toVersion);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_delete\",\n\t\t\"Delete a workflow permanently.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.delete(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Deleted workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; input?: string }>(\n\t\tserver,\n\t\t\"workflows_trigger\",\n\t\t\"Trigger a workflow run. Optionally pass input as a JSON string.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tinput: z.string().optional().describe(\"Input as JSON string\"),\n\t\t},\n\t\tasync ({ name, input }) => {\n\t\t\tconst parsed = input ? JSON.parse(input) : undefined;\n\t\t\tconst result = await getClient().workflows.trigger(name, parsed);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_pause\",\n\t\t\"Pause a running workflow.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.pause(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Paused workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_resume\",\n\t\t\"Resume a paused workflow.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.resume(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Resumed workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttrigger:\n\t\t\t| { type: \"event\"; filterType?: string }\n\t\t\t| { type: \"schedule\"; cron: string; timezone?: string }\n\t\t\t| { type: \"manual\" };\n\t\tsteps: ScaffoldStepKind[];\n\t\tdeliveryTarget?: ScaffoldDeliveryTarget;\n\t}>(\n\t\tserver,\n\t\t\"workflows_scaffold\",\n\t\t\"Generate a compilable defineWorkflow() skeleton from a typed intent. Returns the TypeScript source; pass it to workflows_deploy to persist. Placeholders inside the source must be filled in before running a real workflow.\",\n\t\t{\n\t\t\tname: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^[a-z][a-z0-9-]*$/)\n\t\t\t\t.describe(\"Workflow name (lowercase, hyphens)\"),\n\t\t\ttrigger: z\n\t\t\t\t.discriminatedUnion(\"type\", [\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.literal(\"event\"),\n\t\t\t\t\t\tfilterType: z.string().optional(),\n\t\t\t\t\t}),\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.literal(\"schedule\"),\n\t\t\t\t\t\tcron: z.string().min(1),\n\t\t\t\t\t\ttimezone: z.string().optional(),\n\t\t\t\t\t}),\n\t\t\t\t\tz.object({ type: z.literal(\"manual\") }),\n\t\t\t\t])\n\t\t\t\t.describe(\"Trigger shape\"),\n\t\t\tsteps: z\n\t\t\t\t.array(z.enum([\"run\", \"query\", \"ai\", \"deliver\"]))\n\t\t\t\t.describe(\"Ordered list of step kinds to include in the handler\"),\n\t\t\tdeliveryTarget: z\n\t\t\t\t.enum([\"webhook\", \"slack\", \"email\", \"discord\", \"telegram\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Delivery target used when steps includes `deliver`\"),\n\t\t},\n\t\tasync ({ name, trigger, steps, deliveryTarget }) => {\n\t\t\tconst code = generateWorkflowCode({\n\t\t\t\tname,\n\t\t\t\ttrigger,\n\t\t\t\tsteps,\n\t\t\t\tdeliveryTarget,\n\t\t\t});\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; expectedVersion?: string; dryRun?: boolean }>(\n\t\tserver,\n\t\t\"workflows_deploy\",\n\t\t\"Deploy a workflow from TypeScript source. Pass the full defineWorkflow() source — it will be bundled, validated, and deployed. Use expectedVersion for optimistic concurrency, or dryRun to validate without persisting.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineWorkflow() call\"),\n\t\t\texpectedVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Stored version the client expects (major.minor.patch). Server returns 409 on mismatch.\",\n\t\t\t\t),\n\t\t\tdryRun: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, validate and bundle only — do not persist.\"),\n\t\t},\n\t\tasync ({ code, expectedVersion, dryRun }) => {\n\t\t\tlet bundled: Awaited<ReturnType<typeof bundleWorkflowCode>>;\n\t\t\ttry {\n\t\t\t\tbundled = await bundleWorkflowCode(code);\n\t\t\t} catch (err) {\n\t\t\t\treturn {\n\t\t\t\t\tisError: true,\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst base = {\n\t\t\t\tname: bundled.name,\n\t\t\t\ttrigger: bundled.trigger as unknown as Record<string, unknown>,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: bundled.sourceCode,\n\t\t\t\tretries: bundled.retries as Record<string, unknown> | undefined,\n\t\t\t\ttimeout: bundled.timeout,\n\t\t\t\texpectedVersion,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst result = dryRun\n\t\t\t\t\t? await getClient().workflows.deploy({ ...base, dryRun: true })\n\t\t\t\t\t: await getClient().workflows.deploy(base);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err instanceof VersionConflictError) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\terror: err.message,\n\t\t\t\t\t\t\t\t\t\tcode: \"VERSION_CONFLICT\",\n\t\t\t\t\t\t\t\t\t\tcurrentVersion: err.currentVersion,\n\t\t\t\t\t\t\t\t\t\texpectedVersion: err.expectedVersion,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; status?: string; limit?: number }>(\n\t\tserver,\n\t\t\"workflows_runs\",\n\t\t\"List runs for a workflow. Optionally filter by status and limit results.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tstatus: z\n\t\t\t\t.enum([\"running\", \"completed\", \"failed\", \"cancelled\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by run status\"),\n\t\t\tlimit: z.number().optional().describe(\"Max runs to return (default 20)\"),\n\t\t},\n\t\tasync ({ name, status, limit }) => {\n\t\t\tconst { runs } = await getClient().workflows.listRuns(name, {\n\t\t\t\tstatus: status as\n\t\t\t\t\t| \"running\"\n\t\t\t\t\t| \"completed\"\n\t\t\t\t\t| \"failed\"\n\t\t\t\t\t| \"cancelled\"\n\t\t\t\t\t| undefined,\n\t\t\t\tlimit,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(runs, null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n}\n"
14
15
  ],
15
- "mappings": ";;;AACA;AAAA,kBAGC;AAAA;AAED;;;ACNA;AACA;AACA;AACA;;;ACAA,IAAM,oBAAoB;AAAA,EACzB;AAAA,IACC,MAAM;AAAA,IACN,QAAQ,CAAC,UAAU,aAAa,aAAa,WAAW;AAAA,EACzD;AAAA,EACA,EAAE,MAAM,YAAY,QAAQ,CAAC,aAAa,WAAW,EAAE;AAAA,EACvD,EAAE,MAAM,YAAY,QAAQ,CAAC,UAAU,WAAW,EAAE;AAAA,EACpD,EAAE,MAAM,YAAY,QAAQ,CAAC,iBAAiB,WAAW,EAAE;AAAA,EAC3D;AAAA,IACC,MAAM;AAAA,IACN,QAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAAA,EACA,EAAE,MAAM,WAAW,QAAQ,CAAC,aAAa,mBAAmB,WAAW,EAAE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