bsv-mcp 0.0.35 → 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.
Files changed (71) hide show
  1. package/CHANGELOG.md +112 -1
  2. package/README.md +233 -4
  3. package/dist/index.js +111762 -0
  4. package/index.ts +804 -86
  5. package/next-env.d.ts +6 -0
  6. package/package.json +57 -15
  7. package/prompts/bsvSdk/index.ts +5 -5
  8. package/prompts/bsvSdk/transaction.ts +2 -2
  9. package/prompts/bsvSdk/wallet.ts +1 -1
  10. package/prompts/index.ts +1 -1
  11. package/resources/bitcom.ts +132 -0
  12. package/resources/resources.ts +7 -3
  13. package/smithery.yaml +3 -0
  14. package/test-mcp-server.ts +157 -0
  15. package/tools/bap/friend.ts +267 -0
  16. package/tools/bap/generate.test.ts +350 -0
  17. package/tools/bap/generate.ts +433 -0
  18. package/tools/bap/getCurrentAddress.ts +76 -0
  19. package/tools/bap/getId.test.ts +121 -0
  20. package/tools/bap/getId.ts +169 -0
  21. package/tools/bap/index.ts +111 -0
  22. package/tools/bap/types.ts +66 -0
  23. package/tools/bap/utils.ts +33 -0
  24. package/tools/bigblocks/components.ts +304 -0
  25. package/tools/bigblocks/docs.ts +488 -0
  26. package/tools/bigblocks/examples.ts +527 -0
  27. package/tools/bigblocks/generator.ts +485 -0
  28. package/tools/bigblocks/index.ts +23 -0
  29. package/tools/bsocial/bigblocksApiClient.ts +189 -0
  30. package/tools/bsocial/bmapFollow.ts +125 -0
  31. package/tools/bsocial/bmapLikes.ts +111 -0
  32. package/tools/bsocial/bmapReadPosts.ts +148 -0
  33. package/tools/bsocial/createPost.ts +136 -0
  34. package/tools/bsocial/index.ts +45 -0
  35. package/tools/bsocial/readPosts.ts +255 -0
  36. package/tools/bsv/decodeTransaction.ts +5 -1
  37. package/tools/constants.ts +21 -0
  38. package/tools/index.ts +103 -17
  39. package/tools/mnee/index.ts +8 -0
  40. package/tools/mnee/parseTx.ts +1 -1
  41. package/tools/mnee/sendMnee.ts +1 -1
  42. package/tools/utils/aip.ts +46 -0
  43. package/tools/utils/conversion.ts +1 -0
  44. package/tools/utils/errorHandler.ts +76 -0
  45. package/tools/utils/index.ts +45 -1
  46. package/tools/utils/installAgentMaster.ts +84 -0
  47. package/tools/utils/logger.ts +20 -0
  48. package/tools/utils/toolConfig.ts +80 -0
  49. package/tools/utils/toolRegistration.ts +66 -0
  50. package/tools/utils/transactionBuilder.ts +196 -0
  51. package/tools/wallet/a2bPublishAgent.ts +8 -4
  52. package/tools/wallet/a2bPublishMcp.ts +28 -24
  53. package/tools/wallet/createOrdinals.ts +4 -2
  54. package/tools/wallet/fetchPaymentUtxos.ts +44 -43
  55. package/tools/wallet/gatherCollectionInfo.ts +374 -0
  56. package/tools/wallet/getAddress.ts +13 -21
  57. package/tools/wallet/getBalance.ts +66 -0
  58. package/tools/wallet/getBalanceDroplet.ts +59 -0
  59. package/tools/wallet/integratedWallet.ts +120 -0
  60. package/tools/wallet/mintCollection.ts +378 -0
  61. package/tools/wallet/purchaseListing.ts +4 -4
  62. package/tools/wallet/schemas.ts +18 -249
  63. package/tools/wallet/sendOrdinals.ts +4 -2
  64. package/tools/wallet/sendToAddress.ts +5 -1
  65. package/tools/wallet/setupDroplet.ts +172 -0
  66. package/tools/wallet/tools.ts +71 -156
  67. package/tools/wallet/transactionHelper.ts +121 -0
  68. package/tools/wallet/transferOrdToken.ts +7 -4
  69. package/tools/wallet/utxo.ts +62 -0
  70. package/tools/wallet/wallet.ts +237 -234
  71. package/tools/a2b/call.ts +0 -32
