@secondlayer/mcp 4.1.1 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -104,6 +104,12 @@ function jsonResponse(data, isError) {
104
104
  ...isError && { isError: true }
105
105
  };
106
106
  }
107
+ function textResponse(text, isError) {
108
+ return {
109
+ content: [{ type: "text", text }],
110
+ ...isError && { isError: true }
111
+ };
112
+ }
107
113
 
108
114
  // src/lib/tool.ts
109
115
  var registeredToolNames = new Set;
@@ -401,7 +407,8 @@ function registerIndexTools(server, clientProvider = getClient) {
401
407
  sender: z3.string().optional().describe("Filter by sender principal"),
402
408
  recipient: z3.string().optional().describe("Filter by recipient principal"),
403
409
  assetIdentifier: z3.string().optional().describe("Filter by asset identifier where applicable"),
404
- trait: z3.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only.")
410
+ trait: z3.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only."),
411
+ txContext: z3.boolean().optional().describe("Join the submitting transaction into each event (tx_sender, tx_type, tx_status, tx_contract_id, tx_function_name). For print events it's the only source of the submitting sender.")
405
412
  }, async (params) => jsonResponse(await clientProvider().index.events.list(params)));
406
413
  defineTool(server, "index_contract_calls", "List decoded contract calls from the Index (function name, args, result). Set `trait` (e.g. sip-010) to match calls to all contracts conforming to a standard. Note: contract-call cursors are a SEPARATE keyspace from event cursors — they are not interchangeable.", {
407
414
  ...rangeFilters,
@@ -465,20 +472,11 @@ import { z as z5 } from "zod/v4";
465
472
  function registerSubgraphTools(server, clientProvider = getClient) {
466
473
  defineTool(server, "subgraphs_list", "List all deployed subgraphs. Returns summary fields only, including visibility — public subgraphs are anon-readable at /v1/subgraphs/<name>.", {}, async () => {
467
474
  const { data } = await clientProvider().subgraphs.list();
468
- return {
469
- content: [
470
- {
471
- type: "text",
472
- text: JSON.stringify(data.map(formatSubgraphSummary), null, 2)
473
- }
474
- ]
475
- };
475
+ return jsonResponse(data.map(formatSubgraphSummary));
476
476
  });
477
477
  defineTool(server, "subgraphs_get", "Get full details of a subgraph including schema, health, and table columns.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
478
478
  const detail = await clientProvider().subgraphs.get(name);
479
- return {
480
- content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
481
- };
479
+ return jsonResponse(detail);
482
480
  });
483
481
  defineTool(server, "subgraphs_query", '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. To TAIL new rows (no streaming over MCP): sort=_id, order=desc for the latest, then poll forward with the filter {"_id.gt": "<last _id seen>"}, order=asc. Fetch one row by id with {"_id": "<id>"}. Public subgraphs are also keyless over HTTP at GET /v1/subgraphs/<name>/<table> — { rows, next_cursor, tip } envelope, resume with ?cursor=<next_cursor> + _order=asc|desc (no _offset/_sort on /v1); hand that URL to third parties.', {
484
482
  name: z5.string().describe("Subgraph name"),
@@ -503,9 +501,7 @@ function registerSubgraphTools(server, clientProvider = getClient) {
503
501
  }) => {
504
502
  if (count) {
505
503
  const result2 = await clientProvider().subgraphs.queryTableCount(name, table, { filters, sort, order });
506
- return {
507
- content: [{ type: "text", text: JSON.stringify(result2, null, 2) }]
508
- };
504
+ return jsonResponse(result2);
509
505
  }
510
506
  const rows = await clientProvider().subgraphs.queryTable(name, table, {
511
507
  filters,
@@ -515,11 +511,8 @@ function registerSubgraphTools(server, clientProvider = getClient) {
515
511
  offset,
516
512
  fields
517
513
  });
518
- const cap = limit ?? 50;
519
- const result = withCap(rows, cap > 200 ? 200 : cap);
520
- return {
521
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
522
- };
514
+ const result = withCap(rows, Math.min(limit ?? 50, 200));
515
+ return jsonResponse(result);
523
516
  });
524
517
  defineTool(server, "subgraphs_reindex", "Reindex a subgraph from a specific block range. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress to completion.", {
525
518
  name: z5.string().describe("Subgraph name"),
@@ -530,9 +523,7 @@ function registerSubgraphTools(server, clientProvider = getClient) {
530
523
  fromBlock,
531
524
  toBlock
532
525
  });
533
- return {
534
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
535
- };
526
+ return jsonResponse(result);
536
527
  });
537
528
  defineTool(server, "subgraphs_backfill", "Backfill a subgraph over a block range. Non-destructive forward fill (does not drop existing data) — unlike subgraphs_reindex, and the only data-fill path for BYO subgraphs (reindex is blocked there). Both blocks required. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress.", {
538
529
  name: z5.string().describe("Subgraph name"),
@@ -543,15 +534,11 @@ function registerSubgraphTools(server, clientProvider = getClient) {
543
534
  fromBlock,
544
535
  toBlock
545
536
  });
546
- return {
547
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
548
- };
537
+ return jsonResponse(result);
549
538
  });
550
539
  defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_get (health) or the REST operations endpoint to confirm it reaches a terminal state.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
551
540
  const result = await clientProvider().subgraphs.stop(name);
552
- return {
553
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
554
- };
541
+ return jsonResponse(result);
555
542
  });
556
543
  defineTool(server, "subgraphs_gaps", "List indexing gaps (missing block ranges) for a subgraph. Each gap reports start/end/size, reason, and detected/resolved timestamps. Feed an unresolved gap's range into subgraphs_backfill to fill it. Defaults to unresolved gaps.", {
557
544
  name: z5.string().describe("Subgraph name"),
@@ -564,13 +551,11 @@ function registerSubgraphTools(server, clientProvider = getClient) {
564
551
  offset,
565
552
  resolved
566
553
  });
567
- return {
568
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
569
- };
554
+ return jsonResponse(result);
570
555
  });
571
556
  defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
572
557
  const result = await clientProvider().subgraphs.delete(name);
573
- return { content: [{ type: "text", text: result.message }] };
558
+ return textResponse(result.message);
574
559
  });
575
560
  defineTool(server, "subgraphs_deploy", "Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed. Optional startBlock overrides the source definition for this deploy. Set dryRun to validate and preview the schema/DDL without writing anything. Set databaseUrl to deploy to your own Postgres (BYO data plane) — the server verifies the connection first; with dryRun it returns the DDL + grant script. A breaking BYO schema change is refused and returns a migration plan (drop + rebuild DDL) instead of deploying. Visibility defaults: managed deploys are public (anon-readable at /v1/subgraphs/<name>, name claimed in the global public namespace), BYO deploys are private. Call `subgraphs_reindex` separately if you need a forced reindex.", {
576
561
  code: z5.string().describe("TypeScript source code containing a defineSubgraph() call"),
@@ -594,34 +579,21 @@ function registerSubgraphTools(server, clientProvider = getClient) {
594
579
  ...dryRun !== undefined ? { dryRun } : {},
595
580
  ...visibility !== undefined ? { visibility } : {}
596
581
  });
597
- return {
598
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
599
- };
582
+ return jsonResponse(result);
600
583
  } catch (err) {
601
584
  if (err instanceof ByoBreakingChangeError) {
602
- return {
603
- content: [
604
- {
605
- type: "text",
606
- text: JSON.stringify({ byoBreakingChange: true, ...err.details }, null, 2)
607
- }
608
- ]
609
- };
585
+ return jsonResponse({ byoBreakingChange: true, ...err.details });
610
586
  }
611
587
  throw err;
612
588
  }
613
589
  });
614
590
  defineTool(server, "subgraphs_publish", "Make a subgraph publicly readable at /v1/subgraphs/<name> — anyone (or any agent) can read it without a key. Claims the name in the global public namespace; fails with PUBLIC_NAME_TAKEN if another account holds it.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
615
591
  const result = await clientProvider().subgraphs.publish(name);
616
- return {
617
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
618
- };
592
+ return jsonResponse(result);
619
593
  });
