bsv-mcp 0.2.7 → 0.2.9

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
@@ -86255,7 +86255,7 @@ var package_default = {
86255
86255
  name: "bsv-mcp",
86256
86256
  module: "dist/index.js",
86257
86257
  type: "module",
86258
- version: "0.2.7",
86258
+ version: "0.2.8",
86259
86259
  license: "MIT",
86260
86260
  author: "satchmo",
86261
86261
  description: "A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) framework",
@@ -86276,6 +86276,7 @@ var package_default = {
86276
86276
  ],
86277
86277
  files: [
86278
86278
  "dist/**/*.js",
86279
+ "dist/**/*.html",
86279
86280
  "package.json",
86280
86281
  "*.ts",
86281
86282
  "tools/*.ts",
@@ -90657,7 +90658,7 @@ var createPostArgsSchema = exports_external.object({
90657
90658
  content: exports_external.string().describe("The content of the post"),
90658
90659
  contentType: exports_external.enum(["text/plain", "text/markdown"]).default("text/plain").describe("Content type of the post"),
90659
90660
  app: exports_external.string().default("bsv-mcp").describe("Application name creating the post"),
90660
- additionalMapData: exports_external.record(exports_external.string()).optional().describe("Additional MAP protocol key-value pairs")
90661
+ additionalMapData: exports_external.string().optional().describe(`Additional MAP protocol key-value pairs as a JSON object string, e.g. '{"key": "value"}'`)
90661
90662
  });
90662
90663
  async function createSocialPost(args, wallet3) {
90663
90664
  try {
@@ -90688,7 +90689,8 @@ async function createSocialPost(args, wallet3) {
90688
90689
  toArray8("post", "utf8")
90689
90690
  ];
90690
90691
  if (additionalMapData) {
90691
- for (const [key, value] of Object.entries(additionalMapData)) {
90692
+ const parsedMapData = JSON.parse(additionalMapData);
90693
+ for (const [key, value] of Object.entries(parsedMapData)) {
90692
90694
  mapData.push(toArray8(key, "utf8"), toArray8(value, "utf8"));
90693
90695
  }
90694
90696
  }
@@ -123699,7 +123701,7 @@ var package_default2 = {
123699
123701
  name: "bsv-mcp",
123700
123702
  module: "dist/index.js",
123701
123703
  type: "module",
123702
- version: "0.2.7",
123704
+ version: "0.2.8",
123703
123705
  license: "MIT",
123704
123706
  author: "satchmo",
123705
123707
  description: "A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) framework",
@@ -123720,6 +123722,7 @@ var package_default2 = {
123720
123722
  ],
123721
123723
  files: [
123722
123724
  "dist/**/*.js",
123725
+ "dist/**/*.html",
123723
123726
  "package.json",
123724
123727
  "*.ts",
123725
123728
  "tools/*.ts",
@@ -124432,7 +124435,7 @@ var mintCollectionArgsSchema = exports_external.object({
124432
124435
  label: exports_external.string(),
124433
124436
  percentage: exports_external.number().min(0).max(100)
124434
124437
  })).optional().describe("Rarity labels and their percentages"),
124435
- traits: exports_external.record(exports_external.array(exports_external.string())).optional().describe("Collection traits as key-value pairs where values are arrays of possible trait values"),
124438
+ traits: exports_external.string().optional().describe(`Collection traits as JSON string of key-value pairs where values are arrays, e.g. '{"Background": ["Blue", "Red"], "Eyes": ["Big", "Small"]}'`),
124436
124439
  skipBroadcast: exports_external.boolean().optional().describe("Skip broadcasting transactions (for testing)")
124437
124440
  });
124438
124441
  async function getImageFiles(folderPath) {
@@ -124481,8 +124484,9 @@ function generateItemTraits(itemIndex, collectionTraits) {
124481
124484
  return traits;
124482
124485
  }
124483
124486
  function registerMintCollectionTool(server, wallet4) {
124484
- server.tool("wallet_mintCollection", "Mint a collection of ordinals from a folder of images with proper metadata. This tool creates a collection inscription first, then mints each image as a collection item with the appropriate metadata linking it to the collection.", { ...mintCollectionArgsSchema.shape }, async ({ folderPath, collectionName, description, rarityLabels, traits, skipBroadcast }) => {
124487
+ server.tool("wallet_mintCollection", "Mint a collection of ordinals from a folder of images with proper metadata. This tool creates a collection inscription first, then mints each image as a collection item with the appropriate metadata linking it to the collection.", { ...mintCollectionArgsSchema.shape }, async ({ folderPath, collectionName, description, rarityLabels, traits: traitsJson, skipBroadcast }) => {
124485
124488
  try {
124489
+ const traits = traitsJson ? JSON.parse(traitsJson) : undefined;
124486
124490
  const paymentPk = wallet4.getPaymentKey();
124487
124491
  if (!paymentPk) {
124488
124492
  throw new Error("No payment key available in wallet");
@@ -127609,7 +127613,8 @@ function registerMcpAppTools(server2, wallet4) {
127609
127613
  }, async () => {
127610
127614
  return {
127611
127615
  content: [{ type: "text", text: "BSV Dashboard opened" }],
127612
- structuredContent: { view: "dashboard", ready: true }
127616
+ structuredContent: { view: "dashboard", ready: true },
127617
+ _meta: { viewUUID: crypto.randomUUID() }
127613
127618
  };
127614
127619
  });
127615
127620
  ID(server2, "app_explorer_data", {
@@ -127664,7 +127669,8 @@ function registerMcpAppTools(server2, wallet4) {
127664
127669
  height: jbData.block_height
127665
127670
  } : null
127666
127671
  }
127667
- }
127672
+ },
127673
+ _meta: { viewUUID: crypto.randomUUID() }
127668
127674
  };
127669
127675
  } catch (err) {
127670
127676
  return {
@@ -127674,7 +127680,8 @@ function registerMcpAppTools(server2, wallet4) {
127674
127680
  text: `Error: ${err instanceof Error ? err.message : String(err)}`
127675
127681
  }
127676
127682
  ],
127677
- structuredContent: { error: String(err) }
127683
+ structuredContent: { error: String(err) },
127684
+ _meta: { viewUUID: crypto.randomUUID() }
127678
127685
  };
127679
127686
  }
127680
127687
  }
@@ -127692,7 +127699,8 @@ function registerMcpAppTools(server2, wallet4) {
127692
127699
  ],
127693
127700
  structuredContent: {
127694
127701
  addressInfo: { balance, history }
127695
- }
127702
+ },
127703
+ _meta: { viewUUID: crypto.randomUUID() }
127696
127704
  };
127697
127705
  } catch (err) {
127698
127706
  return {
@@ -127702,7 +127710,8 @@ function registerMcpAppTools(server2, wallet4) {
127702
127710
  text: `Error: ${err instanceof Error ? err.message : String(err)}`
127703
127711
  }
127704
127712
  ],
127705
- structuredContent: { error: String(err) }
127713
+ structuredContent: { error: String(err) },
127714
+ _meta: { viewUUID: crypto.randomUUID() }
127706
127715
  };
127707
127716
  }
127708
127717
  }
@@ -127719,7 +127728,8 @@ function registerMcpAppTools(server2, wallet4) {
127719
127728
  text: `BSV price: $${price.toFixed(2)}`
127720
127729
  }
127721
127730
  ],