package/CHANGELOG.md CHANGED
@@ -1,6 +1,117 @@
1
1
  # BSV MCP Server Changelog
2
2
 
3
- ## v0.0.35 - A2B Overlay Integration & Improved MCP Server Publishing
3
+ ## [0.2.0] - 2026-03-09
4
+
5
+ ### Breaking Changes
6
+ - **@bsv/sdk upgraded from v1 to v2** - All Buffer usage replaced with SDK Utils
7
+ - **SecureKeyManager no longer auto-prompts** - No browser popups on server startup
8
+ - `loadKeys(passphrase?)` accepts optional passphrase; skips .bep silently without one
9
+ - `saveKeys(keys, opts?)` saves unencrypted by default; encryption is opt-in
10
+ - Removed `autoMigrate` and `keepLegacy` config options
11
+
12
+ ### Changed
13
+ - Updated 27+ dependencies (biome v2, zod 4.x, MCP SDK 1.27, next 16.1)
14
+ - All `Buffer.from()`/`.toString()` replaced with `Utils.toArray()`/`toBase64()`/`toHex()`
15
+ - All `console.log` replaced with `console.error` for MCP stdio transport safety
16
+ - Dynamic imports replaced with static imports
17
+ - tsconfig target ES2017 to ES2022
18
+ - Biome migrated to v2 schema with CSS exclusions
19
+ - `@types/node` and `bun` moved to devDependencies
20
+ - `export default` replaced with named exports
21
+
22
+ ### Removed
23
+ - Dead code: `tools/a2b/call.ts`, unused HD import, redundant default exports
24
+ - `.next` directory removed from git tracking
25
+ - `promptForPassphraseWithFallback` removed from keyManager (kept in passphrasePrompt.ts for future CLI use)
26
+
27
+ ### Fixed
28
+ - 3 failing BAP generate tests (proper SecureKeyManager mocking)
29
+ - BigblocksAuthProvider updated for renamed bigblocks exports
30
+ - Encrypted key storage preserved but no longer blocks server startup
31
+
32
+ ## [0.1.0] - 2025-01-20
33
+
34
+ ### Security
35
+ - **BREAKING**: Removed `BSV_MCP_PASSPHRASE` environment variable (major security fix)
36
+ - Passphrases are no longer stored in environment variables
37
+ - System now prompts for passphrases dynamically when needed
38
+ - Added web-based passphrase prompt for better UX
39
+ - Migration script updated to work with new system
40
+
41
+ ### Added
42
+ - **Dynamic Passphrase Prompting**: Secure passphrase entry via temporary web interface
43
+ - Opens browser window for passphrase entry
44
+ - Automatically closes after submission
45
+ - Supports both new passphrase creation and unlocking
46
+ - Timeout protection (5 minutes default)
47
+
48
+ - **Agent Master CLI Integration**: New tool for installing Agent Master CLI
49
+ - `utils_installAgentMaster`: Installs the Agent Master CLI tool for managing MCP server configurations
50
+ - Supports installation via Go or provides manual installation instructions
51
+ - Helps users manage MCP servers across multiple platforms (Claude, VS Code, Cursor, etc.)
52
+ - Repository: github.com/b-open-io/agent-master-cli
53
+
54
+ ### Changed
55
+ - Key encryption now happens automatically on first run if keys are unencrypted
56
+ - Updated migration script to use dynamic prompting instead of env vars
57
+ - Improved security warnings and user guidance throughout the system
58
+ - Default `BSV_MCP_AUTO_MIGRATE` changed to `true`
59
+ - **Social Posts**: Create and read social posts on the BSV blockchain
60
+ - `bsv_createPost`: Post text or markdown content using B:// and MAP protocols with AIP signing
61
+ - `bsv_readPosts`: Read posts from the blockchain with filtering by author, txid, or recent posts
62
+ - Permanent, uncensorable social content stored directly on-chain
63
+ - Support for plain text and markdown content types
64
+ - Integration with BSocial API for reading posts
65
+ - **Collection Minter**: Two-step process for minting ordinal collections from folders
66
+ - `wallet_gatherCollectionInfo`: Analyzes folder contents, validates images, checks wallet balance, and estimates costs
67
+ - `wallet_mintCollection`: Creates collection inscription and mints all items with proper metadata
68
+ - Supports traits distribution, rarity labels, and automatic metadata generation
69
+ - Validates images and provides detailed cost estimates before minting
70
+ - Better error handling with pre-flight checks to minimize failures
71
+
72
+ - **Encrypted Key Storage**: Integration with bitcoin-backup for secure key management
73
+ - AES-256-GCM encryption with 600,000 PBKDF2 iterations
74
+ - Automatic migration from unencrypted to encrypted format
75
+ - Backward compatibility with legacy JSON storage
76
+ - Secure key backup management
77
+ - New environment variable: `BSV_MCP_PASSPHRASE`
78
+ - Migration script: `scripts/migrate-keys.ts`
79
+
80
+ ### Changed
81
+ - Server name and version now imported from package.json
82
+ - Improved error handling with standardized error types
83
+ - Better code organization with new utility modules
84
+
85
+ ## v0.1.0 - Droplet API Integration & Claude Code CLI Support
86
+
87
+ ### Major Features
88
+ - **Droplet API Integration**: Added support for running without local keys using Droplet faucet API
89
+ - New `IntegratedWallet` class supports both local and remote wallet modes
90
+ - BSM (Bitcoin Signed Message) authentication for Droplet API communication
91
+ - Environment variable configuration: `USE_DROPLET_API`, `DROPLET_API_URL`, `DROPLET_FAUCET_NAME`
92
+ - Automatic faucet funding and transaction broadcasting through Droplet service
93
+ - **Claude Code CLI Compatibility**: Fixed stdio transport configuration for seamless Claude Code integration
94
+ - Updated smithery.yaml configuration for proper MCP CLI operation
95
+ - Enhanced testing and debugging workflows with Claude CLI
96
+
97
+ ### Technical Improvements
98
+ - Created `DropletClient` class for robust API communication with go-faucet-api
99
+ - Added comprehensive error handling and validation for Droplet operations
100
+ - Enhanced documentation with testing instructions and troubleshooting guides
101
+ - Improved dual-mode wallet architecture maintaining backward compatibility
102
+ - Updated development documentation with detailed testing workflows
103
+
104
+ ### Environment Variables
105
+ - `USE_DROPLET_API`: Enable Droplet API mode (default: false)
106
+ - `DROPLET_API_URL`: Droplet service endpoint (default: http://localhost:4000)
107
+ - `DROPLET_FAUCET_NAME`: Faucet name for API operations (required in Droplet mode)
108
+ - `TRANSPORT`: MCP transport mode (stdio/http) for Claude Code compatibility
109
+
110
+ ## v0.0.37 - Resource Updates
111
+ - Added AIP protocol docs
112
+ - Added 1Sat Ordinals docs
113
+
114
+ ## v0.0.36 - A2B Overlay Integration & Improved MCP Server Publishing
4
115
 
5
116
  ### Features
6
117
  - **A2B Overlay Integration**: Implemented a robust connection to the A2B Overlay API
package/README.md CHANGED
@@ -8,9 +8,43 @@
8
8
 
9
9
  A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) framework. This library provides wallet, ordinals, and utility functions for BSV blockchain interaction.
