bsv-mcp 0.2.7 → 0.2.8
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 +34 -19
- package/index.ts +13 -0
- package/package.json +1 -1
- package/tools/bsocial/createPost.ts +5 -4
- package/tools/bsv/token.ts +4 -4
- package/tools/wallet/mintCollection.ts +5 -3
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.
|
|
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",
|
|
@@ -90657,7 +90657,7 @@ var createPostArgsSchema = exports_external.object({
|
|
|
90657
90657
|
content: exports_external.string().describe("The content of the post"),
|
|
90658
90658
|
contentType: exports_external.enum(["text/plain", "text/markdown"]).default("text/plain").describe("Content type of the post"),
|
|
90659
90659
|
app: exports_external.string().default("bsv-mcp").describe("Application name creating the post"),
|
|
90660
|
-
additionalMapData: exports_external.
|
|
90660
|
+
additionalMapData: exports_external.string().optional().describe(`Additional MAP protocol key-value pairs as a JSON object string, e.g. '{"key": "value"}'`)
|
|
90661
90661
|
});
|
|
90662
90662
|
async function createSocialPost(args, wallet3) {
|
|
90663
90663
|
try {
|
|
@@ -90688,7 +90688,8 @@ async function createSocialPost(args, wallet3) {
|
|
|
90688
90688
|
toArray8("post", "utf8")
|
|
90689
90689
|
];
|
|
90690
90690
|
if (additionalMapData) {
|
|
90691
|
-
|
|
90691
|
+
const parsedMapData = JSON.parse(additionalMapData);
|
|
90692
|
+
for (const [key, value] of Object.entries(parsedMapData)) {
|
|
90692
90693
|
mapData.push(toArray8(key, "utf8"), toArray8(value, "utf8"));
|
|
90693
90694
|
}
|
|
90694
90695
|
}
|
|
@@ -123699,7 +123700,7 @@ var package_default2 = {
|
|
|
123699
123700
|
name: "bsv-mcp",
|
|
123700
123701
|
module: "dist/index.js",
|
|
123701
123702
|
type: "module",
|
|
123702
|
-
version: "0.2.
|
|
123703
|
+
version: "0.2.8",
|
|
123703
123704
|
license: "MIT",
|
|
123704
123705
|
author: "satchmo",
|
|
123705
123706
|
description: "A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) framework",
|
|
@@ -124432,7 +124433,7 @@ var mintCollectionArgsSchema = exports_external.object({
|
|
|
124432
124433
|
label: exports_external.string(),
|
|
124433
124434
|
percentage: exports_external.number().min(0).max(100)
|
|
124434
124435
|
})).optional().describe("Rarity labels and their percentages"),
|
|
124435
|
-
traits: exports_external.
|
|
124436
|
+
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
124437
|
skipBroadcast: exports_external.boolean().optional().describe("Skip broadcasting transactions (for testing)")
|
|
124437
124438
|
});
|
|
124438
124439
|
async function getImageFiles(folderPath) {
|
|
@@ -124481,8 +124482,9 @@ function generateItemTraits(itemIndex, collectionTraits) {
|
|
|
124481
124482
|
return traits;
|
|
124482
124483
|
}
|
|
124483
124484
|
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 }) => {
|
|
124485
|
+
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
124486
|
try {
|
|
124487
|
+
const traits = traitsJson ? JSON.parse(traitsJson) : undefined;
|
|
124486
124488
|
const paymentPk = wallet4.getPaymentKey();
|
|
124487
124489
|
if (!paymentPk) {
|
|
124488
124490
|
throw new Error("No payment key available in wallet");
|
|
@@ -127609,7 +127611,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127609
127611
|
}, async () => {
|
|
127610
127612
|
return {
|
|
127611
127613
|
content: [{ type: "text", text: "BSV Dashboard opened" }],
|
|
127612
|
-
structuredContent: { view: "dashboard", ready: true }
|
|
127614
|
+
structuredContent: { view: "dashboard", ready: true },
|
|
127615
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127613
127616
|
};
|
|
127614
127617
|
});
|
|
127615
127618
|
ID(server2, "app_explorer_data", {
|
|
@@ -127664,7 +127667,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127664
127667
|
height: jbData.block_height
|
|
127665
127668
|
} : null
|
|
127666
127669
|
}
|
|
127667
|
-
}
|
|
127670
|
+
},
|
|
127671
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127668
127672
|
};
|
|
127669
127673
|
} catch (err) {
|
|
127670
127674
|
return {
|
|
@@ -127674,7 +127678,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127674
127678
|
text: `Error: ${err instanceof Error ? err.message : String(err)}`
|
|
127675
127679
|
}
|
|
127676
127680
|
],
|
|
127677
|
-
structuredContent: { error: String(err) }
|
|
127681
|
+
structuredContent: { error: String(err) },
|
|
127682
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127678
127683
|
};
|
|
127679
127684
|
}
|
|
127680
127685
|
}
|
|
@@ -127692,7 +127697,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127692
127697
|
],
|
|
127693
127698
|
structuredContent: {
|
|
127694
127699
|
addressInfo: { balance, history }
|
|
127695
|
-
}
|
|
127700
|
+
},
|
|
127701
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127696
127702
|
};
|
|
127697
127703
|
} catch (err) {
|
|
127698
127704
|
return {
|
|
@@ -127702,7 +127708,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127702
127708
|
text: `Error: ${err instanceof Error ? err.message : String(err)}`
|
|
127703
127709
|
}
|
|
127704
127710
|
],
|
|
127705
|
-
structuredContent: { error: String(err) }
|
|
127711
|
+
structuredContent: { error: String(err) },
|
|
127712
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127706
127713
|
};
|
|
127707
127714
|
}
|
|
127708
127715
|
}
|
|
@@ -127719,7 +127726,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127719
127726
|
text: `BSV price: $${price.toFixed(2)}`
|
|
127720
127727
|
}
|
|
127721
127728
|
],
|
|
127722
|
-
structuredContent: { price, chainInfo }
|
|
127729
|
+
structuredContent: { price, chainInfo },
|
|
127730
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127723
127731
|
};
|
|
127724
127732
|
} catch (err) {
|
|
127725
127733
|
return {
|
|
@@ -127729,7 +127737,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127729
127737
|
text: `Error: ${err instanceof Error ? err.message : String(err)}`
|
|
127730
127738
|
}
|
|
127731
127739
|
],
|
|
127732
|
-
structuredContent: { error: String(err) }
|
|
127740
|
+
structuredContent: { error: String(err) },
|
|
127741
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127733
127742
|
};
|
|
127734
127743
|
}
|
|
127735
127744
|
});
|
|
@@ -127751,7 +127760,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127751
127760
|
],
|
|
127752
127761
|
structuredContent: {
|
|
127753
127762
|
error: "No wallet configured. Set PRIVATE_KEY_WIF or generate keys."
|
|
127754
|
-
}
|
|
127763
|
+
},
|
|
127764
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127755
127765
|
};
|
|
127756
127766
|
}
|
|
127757
127767
|
try {
|
|
@@ -127787,7 +127797,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127787
127797
|
satoshis: u.satoshis
|
|
127788
127798
|
})),
|
|
127789
127799
|
price
|
|
127790
|
-
}
|
|
127800
|
+
},
|
|
127801
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127791
127802
|
};
|
|
127792
127803
|
} catch (err) {
|
|
127793
127804
|
return {
|
|
@@ -127797,7 +127808,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127797
127808
|
text: `Error: ${err instanceof Error ? err.message : String(err)}`
|
|
127798
127809
|
}
|
|
127799
127810
|
],
|
|
127800
|
-
structuredContent: { error: String(err) }
|
|
127811
|
+
structuredContent: { error: String(err) },
|
|
127812
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127801
127813
|
};
|
|
127802
127814
|
}
|
|
127803
127815
|
});
|
|
@@ -127833,7 +127845,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127833
127845
|
structuredContent: {
|
|
127834
127846
|
results: data2.results || [],
|
|
127835
127847
|
total: data2.total || 0
|
|
127836
|
-
}
|
|
127848
|
+
},
|
|
127849
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127837
127850
|
};
|
|
127838
127851
|
}
|
|
127839
127852
|
const res = await fetch("https://ordinals.gorillapool.io/api/market?limit=20&offset=0&sort=recent&dir=desc");
|
|
@@ -127847,7 +127860,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127847
127860
|
structuredContent: {
|
|
127848
127861
|
listings: data.results || [],
|
|
127849
127862
|
total: data.total || 0
|
|
127850
|
-
}
|
|
127863
|
+
},
|
|
127864
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127851
127865
|
};
|
|
127852
127866
|
} catch (err) {
|
|
127853
127867
|
return {
|
|
@@ -127857,7 +127871,8 @@ function registerMcpAppTools(server2, wallet4) {
|
|
|
127857
127871
|
text: `Error: ${err instanceof Error ? err.message : String(err)}`
|
|
127858
127872
|
}
|
|
127859
127873
|
],
|
|
127860
|
-
structuredContent: { error: String(err) }
|
|
127874
|
+
structuredContent: { error: String(err) },
|
|
127875
|
+
_meta: { viewUUID: crypto.randomUUID() }
|
|
127861
127876
|
};
|
|
127862
127877
|
}
|
|
127863
127878
|
});
|
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
|
},
|
package/package.json
CHANGED
|
@@ -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
|
-
.
|
|
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
|
-
|
|
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
|
}
|
package/tools/bsv/token.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function registerTokenTools(server: McpServer): void {
|
|
|
17
17
|
server.tool(
|
|
18
18
|
"bsv_toSatoshi",
|
|
19
19
|
{
|
|
20
|
-
bitcoin: z.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
.
|
|
38
|
+
.string()
|
|
39
39
|
.optional()
|
|
40
40
|
.describe(
|
|
41
|
-
|
|
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) {
|