127722
- structuredContent: { price, chainInfo }
127731
+ structuredContent: { price, chainInfo },
127732
+ _meta: { viewUUID: crypto.randomUUID() }
127723
127733
  };
127724
127734
  } catch (err) {
127725
127735
  return {
@@ -127729,7 +127739,8 @@ function registerMcpAppTools(server2, wallet4) {
127729
127739
  text: `Error: ${err instanceof Error ? err.message : String(err)}`
127730
127740
  }
127731
127741
  ],
127732
- structuredContent: { error: String(err) }
127742
+ structuredContent: { error: String(err) },
127743
+ _meta: { viewUUID: crypto.randomUUID() }
127733
127744
  };
127734
127745
  }
127735
127746
  });
@@ -127751,7 +127762,8 @@ function registerMcpAppTools(server2, wallet4) {
127751
127762
  ],
127752
127763
  structuredContent: {
127753
127764
  error: "No wallet configured. Set PRIVATE_KEY_WIF or generate keys."
127754
- }
127765
+ },
127766
+ _meta: { viewUUID: crypto.randomUUID() }
127755
127767
  };
127756
127768
  }
127757
127769
  try {
@@ -127787,7 +127799,8 @@ function registerMcpAppTools(server2, wallet4) {
127787
127799
  satoshis: u.satoshis
127788
127800
  })),
