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
package/tools/bigblocks/docs.ts
DELETED
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
const BIGBLOCKS_CONCEPTS = {
|
|
5
|
-
"type-42-keys": {
|
|
6
|
-
title: "Type 42 Master Keys",
|
|
7
|
-
description:
|
|
8
|
-
"Enhanced Bitcoin key derivation system for improved identity management",
|
|
9
|
-
content: `# Type 42 Master Keys
|
|
10
|
-
|
|
11
|
-
Type 42 keys represent an advanced key derivation system used in BigBlocks for enhanced Bitcoin identity management.
|
|
12
|
-
|
|
13
|
-
## What are Type 42 Keys?
|
|
14
|
-
|
|
15
|
-
Type 42 keys extend beyond traditional BIP32 hierarchical deterministic (HD) wallets to provide:
|
|
16
|
-
- **Enhanced Security**: Improved key derivation with stronger entropy
|
|
17
|
-
- **Identity Management**: Better support for BAP (Bitcoin Application Protocol) identities
|
|
18
|
-
- **Migration Support**: Seamless upgrade from legacy BIP32 keys
|
|
19
|
-
|
|
20
|
-
## Key Benefits
|
|
21
|
-
|
|
22
|
-
1. **Stronger Cryptography**: Uses advanced derivation algorithms
|
|
23
|
-
2. **BAP Integration**: Native support for Bitcoin Application Protocol
|
|
24
|
-
3. **Backward Compatibility**: Can migrate from existing BIP32 keys
|
|
25
|
-
4. **Multi-Identity**: Support for multiple identity contexts
|
|
26
|
-
|
|
27
|
-
## Migration from BIP32
|
|
28
|
-
|
|
29
|
-
BigBlocks provides automatic migration tools:
|
|
30
|
-
|
|
31
|
-
\`\`\`tsx
|
|
32
|
-
import { MasterKeyMigration } from 'bigblocks';
|
|
33
|
-
|
|
34
|
-
<MasterKeyMigration
|
|
35
|
-
onMigrationComplete={(result) => {
|
|
36
|
-
console.log('Migrated to Type 42:', result);
|
|
37
|
-
}}
|
|
38
|
-
legacyKey={existingBip32Key}
|
|
39
|
-
/>
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
## Usage in BigBlocks
|
|
43
|
-
|
|
44
|
-
Type 42 keys are automatically used when:
|
|
45
|
-
- Creating new identities through BigBlocks components
|
|
46
|
-
- Using BAP-related functionality
|
|
47
|
-
- Performing identity operations
|
|
48
|
-
|
|
49
|
-
## Security Considerations
|
|
50
|
-
|
|
51
|
-
- Always backup Type 42 keys using BigBlocks backup components
|
|
52
|
-
- Use encrypted storage for key material
|
|
53
|
-
- Consider using hardware security modules for high-value applications`,
|
|
54
|
-
},
|
|
55
|
-
"bap-identity": {
|
|
56
|
-
title: "Bitcoin Application Protocol (BAP) Identity",
|
|
57
|
-
description: "Decentralized identity system built on Bitcoin SV",
|
|
58
|
-
content: `# Bitcoin Application Protocol (BAP) Identity
|
|
59
|
-
|
|
60
|
-
BAP provides a decentralized identity system where users control their identity data on the Bitcoin SV blockchain.
|
|
61
|
-
|
|
62
|
-
## Core Concepts
|
|
63
|
-
|
|
64
|
-
### Identity Keys
|
|
65
|
-
- **Master Key**: Root key for all identity operations
|
|
66
|
-
- **Identity Key**: Derived key for specific identity context
|
|
67
|
-
- **Signing Keys**: Keys used for content authentication
|
|
68
|
-
|
|
69
|
-
### Identity Data
|
|
70
|
-
- **Profile Information**: Name, bio, avatar, contact info
|
|
71
|
-
- **Attestations**: Verified claims about identity
|
|
72
|
-
- **Social Connections**: Follows, friends, trust relationships
|
|
73
|
-
|
|
74
|
-
## Using BAP in BigBlocks
|
|
75
|
-
|
|
76
|
-
BigBlocks provides complete BAP integration:
|
|
77
|
-
|
|
78
|
-
\`\`\`tsx
|
|
79
|
-
import {
|
|
80
|
-
ProfileCard,
|
|
81
|
-
ProfileEditor,
|
|
82
|
-
BapKeyRotationManager
|
|
83
|
-
} from 'bigblocks';
|
|
84
|
-
|
|
85
|
-
// Display a BAP identity
|
|
86
|
-
<ProfileCard
|
|
87
|
-
bapId="identity_key_here"
|
|
88
|
-
showActions={true}
|
|
89
|
-
/>
|
|
90
|
-
|
|
91
|
-
// Edit identity profile
|
|
92
|
-
<ProfileEditor
|
|
93
|
-
onSave={(profile) => {
|
|
94
|
-
// Profile saved to blockchain
|
|
95
|
-
}}
|
|
96
|
-
/>
|
|
97
|
-
|
|
98
|
-
// Manage identity keys
|
|
99
|
-
<BapKeyRotationManager
|
|
100
|
-
onRotation={(newKey) => {
|
|
101
|
-
// Identity key rotated
|
|
102
|
-
}}
|
|
103
|
-
/>
|
|
104
|
-
\`\`\`
|
|
105
|
-
|
|
106
|
-
## Identity Operations
|
|
107
|
-
|
|
108
|
-
1. **Creation**: Generate new BAP identity
|
|
109
|
-
2. **Publishing**: Publish profile data to blockchain
|
|
110
|
-
3. **Discovery**: Find identities by various criteria
|
|
111
|
-
4. **Verification**: Verify identity authenticity
|
|
112
|
-
5. **Social Actions**: Follow, message, attest
|
|
113
|
-
|
|
114
|
-
## Security Features
|
|
115
|
-
|
|
116
|
-
- **Key Rotation**: Regularly rotate identity keys
|
|
117
|
-
- **Attestations**: Cryptographic proof of claims
|
|
118
|
-
- **Revocation**: Ability to revoke compromised keys
|
|
119
|
-
- **Backup**: Secure backup and recovery processes`,
|
|
120
|
-
},
|
|
121
|
-
"bmap-social": {
|
|
122
|
-
title: "Bitcoin Map (BMAP) Social Protocol",
|
|
123
|
-
description: "Social media infrastructure built on Bitcoin SV blockchain",
|
|
124
|
-
content: `# Bitcoin Map (BMAP) Social Protocol
|
|
125
|
-
|
|
126
|
-
BMAP is a social media protocol that stores posts, likes, follows, and other social interactions directly on the Bitcoin SV blockchain.
|
|
127
|
-
|
|
128
|
-
## Social Primitives
|
|
129
|
-
|
|
130
|
-
### Posts
|
|
131
|
-
- **Text Posts**: Simple text content
|
|
132
|
-
- **Media Posts**: Images, videos, documents
|
|
133
|
-
- **Replies**: Threaded conversations
|
|
134
|
-
- **Quotes**: Quote posts with commentary
|
|
135
|
-
|
|
136
|
-
### Interactions
|
|
137
|
-
- **Likes**: Express appreciation for content
|
|
138
|
-
- **Follows**: Subscribe to user content
|
|
139
|
-
- **Shares**: Republish content
|
|
140
|
-
- **Comments**: Engage in discussions
|
|
141
|
-
|
|
142
|
-
## Using BMAP in BigBlocks
|
|
143
|
-
|
|
144
|
-
BigBlocks provides full BMAP social functionality:
|
|
145
|
-
|
|
146
|
-
\`\`\`tsx
|
|
147
|
-
import {
|
|
148
|
-
PostButton,
|
|
149
|
-
LikeButton,
|
|
150
|
-
FollowButton,
|
|
151
|
-
SocialFeed,
|
|
152
|
-
PostCard
|
|
153
|
-
} from 'bigblocks';
|
|
154
|
-
|
|
155
|
-
// Create posts
|
|
156
|
-
<PostButton
|
|
157
|
-
onSuccess={(txid) => {
|
|
158
|
-
console.log('Post published:', txid);
|
|
159
|
-
}}
|
|
160
|
-
encryption={false} // Optional encryption
|
|
161
|
-
/>
|
|
162
|
-
|
|
163
|
-
// Like posts
|
|
164
|
-
<LikeButton
|
|
165
|
-
postTxid="transaction_id"
|
|
166
|
-
onLike={(liked) => {
|
|
167
|
-
console.log('Post liked:', liked);
|
|
168
|
-
}}
|
|
169
|
-
/>
|
|
170
|
-
|
|
171
|
-
// Follow users
|
|
172
|
-
<FollowButton
|
|
173
|
-
userBapId="user_identity"
|
|
174
|
-
onFollow={(following) => {
|
|
175
|
-
console.log('User followed:', following);
|
|
176
|
-
}}
|
|
177
|
-
/>
|
|
178
|
-
|
|
179
|
-
// Display social feed
|
|
180
|
-
<SocialFeed
|
|
181
|
-
posts={posts}
|
|
182
|
-
onLoadMore={() => {
|
|
183
|
-
// Load more posts
|
|
184
|
-
}}
|
|
185
|
-
/>
|
|
186
|
-
\`\`\`
|
|
187
|
-
|
|
188
|
-
## Data Ownership
|
|
189
|
-
|
|
190
|
-
- **User Control**: Users own their social data
|
|
191
|
-
- **Censorship Resistance**: No central authority can delete content
|
|
192
|
-
- **Portability**: Data can be accessed by any BMAP-compatible app
|
|
193
|
-
- **Monetization**: Direct micropayments for content
|
|
194
|
-
|
|
195
|
-
## Privacy Options
|
|
196
|
-
|
|
197
|
-
- **Public Posts**: Visible to everyone
|
|
198
|
-
- **Encrypted Posts**: Only visible to intended recipients
|
|
199
|
-
- **Group Posts**: Shared with specific groups
|
|
200
|
-
- **Private Messages**: Direct encrypted communication`,
|
|
201
|
-
},
|
|
202
|
-
"bitcoin-authentication": {
|
|
203
|
-
title: "Bitcoin-based Authentication",
|
|
204
|
-
description: "Secure authentication using Bitcoin cryptographic signatures",
|
|
205
|
-
content: `# Bitcoin-based Authentication
|
|
206
|
-
|
|
207
|
-
Bitcoin authentication uses cryptographic signatures to prove identity without passwords or centralized services.
|
|
208
|
-
|
|
209
|
-
## How It Works
|
|
210
|
-
|
|
211
|
-
1. **Key Generation**: User generates a Bitcoin key pair
|
|
212
|
-
2. **Challenge**: Server provides a challenge message
|
|
213
|
-
3. **Signing**: User signs challenge with private key
|
|
214
|
-
4. **Verification**: Server verifies signature with public key
|
|
215
|
-
|
|
216
|
-
## Advantages
|
|
217
|
-
|
|
218
|
-
- **No Passwords**: Eliminates password-related vulnerabilities
|
|
219
|
-
- **Self-Sovereign**: Users control their identity
|
|
220
|
-
- **Cryptographically Secure**: Based on Bitcoin's proven cryptography
|
|
221
|
-
- **Cross-Platform**: Works on any device with Bitcoin capabilities
|
|
222
|
-
|
|
223
|
-
## BigBlocks Implementation
|
|
224
|
-
|
|
225
|
-
BigBlocks makes Bitcoin auth simple:
|
|
226
|
-
|
|
227
|
-
\`\`\`tsx
|
|
228
|
-
import {
|
|
229
|
-
BitcoinAuthProvider,
|
|
230
|
-
AuthFlowOrchestrator,
|
|
231
|
-
AuthButton
|
|
232
|
-
} from 'bigblocks';
|
|
233
|
-
|
|
234
|
-
// Setup authentication provider
|
|
235
|
-
<BitcoinAuthProvider config={authConfig}>
|
|
236
|
-
<App />
|
|
237
|
-
</BitcoinAuthProvider>
|
|
238
|
-
|
|
239
|
-
// Complete authentication flow
|
|
240
|
-
<AuthFlowOrchestrator
|
|
241
|
-
flowType="unified"
|
|
242
|
-
onSuccess={(user) => {
|
|
243
|
-
console.log('Authenticated:', user);
|
|
244
|
-
}}
|
|
245
|
-
/>
|
|
246
|
-
|
|
247
|
-
// Simple auth button
|
|
248
|
-
<AuthButton
|
|
249
|
-
variant="solid"
|
|
250
|
-
onSuccess={(session) => {
|
|
251
|
-
// User authenticated
|
|
252
|
-
}}
|
|
253
|
-
/>
|
|
254
|
-
\`\`\`
|
|
255
|
-
|
|
256
|
-
## Security Considerations
|
|
257
|
-
|
|
258
|
-
- **Key Storage**: Secure storage of private keys
|
|
259
|
-
- **Challenge Freshness**: Use fresh challenges to prevent replay
|
|
260
|
-
- **Signature Validation**: Proper verification of signatures
|
|
261
|
-
- **Key Rotation**: Regular rotation of authentication keys
|
|
262
|
-
|
|
263
|
-
## Integration Patterns
|
|
264
|
-
|
|
265
|
-
- **Session Management**: Maintain authenticated sessions
|
|
266
|
-
- **Role-Based Access**: Different authentication levels
|
|
267
|
-
- **Multi-Device**: Sync authentication across devices
|
|
268
|
-
- **Backup/Recovery**: Secure key backup and recovery`,
|
|
269
|
-
},
|
|
270
|
-
"bitcoin-payments": {
|
|
271
|
-
title: "Bitcoin Payments and Wallets",
|
|
272
|
-
description: "Integrating Bitcoin payments into applications",
|
|
273
|
-
content: `# Bitcoin Payments and Wallets
|
|
274
|
-
|
|
275
|
-
BigBlocks provides comprehensive Bitcoin payment functionality for building wallet applications and payment flows.
|
|
276
|
-
|
|
277
|
-
## Core Payment Features
|
|
278
|
-
|
|
279
|
-
### Sending Payments
|
|
280
|
-
- **Address Validation**: Ensure valid recipient addresses
|
|
281
|
-
- **Amount Calculation**: Handle satoshi/BSV conversions
|
|
282
|
-
- **Fee Management**: Automatic fee calculation
|
|
283
|
-
- **Transaction Building**: Construct valid Bitcoin transactions
|
|
284
|
-
|
|
285
|
-
### Receiving Payments
|
|
286
|
-
- **Address Generation**: Create unique receiving addresses
|
|
287
|
-
- **Payment Monitoring**: Watch for incoming transactions
|
|
288
|
-
- **Confirmation Tracking**: Monitor transaction confirmations
|
|
289
|
-
- **Webhook Integration**: Real-time payment notifications
|
|
290
|
-
|
|
291
|
-
## BigBlocks Wallet Components
|
|
292
|
-
|
|
293
|
-
\`\`\`tsx
|
|
294
|
-
import {
|
|
295
|
-
SendBSVButton,
|
|
296
|
-
WalletOverview,
|
|
297
|
-
TokenBalance,
|
|
298
|
-
QuickSendButton,
|
|
299
|
-
DonateButton
|
|
300
|
-
} from 'bigblocks';
|
|
301
|
-
|
|
302
|
-
// Complete wallet interface
|
|
303
|
-
<WalletOverview
|
|
304
|
-
showHistory={true}
|
|
305
|
-
showTokens={true}
|
|
306
|
-
/>
|
|
307
|
-
|
|
308
|
-
// Send Bitcoin
|
|
309
|
-
<SendBSVButton
|
|
310
|
-
amount={0.001} // BSV amount
|
|
311
|
-
address="recipient_address"
|
|
312
|
-
onSuccess={(txid) => {
|
|
313
|
-
console.log('Payment sent:', txid);
|
|
314
|
-
}}
|
|
315
|
-
/>
|
|
316
|
-
|
|
317
|
-
// Quick payment buttons
|
|
318
|
-
<QuickSendButton
|
|
319
|
-
presetAmounts={[0.001, 0.01, 0.1]}
|
|
320
|
-
recipient="user_address"
|
|
321
|
-
/>
|
|
322
|
-
|
|
323
|
-
// Donation interface
|
|
324
|
-
<DonateButton
|
|
325
|
-
recipient="charity_address"
|
|
326
|
-
amounts={[0.01, 0.05, 0.1]}
|
|
327
|
-
message="Thank you!"
|
|
328
|
-
/>
|
|
329
|
-
\`\`\`
|
|
330
|
-
|
|
331
|
-
## Payment Security
|
|
332
|
-
|
|
333
|
-
- **Private Key Management**: Secure key storage and handling
|
|
334
|
-
- **Transaction Verification**: Validate before broadcasting
|
|
335
|
-
- **Double-Spend Protection**: Monitor for conflicting transactions
|
|
336
|
-
- **Backup Strategies**: Secure wallet backup and recovery
|
|
337
|
-
|
|
338
|
-
## UTXO Management
|
|
339
|
-
|
|
340
|
-
- **UTXO Selection**: Efficient coin selection algorithms
|
|
341
|
-
- **Change Handling**: Proper change address management
|
|
342
|
-
- **Dust Prevention**: Avoid creating uneconomical outputs
|
|
343
|
-
- **Consolidation**: Merge small UTXOs when beneficial
|
|
344
|
-
|
|
345
|
-
## Testing and Development
|
|
346
|
-
|
|
347
|
-
- **Testnet Support**: Use testnet for development
|
|
348
|
-
- **Mock Payments**: Simulate payments without real money
|
|
349
|
-
- **Transaction Preview**: Show transaction details before sending
|
|
350
|
-
- **Droplet Integration**: Use droplit faucets for testing`,
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const docsSchema = z.object({
|
|
355
|
-
concept: z
|
|
356
|
-
.string()
|
|
357
|
-
.optional()
|
|
358
|
-
.describe(
|
|
359
|
-
"Specific concept to learn about (type-42-keys, bap-identity, bmap-social, bitcoin-authentication, bitcoin-payments)",
|
|
360
|
-
),
|
|
361
|
-
search: z.string().optional().describe("Search term to find concepts"),
|
|
362
|
-
listAll: z.boolean().optional().describe("List all available concepts"),
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Register the BigBlocks documentation tool
|
|
367
|
-
*/
|
|
368
|
-
export function registerBigBlocksDocsTool(server: McpServer): void {
|
|
369
|
-
server.tool(
|
|
370
|
-
"bigblocks_docs",
|
|
371
|
-
"Learn about Bitcoin and BigBlocks concepts. Get detailed explanations of key technologies, protocols, and implementation patterns.\n\n" +
|
|
372
|
-
"Available concepts:\n" +
|
|
373
|
-
"- type-42-keys: Enhanced Bitcoin key derivation system\n" +
|
|
374
|
-
"- bap-identity: Decentralized identity on Bitcoin\n" +
|
|
375
|
-
"- bmap-social: Social media protocol on Bitcoin\n" +
|
|
376
|
-
"- bitcoin-authentication: Cryptographic authentication\n" +
|
|
377
|
-
"- bitcoin-payments: Payment integration patterns\n\n" +
|
|
378
|
-
"Usage examples:\n" +
|
|
379
|
-
'- Learn about concept: {"concept": "type-42-keys"}\n' +
|
|
380
|
-
'- Search concepts: {"search": "identity"}\n' +
|
|
381
|
-
'- List all: {"listAll": true}',
|
|
382
|
-
{ args: docsSchema },
|
|
383
|
-
async ({ args }) => {
|
|
384
|
-
try {
|
|
385
|
-
const { concept, search, listAll } = args;
|
|
386
|
-
|
|
387
|
-
// Show specific concept
|
|
388
|
-
if (concept) {
|
|
389
|
-
const conceptData = BIGBLOCKS_CONCEPTS[concept];
|
|
390
|
-
if (!conceptData) {
|
|
391
|
-
const available = Object.keys(BIGBLOCKS_CONCEPTS).join(", ");
|
|
392
|
-
return {
|
|
393
|
-
content: [
|
|
394
|
-
{
|
|
395
|
-
type: "text",
|
|
396
|
-
text: `Concept "${concept}" not found. Available concepts: ${available}`,
|
|
397
|
-
},
|
|
398
|
-
],
|
|
399
|
-
isError: true,
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return {
|
|
404
|
-
content: [
|
|
405
|
-
{
|
|
406
|
-
type: "text",
|
|
407
|
-
text: conceptData.content,
|
|
408
|
-
},
|
|
409
|
-
],
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Search concepts
|
|
414
|
-
if (search) {
|
|
415
|
-
const searchTerm = search.toLowerCase();
|
|
416
|
-
let results = `# BigBlocks Concepts Search: "${search}"\n\n`;
|
|
417
|
-
let found = false;
|
|
418
|
-
|
|
419
|
-
for (const [conceptKey, conceptData] of Object.entries(
|
|
420
|
-
BIGBLOCKS_CONCEPTS,
|
|
421
|
-
)) {
|
|
422
|
-
if (
|
|
423
|
-
conceptKey.toLowerCase().includes(searchTerm) ||
|
|
424
|
-
conceptData.title.toLowerCase().includes(searchTerm) ||
|
|
425
|
-
conceptData.description.toLowerCase().includes(searchTerm) ||
|
|
426
|
-
conceptData.content.toLowerCase().includes(searchTerm)
|
|
427
|
-
) {
|
|
428
|
-
found = true;
|
|
429
|
-
results += `## ${conceptData.title}\n`;
|
|
430
|
-
results += `${conceptData.description}\n`;
|
|
431
|
-
results += `**Key:** \`${conceptKey}\`\n\n`;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (!found) {
|
|
436
|
-
results += "No concepts found matching your search.";
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
return { content: [{ type: "text", text: results }] };
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// List all concepts
|
|
443
|
-
if (listAll) {
|
|
444
|
-
let result = "# BigBlocks Concepts\n\n";
|
|
445
|
-
result +=
|
|
446
|
-
"Comprehensive documentation of Bitcoin and BigBlocks technologies.\n\n";
|
|
447
|
-
|
|
448
|
-
for (const [conceptKey, conceptData] of Object.entries(
|
|
449
|
-
BIGBLOCKS_CONCEPTS,
|
|
450
|
-
)) {
|
|
451
|
-
result += `## ${conceptData.title}\n`;
|
|
452
|
-
result += `${conceptData.description}\n`;
|
|
453
|
-
result += `**Learn more:** Use {"concept": "${conceptKey}"}\n\n`;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return { content: [{ type: "text", text: result }] };
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// Default: show overview
|
|
460
|
-
return {
|
|
461
|
-
content: [
|
|
462
|
-
{
|
|
463
|
-
type: "text",
|
|
464
|
-
text: `# BigBlocks Documentation
|
|
465
|
-
|
|
466
|
-
Available concepts:
|
|
467
|
-
${Object.entries(BIGBLOCKS_CONCEPTS)
|
|
468
|
-
.map(([key, data]) => `- **${key}**: ${data.description}`)
|
|
469
|
-
.join("\n")}
|
|
470
|
-
|
|
471
|
-
Use {"concept": "conceptName"} to learn about a specific topic, or {"listAll": true} to see all available concepts.`,
|
|
472
|
-
},
|
|
473
|
-
],
|
|
474
|
-
};
|
|
475
|
-
} catch (error) {
|
|
476
|
-
return {
|
|
477
|
-
content: [
|
|
478
|
-
{
|
|
479
|
-
type: "text",
|
|
480
|
-
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
481
|
-
},
|
|
482
|
-
],
|
|
483
|
-
isError: true,
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
);
|
|
488
|
-
}
|