@skeinlabs/mcp 0.1.0 → 0.2.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/dist/server.js CHANGED
@@ -3,10 +3,13 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { SkeinError } from "@skeinlabs/sdk";
4
4
  import { z } from "zod";
5
5
  var CHAINS = { ethereum: 1, base: 8453, bsc: 56, bnb: 56, arbitrum: 42161 };
6
- var chainId = z.union([z.number().int(), z.enum(Object.keys(CHAINS))]).describe("EVM chain: 1 / ethereum, 8453 / base, 56 / bsc, 42161 / arbitrum");
6
+ var chainId = z.preprocess(
7
+ (v) => typeof v === "number" ? String(v) : typeof v === "string" ? v.trim().toLowerCase() : v,
8
+ z.string().refine((s) => s in CHAINS || /^\d+$/.test(s), { message: "a chain name (ethereum, base, bsc, arbitrum) or a numeric chain id" })
9
+ ).describe('EVM chain: "base", "ethereum", "bsc", "arbitrum", or its id ("8453", "1", "56", "42161")');
7
10
  var token = z.string().regex(/^0x[0-9a-fA-F]{40}$/).describe("Token contract address (0x + 40 hex)");
8
11
  var policy = z.string().optional().describe('Policy id or id@version, e.g. "dex-list" or "dex-list@0.1.0"');
9
- var toChain = (c) => typeof c === "number" ? c : CHAINS[c];
12
+ var toChain = (c) => c in CHAINS ? CHAINS[c] : Number(c);
10
13
  var text = (s) => [{ type: "text", text: s }];
11
14
  var fail = (e) => ({
12
15
  isError: true,
@@ -22,11 +25,12 @@ function describeVerdict(v, link) {
22
25
  const paid = v.payment.rail === "telegraph" ? `paid ${v.payment.amountUsdc} USDC through Telegraph (receipt ${v.payment.receiptHash ?? "none"})` : "paid with a Skein partner key";
23
26
  lines.push(`Upstream cost ${v.cost.upstreamUsdc} USDC across ${v.bom.items} receipts; ${paid}.`);
24
27
  lines.push(`Verdict hash ${v.verdictHash}. Verify: ${link}`);
28
+ if (v.attestation) lines.push(`Signed by Skein (${v.attestation.signer}, EIP-191): ${v.attestation.signature}`);
25
29
  if (v.network === "simulated") lines.push("SIMULATED: canned answers, not evidence.");
26
30
  return lines.join("\n");
27
31
  }
28
32
  function createSkeinMcp(opts) {
29
- const server = new McpServer({ name: "skein", version: "0.1.0" });
33
+ const server = new McpServer({ name: "skein", version: "0.2.0" });
30
34
  const web = opts.webUrl.replace(/\/$/, "");
31
35
  let spent = 0;
32
36
  server.registerTool(
@@ -69,6 +73,7 @@ function createSkeinMcp(opts) {
69
73
  payment: v.payment,
70
74
  verdictHash: v.verdictHash,
71
75
  bomRoot: v.bom.root,
76
+ ...v.attestation ? { attestation: v.attestation } : {},
72
77
  network: v.network,
73
78
  link
74
79
  }
package/dist/skein-mcp.js CHANGED
@@ -10,10 +10,13 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
10
  import { SkeinError } from "@skeinlabs/sdk";
11
11
  import { z } from "zod";
12
12
  var CHAINS = { ethereum: 1, base: 8453, bsc: 56, bnb: 56, arbitrum: 42161 };
13
- var chainId = z.union([z.number().int(), z.enum(Object.keys(CHAINS))]).describe("EVM chain: 1 / ethereum, 8453 / base, 56 / bsc, 42161 / arbitrum");
13
+ var chainId = z.preprocess(
14
+ (v) => typeof v === "number" ? String(v) : typeof v === "string" ? v.trim().toLowerCase() : v,
15
+ z.string().refine((s) => s in CHAINS || /^\d+$/.test(s), { message: "a chain name (ethereum, base, bsc, arbitrum) or a numeric chain id" })
16
+ ).describe('EVM chain: "base", "ethereum", "bsc", "arbitrum", or its id ("8453", "1", "56", "42161")');
14
17
  var token = z.string().regex(/^0x[0-9a-fA-F]{40}$/).describe("Token contract address (0x + 40 hex)");
15
18
  var policy = z.string().optional().describe('Policy id or id@version, e.g. "dex-list" or "dex-list@0.1.0"');
16
- var toChain = (c) => typeof c === "number" ? c : CHAINS[c];
19
+ var toChain = (c) => c in CHAINS ? CHAINS[c] : Number(c);
17
20
  var text = (s) => [{ type: "text", text: s }];
18
21
  var fail = (e) => ({
19
22
  isError: true,
@@ -29,11 +32,12 @@ function describeVerdict(v, link) {
29
32
  const paid = v.payment.rail === "telegraph" ? `paid ${v.payment.amountUsdc} USDC through Telegraph (receipt ${v.payment.receiptHash ?? "none"})` : "paid with a Skein partner key";
30
33
  lines.push(`Upstream cost ${v.cost.upstreamUsdc} USDC across ${v.bom.items} receipts; ${paid}.`);
31
34
  lines.push(`Verdict hash ${v.verdictHash}. Verify: ${link}`);
35
+ if (v.attestation) lines.push(`Signed by Skein (${v.attestation.signer}, EIP-191): ${v.attestation.signature}`);
32
36
  if (v.network === "simulated") lines.push("SIMULATED: canned answers, not evidence.");
33
37
  return lines.join("\n");
34
38
  }
35
39
  function createSkeinMcp(opts) {
36
- const server2 = new McpServer({ name: "skein", version: "0.1.0" });
40
+ const server2 = new McpServer({ name: "skein", version: "0.2.0" });
37
41
  const web = opts.webUrl.replace(/\/$/, "");
38
42
  let spent = 0;
39
43
  server2.registerTool(
@@ -76,6 +80,7 @@ function createSkeinMcp(opts) {
76
80
  payment: v.payment,
77
81
  verdictHash: v.verdictHash,
78
82
  bomRoot: v.bom.root,
83
+ ...v.attestation ? { attestation: v.attestation } : {},
79
84
  network: v.network,
80
85
  link
81
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeinlabs/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Skein as an MCP server for LLM agents (Claude, Cursor, any MCP client): skein_verdict, skein_quote and skein_verify, with a per-call and per-session spend cap.",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "@modelcontextprotocol/sdk": "1.32.1",
17
17
  "viem": "2.57.5",
18
18
  "zod": "3.25.76",
19
- "@skeinlabs/sdk": "^0.1.0"
19
+ "@skeinlabs/sdk": "^0.2.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "tsup": "8.5.0",