127789
127801
  price
127790
- }
127802
+ },
127803
+ _meta: { viewUUID: crypto.randomUUID() }
127791
127804
  };
127792
127805
  } catch (err) {
127793
127806
  return {
@@ -127797,7 +127810,8 @@ function registerMcpAppTools(server2, wallet4) {
127797
127810
  text: `Error: ${err instanceof Error ? err.message : String(err)}`
127798
127811
  }
127799
127812
  ],
127800
- structuredContent: { error: String(err) }
127813
+ structuredContent: { error: String(err) },
127814
+ _meta: { viewUUID: crypto.randomUUID() }
127801
127815
  };
127802
127816
  }
127803
127817
  });
@@ -127833,7 +127847,8 @@ function registerMcpAppTools(server2, wallet4) {
127833
127847
  structuredContent: {
127834
127848
  results: data2.results || [],
127835
127849
  total: data2.total || 0
127836
- }
127850
+ },
127851
+ _meta: { viewUUID: crypto.randomUUID() }
127837
127852
  };
127838
127853
  }
127839
127854
  const res = await fetch("https://ordinals.gorillapool.io/api/market?limit=20&offset=0&sort=recent&dir=desc");
@@ -127847,7 +127862,8 @@ function registerMcpAppTools(server2, wallet4) {
127847
127862
  structuredContent: {
127848
127863
  listings: data.results || [],
127849
127864
  total: data.total || 0
127850
- }
127865
+ },
127866
+ _meta: { viewUUID: crypto.randomUUID() }
127851
127867
  };
127852
127868
  } catch (err) {
127853
127869
  return {
@@ -127857,12 +127873,13 @@ function registerMcpAppTools(server2, wallet4) {
127857
127873
  text: `Error: ${err instanceof Error ? err.message : String(err)}`
127858
127874
  }
127859
127875
  ],
127860
- structuredContent: { error: String(err) }
127876
+ structuredContent: { error: String(err) },
127877
+ _meta: { viewUUID: crypto.randomUUID() }
127861
127878
  };
127862
127879
  }
127863
127880
  });
127864
127881
  cD(server2, "BSV Dashboard", APP_RESOURCE_URI, { description: "Interactive BSV dashboard with Explorer, Wallet, and Ordinals tabs" }, async () => {
127865
- const distPath = join2(__appDirname, "dist", "app.html");
127882
+ const distPath = __appDirname.endsWith("dist") ? join2(__appDirname, "app.html") : join2(__appDirname, "dist", "app.html");
127866
127883
  let html;
127867
127884
  try {
127868
127885
  html = await readFile(distPath, "utf-8");
package/index.ts CHANGED
@@ -256,6 +256,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
256
256
  return {
257
257
  content: [{ type: "text" as const, text: "BSV Dashboard opened" }],
258
258
  structuredContent: { view: "dashboard", ready: true },
259
+ _meta: { viewUUID: crypto.randomUUID() },
259
260
  };
260
261
  },
261
262
  );
@@ -335,6 +336,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
335
336
  : null,
336
337
  },
337
338
  },
339
+ _meta: { viewUUID: crypto.randomUUID() },
338
340
  };
339
341
  } catch (err) {
340
342
  return {
@@ -345,6 +347,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
345
347
  },
346
348
  ],
347
349
  structuredContent: { error: String(err) },
350
+ _meta: { viewUUID: crypto.randomUUID() },
348
351
  };
349
352
  }
350
353
  }
@@ -374,6 +377,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
374
377
  structuredContent: {
375
378
  addressInfo: { balance, history },
376
379
  },
380
+ _meta: { viewUUID: crypto.randomUUID() },
377
381
  };
378
382
  } catch (err) {
379
383
  return {
@@ -384,6 +388,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
384
388
  },
385
389
  ],