620
594
  defineTool(server, "subgraphs_unpublish", "Make a subgraph private again — /v1 reads then require the owning account's bearer key, and the global public name claim is released.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
621
595
  const result = await clientProvider().subgraphs.unpublish(name);
622
- return {
623
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
624
- };
596
+ return jsonResponse(result);
625
597
  });
626
598
  }
627
599
 
@@ -631,15 +603,11 @@ import { z as z6 } from "zod/v4";
631
603
  function registerSubscriptionTools(server, clientProvider = getClient) {
632
604
  defineTool(server, "subscriptions_list", "List all subscriptions for the current account. Returns summary fields (no secrets).", {}, async () => {
633
605
  const { data } = await clientProvider().subscriptions.list();
634
- return {
635
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
636
- };
606
+ return jsonResponse(data);
637
607
  });
638
608
  defineTool(server, "subscriptions_get", "Get full detail for a subscription (filter, auth, retry config, circuit state).", { id: z6.string().describe("Subscription id") }, async ({ id }) => {
639
609
  const detail = await clientProvider().subscriptions.get(id);
640
- return {
641
- content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
642
- };
610
+ return jsonResponse(detail);
643
611
  });
644
612
  defineTool(server, "subscriptions_create", "Create a subscription. Two kinds (mutually exclusive): a SUBGRAPH subscription fires on a subgraph table's rows (set subgraphName + tableName + optional filter); a CHAIN subscription fires on raw chain events with no subgraph (set triggers). Returns `signingSecret` ONCE — forward it to the user so they can wire it into their receiver.", {
645
613
  name: z6.string().describe("Human-readable name, unique per account"),
@@ -675,9 +643,7 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
675
643
  authConfig: z6.record(z6.string(), z6.unknown()).optional().describe('Receiver auth sent with each delivery, e.g. {"type": "bearer", "token": "..."}')
676
644
  }, async (input) => {
677
645
  const res = await clientProvider().subscriptions.create(input);
678
- return {
679
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
680
- };
646
+ return jsonResponse(res);
681
647
  });
682
648
  defineTool(server, "subscriptions_update", "Patch a subscription (name, url, filter, authConfig, format, runtime, retry, timeout, concurrency).", {
683
649
  id: z6.string(),
@@ -699,21 +665,15 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
699
665
  concurrency: z6.number().int().min(1).optional()
700
666
  }, async ({ id, ...patch }) => {
701
667
  const res = await clientProvider().subscriptions.update(id, patch);
702
- return {
703
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
704
- };
668
+ return jsonResponse(res);
705
669
  });
706
670
  defineTool(server, "subscriptions_delete", "Delete a subscription. Pending outbox rows are cascade-deleted.", { id: z6.string() }, async ({ id }) => {
707
671
  const res = await clientProvider().subscriptions.delete(id);
708
- return {
709
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
710
- };
672
+ return jsonResponse(res);
711
673
  });
712
674
  defineTool(server, "subscriptions_test", "Send a one-off test webhook to a subscription's URL (built for its format, SSRF-guarded). Logged as a delivery row. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id: z6.string().describe("Subscription id") }, async ({ id }) => {
713
675
  const res = await clientProvider().subscriptions.test(id);
714
- return {
715
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
716
- };
676
+ return jsonResponse(res);
717
677
  });
718
678
  defineTool(server, "subscriptions_replay", "Replay a block range for a subscription. Replays run at 10% of batch capacity — use sparingly. Pass `force` (a short idempotency suffix) to re-run a range that was already replayed.", {
719
679
  id: z6.string(),
@@ -726,9 +686,7 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
726
686
  toBlock,
727
687
  ...force !== undefined ? { force } : {}
728
688
  });
729
- return {
730
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
731
- };
689
+ return jsonResponse(res);
732
690
  });
733
691
  }
734
692
 
@@ -754,5 +712,5 @@ export {
754
712
  createServer
755
713
  };
756
714
 
757
- //# debugId=BB9FD3EAA61892D564756E2164756E21
715
+ //# debugId=26696E4DD72BCA8964756E2164756E21
758
716
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -8,14 +8,14 @@
8
8
  "/** 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\tvisibility?: \"public\" | \"private\";\n}) {\n\tconst apiUrl =\n\t\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\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\t...(s.visibility ? { visibility: s.visibility } : {}),\n\t\t// Public subgraphs are anon-readable — surface the shareable /v1 URL.\n\t\t...(s.visibility === \"public\"\n\t\t\t? { publicUrl: `${apiUrl}/v1/subgraphs/${s.name}` }\n\t\t\t: {}),\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",
9
9
  "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// Names of every tool registered via defineTool, in registration order. The\n// context resource generates its capability list from this so CAPABILITIES can\n// never drift behind the actual tool surface (a new tool auto-appears). A Set\n// dedupes across repeated createServer() calls in tests.\nconst registeredToolNames = new Set<string>();\n\n/** Tool names registered so far this process (see {@link defineTool}). */\nexport function getRegisteredToolNames(): string[] {\n\treturn [...registeredToolNames];\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\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\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\tregisteredToolNames.add(name);\n\t(server.tool as (...args: unknown[]) => unknown)(\n\t\tname,\n\t\tdescription,\n\t\tschema,\n\t\twrappedHandler,\n\t);\n}\n",
