bsv-mcp 0.2.0 → 0.2.7
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/CHANGELOG.md +13 -0
- package/dist/index.js +87272 -70728
- package/index.ts +409 -22
- package/package.json +28 -24
- package/tools/a2b/discover.ts +13 -13
- package/tools/bap/friend.ts +2 -3
- package/tools/bap/generate.ts +7 -9
- package/tools/bap/getCurrentAddress.ts +1 -8
- package/tools/bap/getId.ts +3 -3
- package/tools/bsocial/bmapFollow.ts +3 -7
- package/tools/bsocial/bmapLikes.ts +3 -3
- package/tools/bsocial/bmapReadPosts.ts +3 -3
- package/tools/bsocial/createPost.ts +3 -3
- package/tools/bsocial/readPosts.ts +3 -3
- package/tools/bsv/decodeTransaction.ts +2 -5
- package/tools/bsv/explore.ts +2 -3
- package/tools/bsv/getPrice.ts +1 -9
- package/tools/bsv/token.ts +14 -26
- package/tools/index.ts +0 -13
- package/tools/mnee/getBalance.ts +2 -4
- package/tools/mnee/parseTx.ts +3 -3
- package/tools/mnee/sendMnee.ts +5 -5
- package/tools/ordinals/getInscription.ts +2 -3
- package/tools/ordinals/getTokenByIdOrTicker.ts +6 -3
- package/tools/ordinals/marketListings.ts +2 -18
- package/tools/ordinals/marketSales.ts +2 -4
- package/tools/ordinals/searchInscriptions.ts +2 -4
- package/tools/utils/index.ts +14 -16
- package/tools/wallet/a2bPublishAgent.ts +18 -27
- package/tools/wallet/a2bPublishMcp.ts +17 -22
- package/tools/wallet/createOrdinals.ts +11 -20
- package/tools/wallet/fetchPaymentUtxos.ts +9 -1
- package/tools/wallet/gatherCollectionInfo.ts +9 -13
- package/tools/wallet/getAddress.ts +1 -9
- package/tools/wallet/getBalance.ts +2 -14
- package/tools/wallet/getBalanceDroplet.ts +2 -13
- package/tools/wallet/getPublicKey.ts +3 -16
- package/tools/wallet/mintCollection.ts +17 -22
- package/tools/wallet/purchaseListing.ts +19 -29
- package/tools/wallet/refreshUtxos.ts +2 -14
- package/tools/wallet/sendOrdinals.ts +11 -20
- package/tools/wallet/sendToAddress.ts +2 -22
- package/tools/wallet/setupDroplet.ts +7 -18
- package/tools/wallet/tools.ts +10 -80
- package/tools/wallet/transferOrdToken.ts +12 -20
- package/vite.config.ts +15 -0
- package/tools/bigblocks/components.ts +0 -304
- package/tools/bigblocks/docs.ts +0 -488
- package/tools/bigblocks/examples.ts +0 -527
- package/tools/bigblocks/generator.ts +0 -485
- package/tools/bigblocks/index.ts +0 -23
- package/tools/bsocial/bigblocksApiClient.ts +0 -189
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
// TypeScript interfaces for BigBlocks registry
|
|
7
|
-
interface BigBlocksComponent {
|
|
8
|
-
name: string;
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
files?: string[];
|
|
12
|
-
dependencies?: string[];
|
|
13
|
-
registryDependencies?: string[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface BigBlocksRegistry {
|
|
17
|
-
components: BigBlocksComponent[];
|
|
18
|
-
version?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface OrganizedComponents {
|
|
22
|
-
[category: string]: {
|
|
23
|
-
[subcategory: string]: BigBlocksComponent[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Load BigBlocks registry data
|
|
28
|
-
function loadBigBlocksRegistry(): BigBlocksRegistry | null {
|
|
29
|
-
try {
|
|
30
|
-
const registryPath = path.resolve(
|
|
31
|
-
"node_modules/bigblocks/registry/registry.json",
|
|
32
|
-
);
|
|
33
|
-
const registryData = JSON.parse(fs.readFileSync(registryPath, "utf-8"));
|
|
34
|
-
return registryData as BigBlocksRegistry;
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error("Failed to load BigBlocks registry:", error);
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Organize components by type for easier browsing
|
|
42
|
-
function organizeComponentsByType(
|
|
43
|
-
registry: BigBlocksRegistry,
|
|
44
|
-
): OrganizedComponents {
|
|
45
|
-
const organized: OrganizedComponents = {};
|
|
46
|
-
|
|
47
|
-
if (!registry?.components) return organized;
|
|
48
|
-
|
|
49
|
-
for (const component of registry.components) {
|
|
50
|
-
const [category, subcategory] = component.type.split(":");
|
|
51
|
-
|
|
52
|
-
if (!organized[category]) {
|
|
53
|
-
organized[category] = {};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!organized[category][subcategory]) {
|
|
57
|
-
organized[category][subcategory] = [];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
organized[category][subcategory].push(component);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return organized;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const componentSearchSchema = z.object({
|
|
67
|
-
category: z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe("Component category to search in (component, hook)"),
|
|
71
|
-
type: z
|
|
72
|
-
.string()
|
|
73
|
-
.optional()
|
|
74
|
-
.describe(
|
|
75
|
-
"Component type to filter by (auth, social, wallet, market, profile, backup, ui, bap, provider, layout)",
|
|
76
|
-
),
|
|
77
|
-
component: z
|
|
78
|
-
.string()
|
|
79
|
-
.optional()
|
|
80
|
-
.describe("Specific component name to get details for"),
|
|
81
|
-
search: z
|
|
82
|
-
.string()
|
|
83
|
-
.optional()
|
|
84
|
-
.describe("Search term to find components by name or description"),
|
|
85
|
-
showAll: z.boolean().optional().describe("Show all available components"),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Register the BigBlocks component discovery tool
|
|
90
|
-
*/
|
|
91
|
-
export function registerBigBlocksComponentTool(server: McpServer): void {
|
|
92
|
-
server.tool(
|
|
93
|
-
"bigblocks_components",
|
|
94
|
-
"Discover and learn about BigBlocks React components from the official registry. BigBlocks provides 96+ production-ready components for Bitcoin applications.\n\n" +
|
|
95
|
-
"Usage examples:\n" +
|
|
96
|
-
'- List all components: {"showAll": true}\n' +
|
|
97
|
-
'- Browse by category: {"category": "component"}\n' +
|
|
98
|
-
'- Filter by type: {"type": "social"}\n' +
|
|
99
|
-
'- Get component details: {"component": "auth-flow"}\n' +
|
|
100
|
-
'- Search components: {"search": "authentication"}\n\n' +
|
|
101
|
-
"Categories:\n" +
|
|
102
|
-
"- component: React components (auth, social, wallet, market, profile, backup, ui, bap, provider, layout)\n" +
|
|
103
|
-
"- hook: React hooks for various functionalities\n\n" +
|
|
104
|
-
"Types:\n" +
|
|
105
|
-
"- auth: Authentication and login components\n" +
|
|
106
|
-
"- social: Social media and networking\n" +
|
|
107
|
-
"- wallet: Bitcoin wallet operations\n" +
|
|
108
|
-
"- market: NFT and token marketplace\n" +
|
|
109
|
-
"- profile: User profile management\n" +
|
|
110
|
-
"- backup: Key backup and recovery\n" +
|
|
111
|
-
"- ui: General UI components\n" +
|
|
112
|
-
"- bap: Bitcoin Application Protocol\n" +
|
|
113
|
-
"- provider: Context providers\n" +
|
|
114
|
-
"- layout: Layout components",
|
|
115
|
-
{ args: componentSearchSchema },
|
|
116
|
-
async ({ args }) => {
|
|
117
|
-
try {
|
|
118
|
-
const registry = loadBigBlocksRegistry();
|
|
119
|
-
if (!registry) {
|
|
120
|
-
return {
|
|
121
|
-
content: [
|
|
122
|
-
{
|
|
123
|
-
type: "text",
|
|
124
|
-
text: "Error: Could not load BigBlocks registry data",
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
isError: true,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const { category, type, component, search, showAll } = args;
|
|
132
|
-
const organized = organizeComponentsByType(registry);
|
|
133
|
-
|
|
134
|
-
// Show specific component details
|
|
135
|
-
if (component) {
|
|
136
|
-
const comp = registry.components.find((c) => c.name === component);
|
|
137
|
-
if (!comp) {
|
|
138
|
-
const available = registry.components.map((c) => c.name).join(", ");
|
|
139
|
-
return {
|
|
140
|
-
content: [
|
|
141
|
-
{
|
|
142
|
-
type: "text",
|
|
143
|
-
text: `Component "${component}" not found. Available components: ${available}`,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
isError: true,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
let result = `# ${comp.name}\n\n`;
|
|
151
|
-
result += `**Type:** ${comp.type}\n`;
|
|
152
|
-
result += `**Description:** ${comp.description}\n\n`;
|
|
153
|
-
|
|
154
|
-
if (comp.files?.length) {
|
|
155
|
-
result += `**Files:**\n${comp.files.map((f) => `- ${f}`).join("\n")}\n\n`;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (comp.dependencies?.length) {
|
|
159
|
-
result += `**Dependencies:** ${comp.dependencies.join(", ")}\n\n`;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (comp.registryDependencies?.length) {
|
|
163
|
-
result += `**Registry Dependencies:** ${comp.registryDependencies.join(", ")}\n\n`;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Determine the actual component/hook name from files
|
|
167
|
-
const mainFile = comp.files?.[0];
|
|
168
|
-
if (mainFile) {
|
|
169
|
-
const fileName = path.basename(mainFile, path.extname(mainFile));
|
|
170
|
-
result += `**Import:**\n\`\`\`tsx\nimport { ${fileName} } from 'bigblocks';\n\`\`\`\n\n`;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return { content: [{ type: "text", text: result }] };
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Search components
|
|
177
|
-
if (search) {
|
|
178
|
-
const searchTerm = search.toLowerCase();
|
|
179
|
-
const matchingComponents = registry.components.filter(
|
|
180
|
-
(comp) =>
|
|
181
|
-
comp.name.toLowerCase().includes(searchTerm) ||
|
|
182
|
-
comp.description.toLowerCase().includes(searchTerm) ||
|
|
183
|
-
comp.type.toLowerCase().includes(searchTerm),
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
let result = `# BigBlocks Components Search: "${search}"\n\n`;
|
|
187
|
-
if (matchingComponents.length === 0) {
|
|
188
|
-
result += "No components found matching your search.";
|
|
189
|
-
} else {
|
|
190
|
-
result += `Found ${matchingComponents.length} component(s):\n\n`;
|
|
191
|
-
for (const comp of matchingComponents) {
|
|
192
|
-
result += `## ${comp.name} (${comp.type})\n`;
|
|
193
|
-
result += `${comp.description}\n\n`;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return { content: [{ type: "text", text: result }] };
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Filter by category and/or type
|
|
201
|
-
if (category || type) {
|
|
202
|
-
let filtered = registry.components;
|
|
203
|
-
|
|
204
|
-
if (category) {
|
|
205
|
-
filtered = filtered.filter((comp) =>
|
|
206
|
-
comp.type.startsWith(`${category}:`),
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (type) {
|
|
211
|
-
filtered = filtered.filter((comp) =>
|
|
212
|
-
comp.type.includes(`:${type}`),
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
let result = `# BigBlocks Components${category ? ` - ${category}` : ""}${type ? ` - ${type}` : ""}\n\n`;
|
|
217
|
-
|
|
218
|
-
if (filtered.length === 0) {
|
|
219
|
-
result += "No components found matching your criteria.";
|
|
220
|
-
} else {
|
|
221
|
-
result += `Found ${filtered.length} component(s):\n\n`;
|
|
222
|
-
for (const comp of filtered) {
|
|
223
|
-
result += `## ${comp.name}\n**Type:** ${comp.type}\n**Description:** ${comp.description}\n\n`;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return { content: [{ type: "text", text: result }] };
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Show all components organized
|
|
231
|
-
if (showAll) {
|
|
232
|
-
let result = "# BigBlocks Component Registry\n\n";
|
|
233
|
-
result += `**Version:** ${registry.version}\n`;
|
|
234
|
-
result += `**Total Components:** ${registry.components.length}\n\n`;
|
|
235
|
-
|
|
236
|
-
for (const [cat, subcats] of Object.entries(organized)) {
|
|
237
|
-
result += `## ${cat.charAt(0).toUpperCase() + cat.slice(1)}s\n\n`;
|
|
238
|
-
|
|
239
|
-
for (const [subcat, components] of Object.entries(subcats)) {
|
|
240
|
-
result += `### ${subcat.charAt(0).toUpperCase() + subcat.slice(1)} (${components.length})\n`;
|
|
241
|
-
|
|
242
|
-
for (const comp of components) {
|
|
243
|
-
result += `- **${comp.name}**: ${comp.description}\n`;
|
|
244
|
-
}
|
|
245
|
-
result += "\n";
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
result +=
|
|
250
|
-
'\n**Get details:** Use {"component": "component-name"} for specific information\n';
|
|
251
|
-
result +=
|
|
252
|
-
'**Filter:** Use {"category": "component", "type": "social"} to filter by type';
|
|
253
|
-
|
|
254
|
-
return { content: [{ type: "text", text: result }] };
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// Default: show overview
|
|
258
|
-
const componentCount = Object.values(organized.component || {}).reduce(
|
|
259
|
-
(sum, comps) => sum + comps.length,
|
|
260
|
-
0,
|
|
261
|
-
);
|
|
262
|
-
const hookCount = Object.values(organized.hook || {}).reduce(
|
|
263
|
-
(sum, hooks) => sum + hooks.length,
|
|
264
|
-
0,
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
return {
|
|
268
|
-
content: [
|
|
269
|
-
{
|
|
270
|
-
type: "text",
|
|
271
|
-
text: `# BigBlocks Component Registry
|
|
272
|
-
|
|
273
|
-
**Version:** ${registry.version}
|
|
274
|
-
**Total:** ${registry.components.length} items
|
|
275
|
-
|
|
276
|
-
**Categories:**
|
|
277
|
-
- **Components:** ${componentCount} React components
|
|
278
|
-
- **Hooks:** ${hookCount} React hooks
|
|
279
|
-
|
|
280
|
-
**Component Types:**
|
|
281
|
-
${Object.keys(organized.component || {})
|
|
282
|
-
.map(
|
|
283
|
-
(type) => `- **${type}**: ${organized.component[type].length} components`,
|
|
284
|
-
)
|
|
285
|
-
.join("\n")}
|
|
286
|
-
|
|
287
|
-
Use {"showAll": true} to see all components, {"category": "component"} to browse components, or {"component": "name"} for details.`,
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
};
|
|
291
|
-
} catch (error) {
|
|
292
|
-
return {
|
|
293
|
-
content: [
|
|
294
|
-
{
|
|
295
|
-
type: "text",
|
|
296
|
-
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
297
|
-
},
|
|
298
|
-
],
|
|
299
|
-
isError: true,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
);
|
|
304
|
-
}
|