386
390
  structuredContent: { error: String(err) },
391
+ _meta: { viewUUID: crypto.randomUUID() },
387
392
  };
388
393
  }
389
394
  }
@@ -406,6 +411,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
406
411
  },
407
412
  ],
408
413
  structuredContent: { price, chainInfo },
414
+ _meta: { viewUUID: crypto.randomUUID() },
409
415
  };
410
416
  } catch (err) {
411
417
  return {
@@ -416,6 +422,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
416
422
  },
417
423
  ],
418
424
  structuredContent: { error: String(err) },
425
+ _meta: { viewUUID: crypto.randomUUID() },
419
426
  };
420
427
  }
421
428
  },
@@ -445,6 +452,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
445
452
  structuredContent: {
446
453
  error: "No wallet configured. Set PRIVATE_KEY_WIF or generate keys.",
447
454
  },
455
+ _meta: { viewUUID: crypto.randomUUID() },
448
456
  };
449
457
  }
450
458
 
@@ -487,6 +495,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
487
495
  })),
488
496
  price,
489
497
  },
498
+ _meta: { viewUUID: crypto.randomUUID() },
490
499
  };
491
500
  } catch (err) {
492
501
  return {
@@ -497,6 +506,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
497
506
  },
498
507
  ],
499
508
  structuredContent: { error: String(err) },
509
+ _meta: { viewUUID: crypto.randomUUID() },
500
510
  };
501
511
  }
502
512
  },
@@ -546,6 +556,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
546
556
  results: data.results || [],
547
557
  total: data.total || 0,
548
558
  },
559
+ _meta: { viewUUID: crypto.randomUUID() },
549
560
  };
550
561
  }
551
562
 
@@ -564,6 +575,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
564
575
  listings: data.results || [],
565
576
  total: data.total || 0,
566
577
  },
578
+ _meta: { viewUUID: crypto.randomUUID() },
567
579
  };
568
580
  } catch (err) {
569
581
  return {
@@ -574,6 +586,7 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
574
586
  },
575
587
  ],
576
588
  structuredContent: { error: String(err) },
589
+ _meta: { viewUUID: crypto.randomUUID() },
577
590
  };
578
591
  }
579
592
  },