10
10
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod/v4\";\nimport { apiRequest, getClient } 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\tdefineTool<{ product?: \"streams\" | \"index\"; name?: string }>(\n\t\tserver,\n\t\t\"account_create_key\",\n\t\t\"Mint a scoped streams/index read API key so the agent can self-provision access. Requires an account-level (owner) API key. The returned `key` is shown ONCE — forward it to the user to set as SL_API_KEY.\",\n\t\t{\n\t\t\tproduct: z\n\t\t\t\t.enum([\"streams\", \"index\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Key scope (default streams)\"),\n\t\t\tname: z.string().optional().describe(\"Optional label for the key\"),\n\t\t},\n\t\tasync ({ product, name }) =>\n\t\t\tjsonResponse(await getClient().apiKeys.create({ product, name })),\n\t);\n}\n",
11
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\nexport function registerContractTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\n\tdefineTool<{\n\t\ttrait: string;\n\t\tconformance?: \"declared\" | \"inferred\" | \"any\";\n\t\tinclude?: \"abi\";\n\t\tlimit?: number;\n\t\tcursor?: string;\n\t}>(\n\t\tserver,\n\t\t\"contracts_find\",\n\t\t'Discover deployed Stacks contracts conforming to a trait (e.g. \"sip-010\", \"sip-009\", \"sip-013\"). The discovery endpoint for \"which contracts implement X\". Reads are public.',\n\t\t{\n\t\t\ttrait: z.string().describe('Required. Trait to match (e.g. \"sip-010\").'),\n\t\t\tconformance: z\n\t\t\t\t.enum([\"declared\", \"inferred\", \"any\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"declared = parsed from source, inferred = ABI shape-match, any = either (default)\",\n\t\t\t\t),\n\t\t\tinclude: z\n\t\t\t\t.literal(\"abi\")\n\t\t\t\t.optional()\n\t\t\t\t.describe('Set to \"abi\" to include each contract\\'s full ABI'),\n\t\t\tlimit: z.number().optional().describe(\"Page size, 1–500 (default 100)\"),\n\t\t\tcursor: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Opaque cursor from a prior response's next_cursor\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().contracts.list(params)),\n\t);\n\n\tdefineTool<{ contractId: string }>(\n\t\tserver,\n\t\t\"get_contract_abi\",\n\t\t\"Fetch a single deployed contract's ABI from the registry (prod-safe). Returns the contract's metadata + full ABI (functions, maps, variables, fungible/non-fungible tokens). Returns not_found if the contract isn't in the registry. Use it to inspect a contract before scaffold_from_contract.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"Fully qualified contract id (e.g. SP….amm-pool-v2-01)\"),\n\t\t},\n\t\tasync ({ contractId }) => {\n\t\t\tconst contract = await clientProvider().contracts.get(contractId, {\n\t\t\t\tincludeAbi: true,\n\t\t\t});\n\t\t\treturn contract\n\t\t\t\t? jsonResponse(contract)\n\t\t\t\t: jsonResponse(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\ttype: \"not_found\",\n\t\t\t\t\t\t\t\tstatus: 404,\n\t\t\t\t\t\t\t\tmessage: `Contract not in registry: ${contractId}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t},\n\t);\n\n}\n",
12
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { DECODED_EVENT_TYPES } from \"@secondlayer/shared\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\nconst INDEX_EVENT_TYPES = DECODED_EVENT_TYPES;\n\n/** Filters shared by the height/cursor-paginated Index endpoints. */\nconst rangeFilters = {\n\tcontractId: z.string().optional().describe(\"Filter by contract id\"),\n\tfromHeight: z.number().optional().describe(\"Start block height (inclusive)\"),\n\ttoHeight: z.number().optional().describe(\"End block height (inclusive)\"),\n\tcursor: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Opaque cursor from a prior response's next_cursor\"),\n\tlimit: z.number().optional().describe(\"Max rows for this page\"),\n};\n\n/** Height-range subset for endpoints that don't filter by contract (blocks). */\nconst heightFilters = {\n\tfromHeight: rangeFilters.fromHeight,\n\ttoHeight: rangeFilters.toHeight,\n\tcursor: rangeFilters.cursor,\n\tlimit: rangeFilters.limit,\n};\n\nexport function registerIndexTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_ft_transfers\",\n\t\t\"List decoded SIP-010 fungible-token transfers from the Index (decoded layer). Anonymous reads allowed (free-tier API keys are rejected — Build+ required).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.ftTransfers.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tassetIdentifier?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_nft_transfers\",\n\t\t\"List decoded SIP-009 non-fungible-token transfers from the Index. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t\tassetIdentifier: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by asset identifier (contract::asset)\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.nftTransfers.list(params)),\n\t);\n\n\tdefineTool<{\n\t\teventType: (typeof INDEX_EVENT_TYPES)[number];\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tassetIdentifier?: string;\n\t\ttrait?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_events\",\n\t\t\"List decoded chain events from the Index by event type. Use this for event types without a dedicated tool (stx_*, ft_mint/burn, nft_mint/burn, print), and for trait-scoped queries: set `trait` (e.g. sip-010) to match all contracts conforming to a standard — pair with contracts_find to discover traits. For ft/nft transfers without a trait prefer index_ft_transfers / index_nft_transfers.\",\n\t\t{\n\t\t\teventType: z\n\t\t\t\t.enum(INDEX_EVENT_TYPES)\n\t\t\t\t.describe(\"Required. Decoded event type to list.\"),\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t\tassetIdentifier: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by asset identifier where applicable\"),\n\t\t\ttrait: 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\"Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only.\",\n\t\t\t\t),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.events.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tfunctionName?: string;\n\t\tsender?: string;\n\t\ttrait?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_contract_calls\",\n\t\t\"List decoded contract calls from the Index (function name, args, result). Set `trait` (e.g. sip-010) to match calls to all contracts conforming to a standard. Note: contract-call cursors are a SEPARATE keyspace from event cursors — they are not interchangeable.\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tfunctionName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by called function name\"),\n\t\t\tsender: z.string().optional().describe(\"Filter by caller principal\"),\n\t\t\ttrait: 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\"Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId.\",\n\t\t\t\t),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.contractCalls.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_blocks\",\n\t\t\"List decoded blocks from the Index. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{ ...heightFilters },\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.blocks.list(params)),\n\t);\n\n\tdefineTool<{\n\t\ttype?: string;\n\t\tsender?: string;\n\t\tcontractId?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_transactions\",\n\t\t\"List decoded transactions from the Index. Filter by type, sender, or contract. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\ttype: z.string().optional().describe(\"Filter by transaction type\"),\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.transactions.list(params)),\n\t);\n\n\tdefineTool<{ contractId: string }>(\n\t\tserver,\n\t\t\"index_print_schema\",\n\t\t\"Empirical per-topic print payload schemas for a contract, inferred from sampled on-chain events: each topic's fields with observed Clarity types, decoded TS types, subgraph column types, and presence rates. Use before writing print_event subgraph handlers to learn what's on e.data. Anonymous read.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"Contract id (SP….name) whose print events to profile\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.printSchema(params.contractId)),\n\t);\n\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"index_discover\",\n\t\t\"Discover the Index vocabulary: every event type and its columns, allowed/equality filters, and required-non-null fields (and which types accept `trait`). Read this before building Index queries instead of guessing filters. Anonymous read.\",\n\t\t{},\n\t\tasync () => jsonResponse(await clientProvider().index.discover()),\n\t);\n\n\tdefineTool<{\n\t\trequests: Array<{ path: string; params?: Record<string, string> }>;\n\t}>(\n\t\tserver,\n\t\t\"batch_query\",\n\t\t\"Run up to 10 public /v1 reads in one round trip (POST /v1/batch). Each item keeps its own auth/quota/pay-per-call semantics; results return in order with per-item status. Paths must start with /v1/index, /v1/subgraphs, /v1/streams, or /v1/contracts.\",\n\t\t{\n\t\t\trequests: z\n\t\t\t\t.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tpath: z.string().describe(\"Public /v1 read path\"),\n\t\t\t\t\t\tparams: z.record(z.string(), z.string()).optional(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.min(1)\n\t\t\t\t.max(10)\n\t\t\t\t.describe(\"Read descriptors, executed concurrently\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().batch(params.requests)),\n\t);\n}\n",
11
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\nexport function registerContractTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\n\tdefineTool<{\n\t\ttrait: string;\n\t\tconformance?: \"declared\" | \"inferred\" | \"any\";\n\t\tinclude?: \"abi\";\n\t\tlimit?: number;\n\t\tcursor?: string;\n\t}>(\n\t\tserver,\n\t\t\"contracts_find\",\n\t\t'Discover deployed Stacks contracts conforming to a trait (e.g. \"sip-010\", \"sip-009\", \"sip-013\"). The discovery endpoint for \"which contracts implement X\". Reads are public.',\n\t\t{\n\t\t\ttrait: z.string().describe('Required. Trait to match (e.g. \"sip-010\").'),\n\t\t\tconformance: z\n\t\t\t\t.enum([\"declared\", \"inferred\", \"any\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"declared = parsed from source, inferred = ABI shape-match, any = either (default)\",\n\t\t\t\t),\n\t\t\tinclude: z\n\t\t\t\t.literal(\"abi\")\n\t\t\t\t.optional()\n\t\t\t\t.describe('Set to \"abi\" to include each contract\\'s full ABI'),\n\t\t\tlimit: z.number().optional().describe(\"Page size, 1–500 (default 100)\"),\n\t\t\tcursor: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Opaque cursor from a prior response's next_cursor\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().contracts.list(params)),\n\t);\n\n\tdefineTool<{ contractId: string }>(\n\t\tserver,\n\t\t\"get_contract_abi\",\n\t\t\"Fetch a single deployed contract's ABI from the registry (prod-safe). Returns the contract's metadata + full ABI (functions, maps, variables, fungible/non-fungible tokens). Returns not_found if the contract isn't in the registry. Use it to inspect a contract before scaffold_from_contract.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"Fully qualified contract id (e.g. SP….amm-pool-v2-01)\"),\n\t\t},\n\t\tasync ({ contractId }) => {\n\t\t\tconst contract = await clientProvider().contracts.get(contractId, {\n\t\t\t\tincludeAbi: true,\n\t\t\t});\n\t\t\treturn contract\n\t\t\t\t? jsonResponse(contract)\n\t\t\t\t: jsonResponse(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\ttype: \"not_found\",\n\t\t\t\t\t\t\t\tstatus: 404,\n\t\t\t\t\t\t\t\tmessage: `Contract not in registry: ${contractId}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t},\n\t);\n}\n",
12
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { DECODED_EVENT_TYPES } from \"@secondlayer/shared\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\nconst INDEX_EVENT_TYPES = DECODED_EVENT_TYPES;\n\n/** Filters shared by the height/cursor-paginated Index endpoints. */\nconst rangeFilters = {\n\tcontractId: z.string().optional().describe(\"Filter by contract id\"),\n\tfromHeight: z.number().optional().describe(\"Start block height (inclusive)\"),\n\ttoHeight: z.number().optional().describe(\"End block height (inclusive)\"),\n\tcursor: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Opaque cursor from a prior response's next_cursor\"),\n\tlimit: z.number().optional().describe(\"Max rows for this page\"),\n};\n\n/** Height-range subset for endpoints that don't filter by contract (blocks). */\nconst heightFilters = {\n\tfromHeight: rangeFilters.fromHeight,\n\ttoHeight: rangeFilters.toHeight,\n\tcursor: rangeFilters.cursor,\n\tlimit: rangeFilters.limit,\n};\n\nexport function registerIndexTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_ft_transfers\",\n\t\t\"List decoded SIP-010 fungible-token transfers from the Index (decoded layer). Anonymous reads allowed (free-tier API keys are rejected — Build+ required).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.ftTransfers.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tassetIdentifier?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_nft_transfers\",\n\t\t\"List decoded SIP-009 non-fungible-token transfers from the Index. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t\tassetIdentifier: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by asset identifier (contract::asset)\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.nftTransfers.list(params)),\n\t);\n\n\tdefineTool<{\n\t\teventType: (typeof INDEX_EVENT_TYPES)[number];\n\t\tcontractId?: string;\n\t\tsender?: string;\n\t\trecipient?: string;\n\t\tassetIdentifier?: string;\n\t\ttrait?: string;\n\t\ttxContext?: boolean;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_events\",\n\t\t\"List decoded chain events from the Index by event type. Use this for event types without a dedicated tool (stx_*, ft_mint/burn, nft_mint/burn, print), and for trait-scoped queries: set `trait` (e.g. sip-010) to match all contracts conforming to a standard — pair with contracts_find to discover traits. For ft/nft transfers without a trait prefer index_ft_transfers / index_nft_transfers.\",\n\t\t{\n\t\t\teventType: z\n\t\t\t\t.enum(INDEX_EVENT_TYPES)\n\t\t\t\t.describe(\"Required. Decoded event type to list.\"),\n\t\t\t...rangeFilters,\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t\trecipient: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by recipient principal\"),\n\t\t\tassetIdentifier: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by asset identifier where applicable\"),\n\t\t\ttrait: 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\"Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only.\",\n\t\t\t\t),\n\t\t\ttxContext: 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\"Join the submitting transaction into each event (tx_sender, tx_type, tx_status, tx_contract_id, tx_function_name). For print events it's the only source of the submitting sender.\",\n\t\t\t\t),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.events.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tcontractId?: string;\n\t\tfunctionName?: string;\n\t\tsender?: string;\n\t\ttrait?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_contract_calls\",\n\t\t\"List decoded contract calls from the Index (function name, args, result). Set `trait` (e.g. sip-010) to match calls to all contracts conforming to a standard. Note: contract-call cursors are a SEPARATE keyspace from event cursors — they are not interchangeable.\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\tfunctionName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by called function name\"),\n\t\t\tsender: z.string().optional().describe(\"Filter by caller principal\"),\n\t\t\ttrait: 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\"Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId.\",\n\t\t\t\t),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.contractCalls.list(params)),\n\t);\n\n\tdefineTool<{\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_blocks\",\n\t\t\"List decoded blocks from the Index. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{ ...heightFilters },\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.blocks.list(params)),\n\t);\n\n\tdefineTool<{\n\t\ttype?: string;\n\t\tsender?: string;\n\t\tcontractId?: string;\n\t\tfromHeight?: number;\n\t\ttoHeight?: number;\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t}>(\n\t\tserver,\n\t\t\"index_transactions\",\n\t\t\"List decoded transactions from the Index. Filter by type, sender, or contract. Anonymous reads allowed (free-tier keys rejected).\",\n\t\t{\n\t\t\t...rangeFilters,\n\t\t\ttype: z.string().optional().describe(\"Filter by transaction type\"),\n\t\t\tsender: z.string().optional().describe(\"Filter by sender principal\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.transactions.list(params)),\n\t);\n\n\tdefineTool<{ contractId: string }>(\n\t\tserver,\n\t\t\"index_print_schema\",\n\t\t\"Empirical per-topic print payload schemas for a contract, inferred from sampled on-chain events: each topic's fields with observed Clarity types, decoded TS types, subgraph column types, and presence rates. Use before writing print_event subgraph handlers to learn what's on e.data. Anonymous read.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"Contract id (SP….name) whose print events to profile\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().index.printSchema(params.contractId)),\n\t);\n\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"index_discover\",\n\t\t\"Discover the Index vocabulary: every event type and its columns, allowed/equality filters, and required-non-null fields (and which types accept `trait`). Read this before building Index queries instead of guessing filters. Anonymous read.\",\n\t\t{},\n\t\tasync () => jsonResponse(await clientProvider().index.discover()),\n\t);\n\n\tdefineTool<{\n\t\trequests: Array<{ path: string; params?: Record<string, string> }>;\n\t}>(\n\t\tserver,\n\t\t\"batch_query\",\n\t\t\"Run up to 10 public /v1 reads in one round trip (POST /v1/batch). Each item keeps its own auth/quota/pay-per-call semantics; results return in order with per-item status. Paths must start with /v1/index, /v1/subgraphs, /v1/streams, or /v1/contracts.\",\n\t\t{\n\t\t\trequests: z\n\t\t\t\t.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tpath: z.string().describe(\"Public /v1 read path\"),\n\t\t\t\t\t\tparams: z.record(z.string(), z.string()).optional(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.min(1)\n\t\t\t\t.max(10)\n\t\t\t\t.describe(\"Read descriptors, executed concurrently\"),\n\t\t},\n\t\tasync (params) =>\n\t\t\tjsonResponse(await clientProvider().batch(params.requests)),\n\t);\n}\n",
13
13
  "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 { getClient } from \"../lib/client.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\n// Source ABIs from the platform contract registry (prod-safe). The old\n// `/api/node/contracts/:id/abi` proxy is OSS/dedicated-only and 404s in prod.\nasync function fetchAbi(\n\tclientProvider: ClientProvider,\n\tcontractId: string,\n): Promise<{ functions: AbiFunction[]; maps: AbiMap[] }> {\n\tconst contract = await clientProvider().contracts.get(contractId, {\n\t\tincludeAbi: true,\n\t});\n\tif (!contract) throw new Error(`Contract not found: ${contractId}`);\n\tconst abi = contract.abi as {\n\t\tfunctions?: AbiFunction[];\n\t\tmaps?: AbiMap[];\n\t} | null;\n\tif (!abi) {\n\t\tthrow new Error(\n\t\t\t`No ABI available for ${contractId} (abi_status: ${contract.abi_status})`,\n\t\t);\n\t}\n\treturn { functions: abi.functions ?? [], maps: abi.maps ?? [] };\n}\n\nexport function registerScaffoldTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\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(clientProvider, 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",