10
10
 
11
- ## Installation and Setup
11
+ ## Installation Options
12
12
 
13
- ### Use Bun (Optional but recommended)
13
+ ### Option 1: Hosted Version (FREE - No BSV Required!)
14
+
15
+ **The easiest way to get started!** Use our hosted version with OAuth 2.1 authentication:
16
+
17
+ 1. **Configure:** Add the MCP server configuration to your IDE
18
+ 2. **Authenticate:** Sign in with your Bitcoin wallet via sigma-auth
19
+ 3. **Use:** Start using BSV features immediately - no BSV needed!
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "bsv-mcp-hosted": {
25
+ "url": "https://bsv-mcp.rohenaz.workers.dev/mcp",
26
+ "headers": {
27
+ "Authorization": "Bearer YOUR_ACCESS_TOKEN"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ To get your access token, authenticate at https://auth.sigmaidentity.com
35
+
36
+ **Benefits:**
37
+ - ✅ No Bitcoin required - we pay for everything
38
+ - ✅ Secure OAuth 2.1 authentication with Bitcoin signatures
39
+ - ✅ Instant setup - no installation needed
40
+ - ✅ Always up-to-date
41
+ - ✅ Global availability via Cloudflare
42
+
43
+ ### Option 2: Self-Hosted Installation
44
+
45
+ #### Prerequisites
46
+
47
+ **Use Bun (Optional but recommended)
14
48
 
15
49
  This project is built using [Bun](https://bun.sh/), a fast JavaScript runtime and package manager. While Bun is recommended for best performance, the server can also run with Node.js and npm as Bun is designed to be backward compatible with node.
16
50
 
@@ -39,9 +73,37 @@ This server implements the [Model Context Protocol](https://modelcontextprotocol
39
73
 
40
74
  > **Note:** The `PRIVATE_KEY_WIF` environment variable is now optional. Without it, the server runs in limited mode with educational resources and non-wallet tools available. Wallet and MNEE token operations require a valid private key. You can also set the `IDENTITY_KEY_WIF` environment variable to enable sigma-protocol signing of ordinals inscriptions for authentication, curation, and web-of-trust.
41
75
 
76
+ ### Claude Code
77
+
78
+ To use the BSV MCP server with [Claude Code](https://github.com/anthropics/claude-code):
79
+
80
+ ```bash
81
+ # Using bunx (recommended)
82
+ claude mcp add bsv-mcp "bunx bsv-mcp@latest"
83
+
84
+ # Or using npx
85
+ claude mcp add bsv-mcp "npx bsv-mcp@latest"
86
+ ```
87
+
88
+ To add with environment variables:
89
+ ```bash
90
+ claude mcp add bsv-mcp "bunx bsv-mcp@latest" -e PRIVATE_KEY_WIF=your_key -e IDENTITY_KEY_WIF=your_identity_key
91
+ ```
92
+
93
+ For encrypted key storage (recommended):
94
+ ```bash
95
+ claude mcp add bsv-mcp "bunx bsv-mcp@latest" -e BSV_MCP_PASSPHRASE="your-secure-passphrase"
96
+ ```
97
+
98
+ **Note:** The server automatically runs in stdio mode when used with Claude Code CLI.
99
+
42
100
  ### Cursor
43
101
 
44
- To use the BSV MCP server with [Cursor](https://cursor.sh/):
102
+ [![Add BSV MCP server to Cursor](https://img.shields.io/badge/Add%20to%20Cursor-000000?style=for-the-badge&logo=cursor&logoColor=white)](cursor://anysphere.cursor-deeplink/mcp/install?name=bsv-mcp&config=eyJjb21tYW5kIjoiYnVueCIsImFyZ3MiOlsiYnN2LW1jcEBsYXRlc3QiXX0=)
103
+
104
+ **Quick Install:** Click the button above to automatically add the BSV MCP server to Cursor! This will install the server with the basic configuration using `bunx bsv-mcp@latest`.
105
+
106
+ **Manual Setup:** To manually configure the BSV MCP server with [Cursor](https://cursor.sh/):
45
107
 
46
108
  1. Install Cursor if you haven't already
47
109
  2. Open Cursor and navigate to Settings → Extensions → Model Context Protocol
@@ -134,6 +196,28 @@ Open the Claude configuration json file in your favorite text editor. If you pre
134
196
 
135
197
  If you prefer to use npm instead of Bun, replace the "command" field with "npx".
136
198
 
199
+ ### VS Code (CLI Method)
200
+
201
+ If you prefer using the command line, you can add the BSV MCP server to VS Code (which uses the same underlying settings as Cursor) directly:
202
+
203
+ **Using Bun (Recommended):**
204
+
205
+ ```bash
206
+ code --add-mcp '{"name":"Bitcoin SV","command":"bunx","args":["bsv-mcp@latest"],"env":{"PRIVATE_KEY_WIF":"<your_private_key_wif>","IDENTITY_KEY_WIF":"<your_identity_key_wif>"}}'
207
+ ```
208
+
209
+ **Using Node.js/npm:**
210
+
211
+ ```bash
212
+ code --add-mcp '{"name":"Bitcoin SV","command":"npx","args":["bsv-mcp@latest"],"env":{"PRIVATE_KEY_WIF":"<your_private_key_wif>","IDENTITY_KEY_WIF":"<your_identity_key_wif>"}}'
213
+ ```
214
+
215
+ - Replace `<your_private_key_wif>` with your actual private key WIF (optional, required for wallet tools).
216
+ - Replace `<your_identity_key_wif>` with your identity key WIF (optional, enables Sigma protocol signing).
217
+ - Ensure the `code` command is in your system's PATH (it usually is if VS Code was installed normally).
218
+
219
+ This command adds the server configuration to your VS Code `settings.json` file under the `mcp.servers` key.
220
+
137
221
  ## Available Tools
138
222
 
139
223
  The toolkit is organized into several categories:
@@ -163,6 +247,15 @@ Tools for interacting with the BSV blockchain and network:
163
247
  | `bsv_decodeTransaction` | Decodes a BSV transaction and returns detailed information | `{"txid":"a1b2c3d4e5f6...","version":1,"locktime":0,"size":225,"inputs":[...],"outputs":[...]}` |
164
248
  | `bsv_explore` | Comprehensive blockchain explorer tool accessing WhatsOnChain API endpoints | `{"chain_info":{"chain":"main","blocks":826458,"headers":826458,"bestblockhash":"0000000000..."}}` |
165
249
 
250
+ ### BSocial Tools
251
+
252
+ Tools for social interactions on the BSV blockchain (requires wallet):
253
+
254
+ | Tool Name | Description | Example Output |
255
+ | ----------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
256
+ | `bsocial_createPost` | Creates a social post on the BSV blockchain using B:// and MAP protocols | `{"success":true,"txid":"a1b2c3d4e5f6...","rawTx":"0100000001..."}` |
257
+ | `bsocial_readPosts` | Reads social posts from the BSV blockchain with filtering options | `Post 1:\n TX ID: a1b2c3...\n Content: Hello BSV!\n Type: text/plain\n Author: 1Example...` |
258
+
166
259
  ### Ordinals Tools
167
260
 
168
261
  Tools for working with ordinals (NFTs) on BSV:
@@ -181,7 +274,32 @@ General-purpose utility functions:
181
274
 
182
275
  | Tool Name | Description | Example Output |
183
276
  | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
184
- | `utils_convertData` | Converts data between different encoding formats (utf8, hex, base64, binary).<br><br>**Parameters:**<br>- `data` (required): The string to convert<br>- `from` (required): Source encoding format (utf8, hex, base64, or binary)<br>- `to` (required): Target encoding format (utf8, hex, base64, or binary)<br><br>**Examples:**<br>- UTF-8 to hex: `{"data": "hello world", "from": "utf8", "to": "hex"}` → `68656c6c6f20776f726c64`<br>- UTF-8 to base64: `{"data": "Hello World", "from": "utf8", "to": "base64"}` → `SGVsbG8gV29ybGQ=`<br>- base64 to UTF-8: `{"data": "SGVsbG8gV29ybGQ=", "from": "base64", "to": "utf8"}` → `Hello World`<br>- hex to base64: `{"data": "68656c6c6f20776f726c64", "from": "hex", "to": "base64"}` → `aGVsbG8gd29ybGQ=`<br><br>**Notes:**<br>- All parameters are required<br>- The tool returns the converted data as a string<br>- For binary conversion, data is represented as an array of byte values | `"SGVsbG8gV29ybGQ="` (UTF-8 "Hello World" converted to base64) |
277
+ | `utils_convertData` | Converts data between different encodings (utf8, hex, base64, binary).
278
+ - **Args**:
279
+ - `data` (string, required): The data string to be converted.
280
+ - `from` (string, required): Source encoding format (utf8, hex, base64, or binary).
281
+ - `to` (string, required): Target encoding format (utf8, hex, base64, or binary).
282
+ - **Returns**: The converted data as a string.
283
+
284
+ ## BAP (Bitcoin Attestation Protocol) Tools
285
+
286
+ Tools for interacting with BAP identities.
287
+
288
+ ### `bap_getId`
289
+ Retrieves a Bitcoin Attestation Protocol (BAP) identity profile using an idKey.
290
+ - **Args**:
291
+ - `idKey` (string, optional): The Identity Key (Paymail or public key string) to fetch the profile for. If not provided, the tool attempts to use the server's configured identity key (derived from `IDENTITY_KEY_WIF` or the key file `~/.bsv-mcp/keys.json`).
292
+ - **Returns**: A JSON string containing the BAP identity data if found, or a message indicating that no identity was found for the given key. Returns an error if the API request fails or the key cannot be derived.
293
+
294
+ ### `bap_getCurrentAddress`
295
+ Retrieves the current BAP identity's Bitcoin SV address. This address is derived from the server's configured identity key.
296
+ - **Args**: None.
297
+ - **Returns**: A JSON object containing the `address` string.
298
+
299
+ ### `bap_generate`
300
+ Generates a new BAP HD master key (xprv) and saves it to `~/.bsv-mcp/keys.json`. This key can be used as a root for deriving multiple BAP identities.
301
+ - **Args**: None.
302
+ - **Returns**: A JSON object with the generated `xprv` string and a status message, or an error message if generation/saving fails.
185
303
 
186
304
  ### MNEE Tools
187
305
 
@@ -218,6 +336,26 @@ Once connected, you can use natural language to interact with Bitcoin SV through
218
336
  - "Show me BSV-20 token listings for ticker PEPE"
219
337
  - "Get recent BSV-20 token sales"
220
338
 
339
+ ### Collection Minting
340
+
341
+ The BSV MCP server provides a two-step process for minting ordinal collections from folders of images:
342
+
343
+ 1. **Gather Collection Info** (Pre-flight check)
344
+ - "Analyze the folder /path/to/my/nft-images for collection minting"
345
+ - "Check if I can mint a collection from ./my-art-folder"
346
+
347
+ This step will:
348
+ - Validate all images in the folder
349
+ - Check your wallet balance
350
+ - Estimate total costs
351
+ - Suggest collection metadata
352
+ - Report any issues before minting
353
+
354
+ 2. **Mint Collection** (Create the collection)
355
+ - "Mint a collection called 'My Art Collection' from /path/to/images with description 'Amazing digital art'"
356
+ - "Create an NFT collection from ./my-art-folder with traits: background=[red,blue,green], style=[vintage,modern]"
357
+ - "Mint collection with rarity labels: common=60%, rare=30%, legendary=10%"
358
+
221
359
  ### Blockchain Operations
222
360
 
223
361
  - "What is the current BSV price?"
@@ -232,6 +370,15 @@ Once connected, you can use natural language to interact with Bitcoin SV through
232
370
 
233
371
  - "Convert 'Hello World' from UTF-8 to hex format"
234
372
 
373
+ ### Social Posts
374
+
375
+ - "Create a post saying 'Hello BSV World!' on the blockchain"
376
+ - "Post a markdown message: # My First On-Chain Post\n\nThis is **bold** and *italic* text"
377
+ - "Read the latest social posts from the blockchain"
378
+ - "Read posts by BAP identity 1SomeIdentityKey..."
379
+ - "Get the post with transaction ID a1b2c3d4e5f6..."
380
+ - "Show me replies to post txid a1b2c3d4e5f6..."
381
+
235
382
  ## MCP Prompts and Resources
236
383
 
237
384
  The BSV MCP server exposes specialized prompts and resources that provide detailed information and context about Bitcoin SV technologies. These can be accessed by AI models to enhance their understanding and capabilities.
@@ -343,6 +490,44 @@ When you interact with an MCP-enabled AI assistant:
343
490
  4. The results are returned to the AI assistant
344
491
  5. The assistant presents the information in a natural, conversational way
345
492
 
493
+ ## Key Management & Security
494
+
495
+ ### Encrypted Key Storage (Recommended)
496
+
497
+ BSV MCP now supports encrypted key storage using [bitcoin-backup](https://github.com/b-open-io/bitcoin-backup) for enhanced security:
498
+
499
+ 1. **Set a passphrase** (minimum 8 characters):
500
+ ```bash
501
+ export BSV_MCP_PASSPHRASE="your-secure-passphrase"
502
+ ```
503
+
504
+ 2. **Automatic migration**: Keys will be automatically encrypted when a passphrase is provided
505
+
506
+ 3. **Manual migration**: Use the migration script:
507
+ ```bash
508
+ BSV_MCP_PASSPHRASE="your-passphrase" bun run scripts/migrate-keys.ts
509
+ ```
510
+
511
+ 4. **File locations**:
512
+ - Encrypted keys: `~/.bsv-mcp/keys.bep`
513
+ - Legacy keys: `~/.bsv-mcp/keys.json` (deprecated)
514
+ - Automatic backup: `~/.bsv-mcp/keys.bep.backup`
515
+
516
+ ### Security Best Practices
517
+
518
+ 1. **Use encrypted storage**: Always set `BSV_MCP_PASSPHRASE` for production use
519
+ 2. **Strong passphrases**: Use 12+ characters with mixed case, numbers, and symbols
520
+ 3. **Backup your keys**: Keep secure backups of both keys and passphrase
521
+ 4. **File permissions**: Key files are automatically created with restricted permissions (0600)
522
+
523
+ ### Environment Variables for Key Management
524
+
525
+ | Variable | Description | Default |
526
+ | -------- | ----------- | ------- |
527
+ | `BSV_MCP_PASSPHRASE` | Passphrase for encrypted key storage | None |
528
+ | `BSV_MCP_AUTO_MIGRATE` | Automatically migrate legacy keys | `false` |
529
+ | `BSV_MCP_KEEP_LEGACY` | Keep unencrypted keys after migration | `false` |
530
+
346
531
  ## Customization Options
347
532
 
348
533
  The BSV MCP server can be customized using environment variables to enable or disable specific components:
@@ -367,6 +552,43 @@ The BSV MCP server can be customized using environment variables to enable or di
367
552
  | `IDENTITY_KEY_WIF` | `not set` | Optional WIF for identity key; if set, ordinals inscriptions will be signed with sigma-protocol for authentication, curation, and web-of-trust. |
368
553
  | `DISABLE_BROADCASTING` | `false` | Set to `true` to disable transaction broadcasting; returns raw transaction hex instead - useful for testing and transaction review before broadcasting |
369
554
 
555
+ ### Droplet API Configuration
556
+
557
+ The BSV MCP server supports running in Droplet API mode, which allows operation without local private keys by using a remote faucet service:
558
+
559
+ | Environment Variable | Default | Description |
560
+ | -------------------- | ------- | ----------- |
561
+ | `USE_DROPLET_API` | `false` | Set to `true` to enable Droplet API mode for remote wallet operations |
562
+ | `DROPLET_API_URL` | `http://localhost:4000` | Base URL for the Droplet faucet API service |
563
+ | `DROPLET_FAUCET_NAME` | `not set` | Name of the faucet to use (required when `USE_DROPLET_API` is true) |
564
+ | `TRANSPORT` | `stdio` | MCP transport mode (stdio/http) - automatically set to stdio for Claude Code compatibility |
565
+
566
+ #### Droplet API Mode
567
+
568
+ When `USE_DROPLET_API=true` is set, the server operates in remote mode:
569
+
570
+ - **No Local Keys Required**: The server doesn't need `PRIVATE_KEY_WIF` or local key files
571
+ - **Remote Wallet Operations**: Transactions are funded and broadcast through the Droplet API
572
+ - **BSM Authentication**: Uses Bitcoin Signed Message (BSM) authentication for secure API communication
573
+ - **Automatic Funding**: The faucet automatically provides UTXOs for transactions
574
+ - **Seamless Integration**: All existing wallet tools work transparently with the remote service
575
+
576
+ #### Example Droplet Configuration
577
+
578
+ ```bash
579
+ # Enable Droplet API mode
580
+ USE_DROPLET_API=true
581
+ DROPLET_API_URL=https://your-droplet-service.com
582
+ DROPLET_FAUCET_NAME=your-faucet-name
583
+ TRANSPORT=stdio
584
+ ```
585
+
586
+ This mode is particularly useful for:
587
+ - **Development and Testing**: No need to manage local private keys
588
+ - **Educational Environments**: Safe experimentation without real funds
589
+ - **Shared Environments**: Multiple users can use the same faucet service
590
+ - **Simplified Deployment**: Reduced security concerns for demonstration purposes
591
+
370
592
  ### Examples
371
593
 
372
594
  Run with only educational resources and prompts, no tools:
@@ -574,6 +796,13 @@ bun test
574
796
  npm test
575
797
  ```
576
798
 
799
+
800
+ ## Troubleshooting
801
+
802
+ - Make sure you're on the latest version of bun
803
+ - Make sure the commands can be run directly from your cli
804
+ - Make sure you're on node v22+
805
+
577
806
  ## License
578
807
 
579
808
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.