@@ -586,7 +599,11 @@ function registerMcpAppTools(server: McpServer, wallet?: Wallet) {
586
599
  APP_RESOURCE_URI,
587
600
  { description: "Interactive BSV dashboard with Explorer, Wallet, and Ordinals tabs" },
588
601
  async () => {
589
- const distPath = join(__appDirname, "dist", "app.html");
602
+ // When running from bundle (dist/index.js), app.html is a sibling.
603
+ // When running from source (index.ts), it's in dist/.
604
+ const distPath = __appDirname.endsWith("dist")
605
+ ? join(__appDirname, "app.html")
606
+ : join(__appDirname, "dist", "app.html");
590
607
  let html: string;
591
608
  try {
592
609
  html = await readFile(distPath, "utf-8");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "bsv-mcp",
3
3
  "module": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.2.7",
5
+ "version": "0.2.9",
6
6
  "license": "MIT",
7
7
  "author": "satchmo",
8
8
  "description": "A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) framework",
@@ -23,6 +23,7 @@
23
23
  ],
24
24
  "files": [
25
25
  "dist/**/*.js",
26
+ "dist/**/*.html",
26
27
  "package.json",
27
28
  "*.ts",
28
29
  "tools/*.ts",
@@ -25,9 +25,9 @@ const createPostArgsSchema = z.object({
25
25
  .default("bsv-mcp")
26
26
  .describe("Application name creating the post"),
27
27
  additionalMapData: z
28
- .record(z.string())
28
+ .string()
29
29
  .optional()
30
- .describe("Additional MAP protocol key-value pairs"),
30
+ .describe("Additional MAP protocol key-value pairs as a JSON object string, e.g. '{\"key\": \"value\"}'"),
31
31
  });
32
32
 
33
33
  type CreatePostArgs = z.infer<typeof createPostArgsSchema>;
@@ -80,9 +80,10 @@ export async function createSocialPost(
80
80
  toArray("post", "utf8"),
81
81
  ];
82
82
 
83
- // Add any additional MAP data
83
+ // Add any additional MAP data (parse JSON string if provided)
84
84
  if (additionalMapData) {
85
- for (const [key, value] of Object.entries(additionalMapData)) {
85
+ const parsedMapData: Record<string, string> = JSON.parse(additionalMapData);
86
+ for (const [key, value] of Object.entries(parsedMapData)) {
86
87
  mapData.push(toArray(key, "utf8"), toArray(value, "utf8"));
87
88
  }
88
89
  }
@@ -17,7 +17,7 @@ export function registerTokenTools(server: McpServer): void {
17
17
  server.tool(
18
18
  "bsv_toSatoshi",
19
19
  {
20
- bitcoin: z.union([z.number(), z.string()]),
20
+ bitcoin: z.string().describe("Bitcoin amount (accepts numeric strings like '1.5')"),
21
21
  returnType: z.enum(["number", "string", "bigint"]).optional(),
22
22
  },
23
23
  async ({ bitcoin, returnType }) => {
@@ -46,7 +46,7 @@ export function registerTokenTools(server: McpServer): void {
46
46
  server.tool(
47
47
  "bsv_toBitcoin",
48
48
  {
49
- satoshis: z.union([z.number(), z.string(), z.bigint()]),
49
+ satoshis: z.string().describe("Satoshi amount (accepts numeric strings like '100000000')"),
50
50
  returnType: z.enum(["number", "string", "bigint"]).optional(),
51
51
  },
52
52
  async ({ satoshis, returnType }) => {
@@ -87,7 +87,7 @@ export function registerTokenTools(server: McpServer): void {
87
87
  server.tool(
88
88
  "bsv_toTokenSatoshi",
89
89
  {
90
- token: z.union([z.number(), z.string(), z.bigint()]),
90
+ token: z.string().describe("Token amount (accepts numeric strings like '1.5')"),
91
91
  decimals: z.number().int().min(0),
92
92
  returnType: z.enum(["number", "string", "bigint"]).optional(),
93
93
  },
@@ -117,7 +117,7 @@ export function registerTokenTools(server: McpServer): void {
117
117
  server.tool(
118
118
  "bsv_toToken",
119
119
  {
120
- tokenSatoshi: z.union([z.number(), z.string(), z.bigint()]),
120
+ tokenSatoshi: z.string().describe("Token satoshi amount (accepts numeric strings)"),
121
121
  decimals: z.number().int().min(0),
122
122
  returnType: z.enum(["number", "string", "bigint"]).optional(),
123
123
  },
@@ -35,10 +35,10 @@ const mintCollectionArgsSchema = z.object({
35
35
  .optional()
36
36
  .describe("Rarity labels and their percentages"),
37
37
  traits: z
38
- .record(z.array(z.string()))
38
+ .string()
39
39
  .optional()
40
40
  .describe(
41
- "Collection traits as key-value pairs where values are arrays of possible trait values",
41
+ 'Collection traits as JSON string of key-value pairs where values are arrays, e.g. \'{"Background": ["Blue", "Red"], "Eyes": ["Big", "Small"]}\'',
42
42
  ),
43
43
  skipBroadcast: z
44
44
  .boolean()
@@ -121,8 +121,10 @@ export function registerMintCollectionTool(server: McpServer, wallet: Wallet) {
121
121
  "wallet_mintCollection",
122
122
  "Mint a collection of ordinals from a folder of images with proper metadata. This tool creates a collection inscription first, then mints each image as a collection item with the appropriate metadata linking it to the collection.",
123
123
  { ...mintCollectionArgsSchema.shape },
124
- async ({ folderPath, collectionName, description, rarityLabels, traits, skipBroadcast }): Promise<CallToolResult> => {
124
+ async ({ folderPath, collectionName, description, rarityLabels, traits: traitsJson, skipBroadcast }): Promise<CallToolResult> => {
125
125
  try {
126
+ // Parse traits JSON string if provided
127
+ const traits: Record<string, string[]> | undefined = traitsJson ? JSON.parse(traitsJson) : undefined;
126
128
  // Get keys from wallet
127
129
  const paymentPk = wallet.getPaymentKey();
128
130
  if (!paymentPk) {