14
14
  "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype ClientProvider = typeof getClient;\n\nexport function registerStreamsTools(\n\tserver: McpServer,\n\tclientProvider: ClientProvider = getClient,\n) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"streams_dumps\",\n\t\t\"List the Streams bulk parquet dumps manifest — coverage range, latest_finalized_cursor, and per-file metadata (block range, row count, size, sha256, signed URL). This is the cold backfill path for downloading all raw data; fetch the file URLs directly (e.g. with DuckDB). Requires the dumps base URL to be configured (SL_STREAMS_DUMPS_URL). Live Streams reads (tip, events, consume) are REST-only: see /v1/streams/* in the OpenAPI spec.\",\n\t\t{},\n\t\tasync () => jsonResponse(await clientProvider().streams.dumps.list()),\n\t);\n}\n",
15
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { ByoBreakingChangeError } from \"@secondlayer/sdk\";\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\ntype SubgraphClientProvider = typeof getClient;\n\nexport function registerSubgraphTools(\n\tserver: McpServer,\n\tclientProvider: SubgraphClientProvider = getClient,\n) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only, including visibility — public subgraphs are anon-readable at /v1/subgraphs/<name>.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await clientProvider().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 clientProvider().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. To TAIL new rows (no streaming over MCP): sort=_id, order=desc for the latest, then poll forward with the filter {\"_id.gt\": \"<last _id seen>\"}, order=asc. Fetch one row by id with {\"_id\": \"<id>\"}. Public subgraphs are also keyless over HTTP at GET /v1/subgraphs/<name>/<table> — { rows, next_cursor, tip } envelope, resume with ?cursor=<next_cursor> + _order=asc|desc (no _offset/_sort on /v1); hand that URL to third parties.',\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 clientProvider().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 clientProvider().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. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress to completion.\",\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 clientProvider().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; fromBlock: number; toBlock: number }>(\n\t\tserver,\n\t\t\"subgraphs_backfill\",\n\t\t\"Backfill a subgraph over a block range. Non-destructive forward fill (does not drop existing data) — unlike subgraphs_reindex, and the only data-fill path for BYO subgraphs (reindex is blocked there). Both blocks required. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress.\",\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.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.describe(\"Start block (inclusive)\"),\n\t\t\ttoBlock: z.number().int().nonnegative().describe(\"End block (inclusive)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await clientProvider().subgraphs.backfill(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_stop\",\n\t\t\"Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_get (health) or the REST operations endpoint to confirm it reaches a terminal state.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.stop(name);\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<{\n\t\tname: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tresolved?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_gaps\",\n\t\t\"List indexing gaps (missing block ranges) for a subgraph. Each gap reports start/end/size, reason, and detected/resolved timestamps. Feed an unresolved gap's range into subgraphs_backfill to fill it. Defaults to unresolved gaps.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\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.optional()\n\t\t\t\t.describe(\"Max gaps to return\"),\n\t\t\toffset: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Pagination offset\"),\n\t\t\tresolved: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by resolved state (omit for unresolved only)\"),\n\t\t},\n\t\tasync ({ name, limit, offset, resolved }) => {\n\t\t\tconst result = await clientProvider().subgraphs.gaps(name, {\n\t\t\t\tlimit,\n\t\t\t\toffset,\n\t\t\t\tresolved,\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 clientProvider().subgraphs.delete(name);\n\t\t\treturn { content: [{ type: \"text\", text: result.message }] };\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tcode: string;\n\t\tstartBlock?: number;\n\t\tdatabaseUrl?: string;\n\t\tdryRun?: boolean;\n\t\tvisibility?: \"public\" | \"private\";\n\t}>(\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. Optional startBlock overrides the source definition for this deploy. Set dryRun to validate and preview the schema/DDL without writing anything. Set databaseUrl to deploy to your own Postgres (BYO data plane) — the server verifies the connection first; with dryRun it returns the DDL + grant script. A breaking BYO schema change is refused and returns a migration plan (drop + rebuild DDL) instead of deploying. Visibility defaults: managed deploys are public (anon-readable at /v1/subgraphs/<name>, name claimed in the global public namespace), BYO deploys are private. Call `subgraphs_reindex` separately if you need a forced reindex.\",\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\tstartBlock: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the definition startBlock for this deploy\"),\n\t\t\tdatabaseUrl: 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\"BYO data plane: Postgres connection string to host the subgraph's schema and rows in your own database\",\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(\n\t\t\t\t\t\"Validate and preview the deploy (schema/DDL, BYO connection) without writing changes\",\n\t\t\t\t),\n\t\t\tvisibility: z\n\t\t\t\t.enum([\"public\", \"private\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Read visibility: public = anon /v1 reads + global name claim; private = owning account's key only. Defaults: managed → public, BYO → private.\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, startBlock, databaseUrl, dryRun, visibility }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\ttry {\n\t\t\t\tconst result = await clientProvider().subgraphs.deploy({\n\t\t\t\t\tname: bundled.name,\n\t\t\t\t\tversion: bundled.version,\n\t\t\t\t\tdescription: bundled.description,\n\t\t\t\t\tsources: bundled.sources,\n\t\t\t\t\tschema: bundled.schema,\n\t\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\t\tsourceCode: code,\n\t\t\t\t\t...(startBlock !== undefined ? { startBlock } : {}),\n\t\t\t\t\t...(databaseUrl !== undefined ? { databaseUrl } : {}),\n\t\t\t\t\t...(dryRun !== undefined ? { dryRun } : {}),\n\t\t\t\t\t...(visibility !== undefined ? { visibility } : {}),\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} catch (err) {\n\t\t\t\t// A refused BYO breaking change is an actionable result, not a failure:\n\t\t\t\t// defineTool would flatten the throw to {error:{message}} and drop the\n\t\t\t\t// migration plan, so surface reasons/diff/plan as a normal result.\n\t\t\t\tif (err instanceof ByoBreakingChangeError) {\n\t\t\t\t\treturn {\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{ byoBreakingChange: true, ...err.details },\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 }>(\n\t\tserver,\n\t\t\"subgraphs_publish\",\n\t\t\"Make a subgraph publicly readable at /v1/subgraphs/<name> — anyone (or any agent) can read it without a key. Claims the name in the global public namespace; fails with PUBLIC_NAME_TAKEN if another account holds it.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.publish(name);\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_unpublish\",\n\t\t\"Make a subgraph private again — /v1 reads then require the owning account's bearer key, and the global public name claim is released.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.unpublish(name);\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}\n",
16
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type {\n\tChainTrigger,\n\tCreateSubscriptionRequest,\n\tUpdateSubscriptionRequest,\n} from \"@secondlayer/sdk\";\nimport { CHAIN_TRIGGER_TYPES } from \"@secondlayer/shared\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype SubscriptionClientProvider = typeof getClient;\n\n/**\n * Subscription MCP tools — let agents list, configure, test, and replay\n * subgraph event subscriptions. Mirrors the HTTP API 1:1; structured\n * errors bubble through the SDK's ApiError.\n */\nexport function registerSubscriptionTools(\n\tserver: McpServer,\n\tclientProvider: SubscriptionClientProvider = getClient,\n) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subscriptions_list\",\n\t\t\"List all subscriptions for the current account. Returns summary fields (no secrets).\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await clientProvider().subscriptions.list();\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(data, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_get\",\n\t\t\"Get full detail for a subscription (filter, auth, retry config, circuit state).\",\n\t\t{ id: z.string().describe(\"Subscription id\") },\n\t\tasync ({ id }) => {\n\t\t\tconst detail = await clientProvider().subscriptions.get(id);\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\tsubgraphName?: string;\n\t\ttableName?: string;\n\t\ttriggers?: ChainTrigger[];\n\t\turl: string;\n\t\tformat?:\n\t\t\t| \"standard-webhooks\"\n\t\t\t| \"inngest\"\n\t\t\t| \"trigger\"\n\t\t\t| \"cloudflare\"\n\t\t\t| \"cloudevents\"\n\t\t\t| \"raw\";\n\t\truntime?: \"inngest\" | \"trigger\" | \"cloudflare\" | \"node\";\n\t\tfilter?: Record<string, unknown>;\n\t\tauthConfig?: Record<string, unknown>;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_create\",\n\t\t\"Create a subscription. Two kinds (mutually exclusive): a SUBGRAPH subscription fires on a subgraph table's rows (set subgraphName + tableName + optional filter); a CHAIN subscription fires on raw chain events with no subgraph (set triggers). Returns `signingSecret` ONCE — forward it to the user so they can wire it into their receiver.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Human-readable name, unique per account\"),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Subgraph to subscribe to (subgraph subscription)\"),\n\t\t\ttableName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Table within the subgraph (subgraph subscription)\"),\n\t\t\ttriggers: z\n\t\t\t\t.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.enum(CHAIN_TRIGGER_TYPES),\n\t\t\t\t\t\tcontractId: z.string().optional(),\n\t\t\t\t\t\tfunctionName: z.string().optional(),\n\t\t\t\t\t\tcaller: z.string().optional(),\n\t\t\t\t\t\tsender: z.string().optional(),\n\t\t\t\t\t\trecipient: z.string().optional(),\n\t\t\t\t\t\tassetIdentifier: z.string().optional(),\n\t\t\t\t\t\tdeployer: z.string().optional(),\n\t\t\t\t\t\tcontractName: z.string().optional(),\n\t\t\t\t\t\ttopic: z.string().optional(),\n\t\t\t\t\t\tlockedAddress: z.string().optional(),\n\t\t\t\t\t\ttrait: z.string().optional(),\n\t\t\t\t\t\tminAmount: z.union([z.string(), z.number()]).optional(),\n\t\t\t\t\t\tmaxAmount: z.union([z.string(), z.number()]).optional(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Chain triggers (chain subscription) — provide INSTEAD of subgraphName/tableName. Each targets a raw chain event/tx; string fields accept `*` wildcards, `trait` scopes to a SIP/trait. Per-type accepted fields: see the secondlayer://chain-triggers resource. Forward-looking: starts at chain tip, no backfill.\",\n\t\t\t\t),\n\t\t\turl: z.string().describe(\"Webhook URL\"),\n\t\t\tformat: z\n\t\t\t\t.enum([\n\t\t\t\t\t\"standard-webhooks\",\n\t\t\t\t\t\"inngest\",\n\t\t\t\t\t\"trigger\",\n\t\t\t\t\t\"cloudflare\",\n\t\t\t\t\t\"cloudevents\",\n\t\t\t\t\t\"raw\",\n\t\t\t\t])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Wire format (default standard-webhooks)\"),\n\t\t\truntime: z\n\t\t\t\t.enum([\"inngest\", \"trigger\", \"cloudflare\", \"node\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Receiver runtime label (display only)\"),\n\t\t\tfilter: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Scalar filter DSL, e.g. {\"amount\": {\"gte\": 100}, \"sender\": \"SP...\"}',\n\t\t\t\t),\n\t\t\tauthConfig: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Receiver auth sent with each delivery, e.g. {\"type\": \"bearer\", \"token\": \"...\"}',\n\t\t\t\t),\n\t\t},\n\t\tasync (input) => {\n\t\t\tconst res = await clientProvider().subscriptions.create(\n\t\t\t\tinput as CreateSubscriptionRequest,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(res, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tid: string;\n\t\tname?: string;\n\t\turl?: string;\n\t\tfilter?: Record<string, unknown>;\n\t\tauthConfig?: Record<string, unknown>;\n\t\tformat?:\n\t\t\t| \"standard-webhooks\"\n\t\t\t| \"inngest\"\n\t\t\t| \"trigger\"\n\t\t\t| \"cloudflare\"\n\t\t\t| \"cloudevents\"\n\t\t\t| \"raw\";\n\t\truntime?: \"inngest\" | \"trigger\" | \"cloudflare\" | \"node\" | null;\n\t\tmaxRetries?: number;\n\t\ttimeoutMs?: number;\n\t\tconcurrency?: number;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_update\",\n\t\t\"Patch a subscription (name, url, filter, authConfig, format, runtime, retry, timeout, concurrency).\",\n\t\t{\n\t\t\tid: z.string(),\n\t\t\tname: z.string().optional().describe(\"Rename the subscription\"),\n\t\t\turl: z.string().optional(),\n\t\t\tfilter: z.record(z.string(), z.unknown()).optional(),\n\t\t\tauthConfig: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Receiver auth sent with each delivery (bearer/etc.)\"),\n\t\t\tformat: z\n\t\t\t\t.enum([\n\t\t\t\t\t\"standard-webhooks\",\n\t\t\t\t\t\"inngest\",\n\t\t\t\t\t\"trigger\",\n\t\t\t\t\t\"cloudflare\",\n\t\t\t\t\t\"cloudevents\",\n\t\t\t\t\t\"raw\",\n\t\t\t\t])\n\t\t\t\t.optional(),\n\t\t\truntime: z\n\t\t\t\t.enum([\"inngest\", \"trigger\", \"cloudflare\", \"node\"])\n\t\t\t\t.nullable()\n\t\t\t\t.optional(),\n\t\t\tmaxRetries: z.number().int().min(0).optional(),\n\t\t\ttimeoutMs: z.number().int().min(100).optional(),\n\t\t\tconcurrency: z.number().int().min(1).optional(),\n\t\t},\n\t\tasync ({ id, ...patch }) => {\n\t\t\tconst res = await clientProvider().subscriptions.update(\n\t\t\t\tid,\n\t\t\t\tpatch as UpdateSubscriptionRequest,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(res, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_delete\",\n\t\t\"Delete a subscription. Pending outbox rows are cascade-deleted.\",\n\t\t{ id: z.string() },\n\t\tasync ({ id }) => {\n\t\t\tconst res = await clientProvider().subscriptions.delete(id);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(res, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_test\",\n\t\t\"Send a one-off test webhook to a subscription's URL (built for its format, SSRF-guarded). Logged as a delivery row. Returns {ok, statusCode, error, durationMs, deliveryId}.\",\n\t\t{ id: z.string().describe(\"Subscription id\") },\n\t\tasync ({ id }) => {\n\t\t\tconst res = await clientProvider().subscriptions.test(id);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(res, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tid: string;\n\t\tfromBlock: number;\n\t\ttoBlock: number;\n\t\tforce?: string;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_replay\",\n\t\t\"Replay a block range for a subscription. Replays run at 10% of batch capacity — use sparingly. Pass `force` (a short idempotency suffix) to re-run a range that was already replayed.\",\n\t\t{\n\t\t\tid: z.string(),\n\t\t\tfromBlock: z.number().int().nonnegative(),\n\t\t\ttoBlock: z.number().int().nonnegative(),\n\t\t\tforce: 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\"Idempotency suffix to force a duplicate replay of the range\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ id, fromBlock, toBlock, force }) => {\n\t\t\tconst res = await clientProvider().subscriptions.replay(id, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t\t...(force !== undefined ? { force } : {}),\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(res, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n}\n"
15
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { ByoBreakingChangeError } from \"@secondlayer/sdk\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport {\n\tformatSubgraphSummary,\n\tjsonResponse,\n\ttextResponse,\n\twithCap,\n} from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype SubgraphClientProvider = typeof getClient;\n\nexport function registerSubgraphTools(\n\tserver: McpServer,\n\tclientProvider: SubgraphClientProvider = getClient,\n) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only, including visibility — public subgraphs are anon-readable at /v1/subgraphs/<name>.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await clientProvider().subgraphs.list();\n\t\t\treturn jsonResponse(data.map(formatSubgraphSummary));\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 clientProvider().subgraphs.get(name);\n\t\t\treturn jsonResponse(detail);\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. To TAIL new rows (no streaming over MCP): sort=_id, order=desc for the latest, then poll forward with the filter {\"_id.gt\": \"<last _id seen>\"}, order=asc. Fetch one row by id with {\"_id\": \"<id>\"}. Public subgraphs are also keyless over HTTP at GET /v1/subgraphs/<name>/<table> — { rows, next_cursor, tip } envelope, resume with ?cursor=<next_cursor> + _order=asc|desc (no _offset/_sort on /v1); hand that URL to third parties.',\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 clientProvider().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 jsonResponse(result);\n\t\t\t}\n\t\t\tconst rows = await clientProvider().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 result = withCap(\n\t\t\t\trows as Record<string, unknown>[],\n\t\t\t\tMath.min(limit ?? 50, 200),\n\t\t\t);\n\t\t\treturn jsonResponse(result);\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. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress to completion.\",\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 clientProvider().subgraphs.reindex(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; fromBlock: number; toBlock: number }>(\n\t\tserver,\n\t\t\"subgraphs_backfill\",\n\t\t\"Backfill a subgraph over a block range. Non-destructive forward fill (does not drop existing data) — unlike subgraphs_reindex, and the only data-fill path for BYO subgraphs (reindex is blocked there). Both blocks required. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress.\",\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.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.describe(\"Start block (inclusive)\"),\n\t\t\ttoBlock: z.number().int().nonnegative().describe(\"End block (inclusive)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await clientProvider().subgraphs.backfill(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_stop\",\n\t\t\"Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_get (health) or the REST operations endpoint to confirm it reaches a terminal state.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.stop(name);\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tresolved?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_gaps\",\n\t\t\"List indexing gaps (missing block ranges) for a subgraph. Each gap reports start/end/size, reason, and detected/resolved timestamps. Feed an unresolved gap's range into subgraphs_backfill to fill it. Defaults to unresolved gaps.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\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.optional()\n\t\t\t\t.describe(\"Max gaps to return\"),\n\t\t\toffset: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Pagination offset\"),\n\t\t\tresolved: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by resolved state (omit for unresolved only)\"),\n\t\t},\n\t\tasync ({ name, limit, offset, resolved }) => {\n\t\t\tconst result = await clientProvider().subgraphs.gaps(name, {\n\t\t\t\tlimit,\n\t\t\t\toffset,\n\t\t\t\tresolved,\n\t\t\t});\n\t\t\treturn jsonResponse(result);\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 clientProvider().subgraphs.delete(name);\n\t\t\treturn textResponse(result.message);\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tcode: string;\n\t\tstartBlock?: number;\n\t\tdatabaseUrl?: string;\n\t\tdryRun?: boolean;\n\t\tvisibility?: \"public\" | \"private\";\n\t}>(\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. Optional startBlock overrides the source definition for this deploy. Set dryRun to validate and preview the schema/DDL without writing anything. Set databaseUrl to deploy to your own Postgres (BYO data plane) — the server verifies the connection first; with dryRun it returns the DDL + grant script. A breaking BYO schema change is refused and returns a migration plan (drop + rebuild DDL) instead of deploying. Visibility defaults: managed deploys are public (anon-readable at /v1/subgraphs/<name>, name claimed in the global public namespace), BYO deploys are private. Call `subgraphs_reindex` separately if you need a forced reindex.\",\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\tstartBlock: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.nonnegative()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the definition startBlock for this deploy\"),\n\t\t\tdatabaseUrl: 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\"BYO data plane: Postgres connection string to host the subgraph's schema and rows in your own database\",\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(\n\t\t\t\t\t\"Validate and preview the deploy (schema/DDL, BYO connection) without writing changes\",\n\t\t\t\t),\n\t\t\tvisibility: z\n\t\t\t\t.enum([\"public\", \"private\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Read visibility: public = anon /v1 reads + global name claim; private = owning account's key only. Defaults: managed → public, BYO → private.\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, startBlock, databaseUrl, dryRun, visibility }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\ttry {\n\t\t\t\tconst result = await clientProvider().subgraphs.deploy({\n\t\t\t\t\tname: bundled.name,\n\t\t\t\t\tversion: bundled.version,\n\t\t\t\t\tdescription: bundled.description,\n\t\t\t\t\tsources: bundled.sources,\n\t\t\t\t\tschema: bundled.schema,\n\t\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\t\tsourceCode: code,\n\t\t\t\t\t...(startBlock !== undefined ? { startBlock } : {}),\n\t\t\t\t\t...(databaseUrl !== undefined ? { databaseUrl } : {}),\n\t\t\t\t\t...(dryRun !== undefined ? { dryRun } : {}),\n\t\t\t\t\t...(visibility !== undefined ? { visibility } : {}),\n\t\t\t\t});\n\t\t\t\treturn jsonResponse(result);\n\t\t\t} catch (err) {\n\t\t\t\t// A refused BYO breaking change is an actionable result, not a failure:\n\t\t\t\t// defineTool would flatten the throw to {error:{message}} and drop the\n\t\t\t\t// migration plan, so surface reasons/diff/plan as a normal result.\n\t\t\t\tif (err instanceof ByoBreakingChangeError) {\n\t\t\t\t\treturn jsonResponse({ byoBreakingChange: true, ...err.details });\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 }>(\n\t\tserver,\n\t\t\"subgraphs_publish\",\n\t\t\"Make a subgraph publicly readable at /v1/subgraphs/<name> — anyone (or any agent) can read it without a key. Claims the name in the global public namespace; fails with PUBLIC_NAME_TAKEN if another account holds it.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.publish(name);\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_unpublish\",\n\t\t\"Make a subgraph private again — /v1 reads then require the owning account's bearer key, and the global public name claim is released.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await clientProvider().subgraphs.unpublish(name);\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n}\n",
16
+ "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type {\n\tChainTrigger,\n\tCreateSubscriptionRequest,\n\tUpdateSubscriptionRequest,\n} from \"@secondlayer/sdk\";\nimport { CHAIN_TRIGGER_TYPES } from \"@secondlayer/shared\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\ntype SubscriptionClientProvider = typeof getClient;\n\n/**\n * Subscription MCP tools — let agents list, configure, test, and replay\n * subgraph event subscriptions. Mirrors the HTTP API 1:1; structured\n * errors bubble through the SDK's ApiError.\n */\nexport function registerSubscriptionTools(\n\tserver: McpServer,\n\tclientProvider: SubscriptionClientProvider = getClient,\n) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subscriptions_list\",\n\t\t\"List all subscriptions for the current account. Returns summary fields (no secrets).\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await clientProvider().subscriptions.list();\n\t\t\treturn jsonResponse(data);\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_get\",\n\t\t\"Get full detail for a subscription (filter, auth, retry config, circuit state).\",\n\t\t{ id: z.string().describe(\"Subscription id\") },\n\t\tasync ({ id }) => {\n\t\t\tconst detail = await clientProvider().subscriptions.get(id);\n\t\t\treturn jsonResponse(detail);\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\tsubgraphName?: string;\n\t\ttableName?: string;\n\t\ttriggers?: ChainTrigger[];\n\t\turl: string;\n\t\tformat?:\n\t\t\t| \"standard-webhooks\"\n\t\t\t| \"inngest\"\n\t\t\t| \"trigger\"\n\t\t\t| \"cloudflare\"\n\t\t\t| \"cloudevents\"\n\t\t\t| \"raw\";\n\t\truntime?: \"inngest\" | \"trigger\" | \"cloudflare\" | \"node\";\n\t\tfilter?: Record<string, unknown>;\n\t\tauthConfig?: Record<string, unknown>;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_create\",\n\t\t\"Create a subscription. Two kinds (mutually exclusive): a SUBGRAPH subscription fires on a subgraph table's rows (set subgraphName + tableName + optional filter); a CHAIN subscription fires on raw chain events with no subgraph (set triggers). Returns `signingSecret` ONCE — forward it to the user so they can wire it into their receiver.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Human-readable name, unique per account\"),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Subgraph to subscribe to (subgraph subscription)\"),\n\t\t\ttableName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Table within the subgraph (subgraph subscription)\"),\n\t\t\ttriggers: z\n\t\t\t\t.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.enum(CHAIN_TRIGGER_TYPES),\n\t\t\t\t\t\tcontractId: z.string().optional(),\n\t\t\t\t\t\tfunctionName: z.string().optional(),\n\t\t\t\t\t\tcaller: z.string().optional(),\n\t\t\t\t\t\tsender: z.string().optional(),\n\t\t\t\t\t\trecipient: z.string().optional(),\n\t\t\t\t\t\tassetIdentifier: z.string().optional(),\n\t\t\t\t\t\tdeployer: z.string().optional(),\n\t\t\t\t\t\tcontractName: z.string().optional(),\n\t\t\t\t\t\ttopic: z.string().optional(),\n\t\t\t\t\t\tlockedAddress: z.string().optional(),\n\t\t\t\t\t\ttrait: z.string().optional(),\n\t\t\t\t\t\tminAmount: z.union([z.string(), z.number()]).optional(),\n\t\t\t\t\t\tmaxAmount: z.union([z.string(), z.number()]).optional(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Chain triggers (chain subscription) — provide INSTEAD of subgraphName/tableName. Each targets a raw chain event/tx; string fields accept `*` wildcards, `trait` scopes to a SIP/trait. Per-type accepted fields: see the secondlayer://chain-triggers resource. Forward-looking: starts at chain tip, no backfill.\",\n\t\t\t\t),\n\t\t\turl: z.string().describe(\"Webhook URL\"),\n\t\t\tformat: z\n\t\t\t\t.enum([\n\t\t\t\t\t\"standard-webhooks\",\n\t\t\t\t\t\"inngest\",\n\t\t\t\t\t\"trigger\",\n\t\t\t\t\t\"cloudflare\",\n\t\t\t\t\t\"cloudevents\",\n\t\t\t\t\t\"raw\",\n\t\t\t\t])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Wire format (default standard-webhooks)\"),\n\t\t\truntime: z\n\t\t\t\t.enum([\"inngest\", \"trigger\", \"cloudflare\", \"node\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Receiver runtime label (display only)\"),\n\t\t\tfilter: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Scalar filter DSL, e.g. {\"amount\": {\"gte\": 100}, \"sender\": \"SP...\"}',\n\t\t\t\t),\n\t\t\tauthConfig: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Receiver auth sent with each delivery, e.g. {\"type\": \"bearer\", \"token\": \"...\"}',\n\t\t\t\t),\n\t\t},\n\t\tasync (input) => {\n\t\t\tconst res = await clientProvider().subscriptions.create(\n\t\t\t\tinput as CreateSubscriptionRequest,\n\t\t\t);\n\t\t\treturn jsonResponse(res);\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tid: string;\n\t\tname?: string;\n\t\turl?: string;\n\t\tfilter?: Record<string, unknown>;\n\t\tauthConfig?: Record<string, unknown>;\n\t\tformat?:\n\t\t\t| \"standard-webhooks\"\n\t\t\t| \"inngest\"\n\t\t\t| \"trigger\"\n\t\t\t| \"cloudflare\"\n\t\t\t| \"cloudevents\"\n\t\t\t| \"raw\";\n\t\truntime?: \"inngest\" | \"trigger\" | \"cloudflare\" | \"node\" | null;\n\t\tmaxRetries?: number;\n\t\ttimeoutMs?: number;\n\t\tconcurrency?: number;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_update\",\n\t\t\"Patch a subscription (name, url, filter, authConfig, format, runtime, retry, timeout, concurrency).\",\n\t\t{\n\t\t\tid: z.string(),\n\t\t\tname: z.string().optional().describe(\"Rename the subscription\"),\n\t\t\turl: z.string().optional(),\n\t\t\tfilter: z.record(z.string(), z.unknown()).optional(),\n\t\t\tauthConfig: z\n\t\t\t\t.record(z.string(), z.unknown())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Receiver auth sent with each delivery (bearer/etc.)\"),\n\t\t\tformat: z\n\t\t\t\t.enum([\n\t\t\t\t\t\"standard-webhooks\",\n\t\t\t\t\t\"inngest\",\n\t\t\t\t\t\"trigger\",\n\t\t\t\t\t\"cloudflare\",\n\t\t\t\t\t\"cloudevents\",\n\t\t\t\t\t\"raw\",\n\t\t\t\t])\n\t\t\t\t.optional(),\n\t\t\truntime: z\n\t\t\t\t.enum([\"inngest\", \"trigger\", \"cloudflare\", \"node\"])\n\t\t\t\t.nullable()\n\t\t\t\t.optional(),\n\t\t\tmaxRetries: z.number().int().min(0).optional(),\n\t\t\ttimeoutMs: z.number().int().min(100).optional(),\n\t\t\tconcurrency: z.number().int().min(1).optional(),\n\t\t},\n\t\tasync ({ id, ...patch }) => {\n\t\t\tconst res = await clientProvider().subscriptions.update(\n\t\t\t\tid,\n\t\t\t\tpatch as UpdateSubscriptionRequest,\n\t\t\t);\n\t\t\treturn jsonResponse(res);\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_delete\",\n\t\t\"Delete a subscription. Pending outbox rows are cascade-deleted.\",\n\t\t{ id: z.string() },\n\t\tasync ({ id }) => {\n\t\t\tconst res = await clientProvider().subscriptions.delete(id);\n\t\t\treturn jsonResponse(res);\n\t\t},\n\t);\n\n\tdefineTool<{ id: string }>(\n\t\tserver,\n\t\t\"subscriptions_test\",\n\t\t\"Send a one-off test webhook to a subscription's URL (built for its format, SSRF-guarded). Logged as a delivery row. Returns {ok, statusCode, error, durationMs, deliveryId}.\",\n\t\t{ id: z.string().describe(\"Subscription id\") },\n\t\tasync ({ id }) => {\n\t\t\tconst res = await clientProvider().subscriptions.test(id);\n\t\t\treturn jsonResponse(res);\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tid: string;\n\t\tfromBlock: number;\n\t\ttoBlock: number;\n\t\tforce?: string;\n\t}>(\n\t\tserver,\n\t\t\"subscriptions_replay\",\n\t\t\"Replay a block range for a subscription. Replays run at 10% of batch capacity — use sparingly. Pass `force` (a short idempotency suffix) to re-run a range that was already replayed.\",\n\t\t{\n\t\t\tid: z.string(),\n\t\t\tfromBlock: z.number().int().nonnegative(),\n\t\t\ttoBlock: z.number().int().nonnegative(),\n\t\t\tforce: 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\"Idempotency suffix to force a duplicate replay of the range\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ id, fromBlock, toBlock, force }) => {\n\t\t\tconst res = await clientProvider().subscriptions.replay(id, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t\t...(force !== undefined ? { force } : {}),\n\t\t\t});\n\t\t\treturn jsonResponse(res);\n\t\t},\n\t);\n}\n"
17
17
  ],
18
- "mappings": ";AAAA;AACA;AACA;AACA;;;ACFA;AACA;AACA;;;ACHA;AACA;AAEA,IAAI,WAA+B;AAOnC,SAAS,UAAU,GAAuB;AAAA,EACzC,OAAO,QAAQ,IAAI;AAAA;AAepB,SAAS,cAAc,GAA6B;AAAA,EACnD,MAAM,MAAM,QAAQ,IAAI;AAAA,EACxB,IAAI,CAAC;AAAA,IAAK;AAAA,EACV,MAAM,UAAU,oBAAoB,GAAG;AAAA,EAIvC,MAAM,WAAW,OAAO,QAAQ,IAAI,kBAAkB,EAAE;AAAA,EACxD,MAAM,OAAO,SAAS,OAAO;AAAA,IAC5B;AAAA,OACI,OAAO,SAAS,QAAQ,KAAK,WAAW,IACzC;AAAA,MACA,OAAO;AAAA,QACN,KAAK;AAAA,QACL,WAAW,OAAO,QAAQ,IAAI,yBAAyB,KAAK;AAAA,MAC7D;AAAA,IACD,IACC,CAAC;AAAA,EACL,CAAC;AAAA,EACD,MAAM,UAAU,OAAO,OAAqB,SAAuB;AAAA,IAClE,MAAM,MAAM,MAAM,KAAK,OAAO,IAAI;AAAA,IAClC,MAAM,UAAU,gBAAgB,GAAG;AAAA,IACnC,IAAI,SAAS;AAAA,MACZ,QAAQ,MACP,iCAAiC,QAAQ,SAAS,oBAAoB,QAAQ,MAC/E;AAAA,IACD;AAAA,IACA,OAAO;AAAA;AAAA,EAIR,OAAO;AAAA;A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AmB,MAAM;AAAA,EACzB,qBAAqB,MAAM;AAAA,EAC3B,sBAAsB,MAAM;AAAA,EAC5B,kBAAkB,MAAM;AAAA,EAExB,OAAO;AAAA;",
19
+ "debugId": "26696E4DD72BCA8964756E2164756E21",
20
20
  "names": []
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/mcp",
3
- "version": "4.1.1",
3
+ "version": "4.2.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,10 +23,7 @@
23
23
  "import": "./dist/index.js"
24
24
  }
25
25
  },
26
- "files": [
27
- "dist",
28
- "README.md"
29
- ],
26
+ "files": ["dist", "README.md"],
30
27
  "scripts": {
31
28
  "build": "bunup",
32
29
  "dev": "bunup --watch",
@@ -38,7 +35,7 @@
38
35
  "@modelcontextprotocol/sdk": "^1.27.1",
39
36
  "@secondlayer/bundler": "^0.3.7",
40
37
  "@secondlayer/scaffold": "^1.3.0",
41
- "@secondlayer/sdk": "^6.23.0",
38
+ "@secondlayer/sdk": "^6.26.0",
42
39
  "@secondlayer/shared": "^6.32.0",
43
40
  "@secondlayer/stacks": "^2.5.1",
44
41
  "@secondlayer/subgraphs": "^3.14.0",