bsv-mcp 0.0.25 → 0.0.27
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 +52 -0
- package/README.md +53 -3
- package/index.ts +56 -17
- package/package.json +7 -3
- package/prompts/bsvSdk/auth.ts +61 -0
- package/prompts/bsvSdk/cryptography.ts +62 -0
- package/prompts/bsvSdk/index.ts +34 -0
- package/prompts/bsvSdk/overview.ts +105 -0
- package/prompts/bsvSdk/primitives.ts +69 -0
- package/prompts/bsvSdk/script.ts +70 -0
- package/prompts/bsvSdk/transaction.ts +249 -0
- package/prompts/bsvSdk/wallet.ts +188 -0
- package/prompts/index.ts +23 -0
- package/prompts/ordinals.ts +103 -0
- package/resources/brcs.ts +685 -0
- package/resources/changelog.ts +44 -0
- package/resources/resources.ts +17 -0
- package/tools/index.ts +50 -10
- package/tools/mnee/sendMnee.ts +10 -5
- package/tools/wallet/getAddress.ts +16 -13
- package/tools/wallet/tools.test.ts +0 -76
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# BSV MCP Server Changelog
|
|
2
|
+
|
|
3
|
+
## v0.0.27 - Enhanced Server Configuration & Maintenance
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
- **Improved Changelog Management**: Added changelog as a MCP resource so you can just ask what has changed between versions
|
|
7
|
+
- Simplified maintenance with single source of truth for version history
|
|
8
|
+
- Automatic updates to MCP resources when changelog is modified
|
|
9
|
+
- **Expanded Component Configuration**: Can now configure which components of the MCP are loaded by setting env vars. See the readme for more information.
|
|
10
|
+
|
|
11
|
+
### Technical Improvements
|
|
12
|
+
- Removed duplicate changelog content in code
|
|
13
|
+
- Better error handling for resource loading
|
|
14
|
+
- Code cleanup and organization improvements
|
|
15
|
+
|
|
16
|
+
## v0.0.25 - Improved Error Handling & Optional Private Key
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
- **Optional Private Key**: Server now starts without a PRIVATE_KEY_WIF environment variable
|
|
20
|
+
- Educational resources and non-wallet tools remain available in limited mode
|
|
21
|
+
- Wallet and MNEE tools gracefully fail with helpful error messages when no private key is provided
|
|
22
|
+
- **Component Configuration**: Added environment variables to enable/disable specific components
|
|
23
|
+
- Selectively enable/disable prompts, resources, or tools
|
|
24
|
+
- Fine-grained control over which tool categories are loaded
|
|
25
|
+
- **MNEE Token Support**: Added dedicated tools for MNEE token operations
|
|
26
|
+
- Get balance, send tokens, and parse transactions
|
|
27
|
+
- **Enhanced Documentation**: Added detailed prompt examples and improved troubleshooting guidance
|
|
28
|
+
- **Resource Improvements**: Added BRC specifications and other reference materials
|
|
29
|
+
|
|
30
|
+
### Technical Improvements
|
|
31
|
+
- Improved error handling throughout the codebase
|
|
32
|
+
- Better initialization process for wallet component
|
|
33
|
+
- Standardized error messages across tools
|
|
34
|
+
- Expanded README with installation instructions for different platforms
|
|
35
|
+
- Added npm alternatives to Bun commands
|
|
36
|
+
- Added modular loading with configurable components
|
|
37
|
+
|
|
38
|
+
## v0.0.24 - Initial Public Release
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
- Bitcoin SV wallet operations (send, receive, manage keys)
|
|
42
|
+
- Ordinals creation and management
|
|
43
|
+
- BSV blockchain interaction (transactions, blocks, addresses)
|
|
44
|
+
- Cryptographic operations (signing, verification, encryption)
|
|
45
|
+
- Educational prompts for BSV SDK and Ordinals
|
|
46
|
+
|
|
47
|
+
### Toolkit Overview
|
|
48
|
+
- Wallet tools for core BSV operations
|
|
49
|
+
- Ordinals tools for NFT functionality
|
|
50
|
+
- BSV tools for blockchain interaction
|
|
51
|
+
- MNEE token tools
|
|
52
|
+
- Utility tools for data conversion
|
package/README.md
CHANGED
|
@@ -38,6 +38,8 @@ This server implements the [Model Context Protocol](https://modelcontextprotocol
|
|
|
38
38
|
|
|
39
39
|

|
|
40
40
|
|
|
41
|
+
> **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.
|
|
42
|
+
|
|
41
43
|
### Cursor
|
|
42
44
|
|
|
43
45
|
To use the BSV MCP server with [Cursor](https://cursor.sh/):
|
|
@@ -110,9 +112,9 @@ Open the Claude configuration json file in your favorite text editor. If you pre
|
|
|
110
112
|
{
|
|
111
113
|
"mcpServers": {
|
|
112
114
|
"Bitcoin SV": {
|
|
113
|
-
"command": "
|
|
115
|
+
"command": "bun",
|
|
114
116
|
"args": [
|
|
115
|
-
"bsv-mcp@latest"
|
|
117
|
+
"run", "bsv-mcp@latest"
|
|
116
118
|
],
|
|
117
119
|
"env": {
|
|
118
120
|
"PRIVATE_KEY_WIF": "<your_private_key_wif>"
|
|
@@ -282,6 +284,11 @@ A collection of prompts providing detailed information about the Bitcoin SV SDK:
|
|
|
282
284
|
|
|
283
285
|
The server also provides access to Bitcoin Request for Comments (BRC) specifications and documentation:
|
|
284
286
|
|
|
287
|
+
#### Changelog Resource
|
|
288
|
+
- **Identifier**: `bsv-mcp-changelog`
|
|
289
|
+
- **Description**: Version history and changelog for the BSV MCP server.
|
|
290
|
+
- **Usage**: "Show me the BSV MCP changelog" or "What's new in the latest version?"
|
|
291
|
+
|
|
285
292
|
#### BRC Resources
|
|
286
293
|
- **BRCs Overview**
|
|
287
294
|
- **Identifier**: `brcs_readme`
|
|
@@ -333,6 +340,49 @@ When you interact with an MCP-enabled AI assistant:
|
|
|
333
340
|
4. The results are returned to the AI assistant
|
|
334
341
|
5. The assistant presents the information in a natural, conversational way
|
|
335
342
|
|
|
343
|
+
## Customization Options
|
|
344
|
+
|
|
345
|
+
The BSV MCP server can be customized using environment variables to enable or disable specific components:
|
|
346
|
+
|
|
347
|
+
### Component Configuration
|
|
348
|
+
|
|
349
|
+
| Environment Variable | Default | Description |
|
|
350
|
+
| -------------------- | ------- | ----------- |
|
|
351
|
+
| `DISABLE_PROMPTS` | `false` | Set to `true` to disable all educational prompts |
|
|
352
|
+
| `DISABLE_RESOURCES` | `false` | Set to `true` to disable all resources (BRCs, changelog) |
|
|
353
|
+
| `DISABLE_TOOLS` | `false` | Set to `true` to disable all tools |
|
|
354
|
+
|
|
355
|
+
### Tool-Specific Configuration
|
|
356
|
+
|
|
357
|
+
| Environment Variable | Default | Description |
|
|
358
|
+
| -------------------- | ------- | ----------- |
|
|
359
|
+
| `DISABLE_WALLET_TOOLS` | `false` | Set to `true` to disable Bitcoin wallet tools |
|
|
360
|
+
| `DISABLE_MNEE_TOOLS` | `false` | Set to `true` to disable MNEE token tools |
|
|
361
|
+
| `DISABLE_BSV_TOOLS` | `false` | Set to `true` to disable BSV blockchain tools |
|
|
362
|
+
| `DISABLE_ORDINALS_TOOLS` | `false` | Set to `true` to disable Ordinals/NFT tools |
|
|
363
|
+
| `DISABLE_UTILS_TOOLS` | `false` | Set to `true` to disable utility tools |
|
|
364
|
+
| `DISABLE_A2B_TOOLS` | `false` | Set to `true` to disable agent-to-blockchain tools |
|
|
365
|
+
|
|
366
|
+
### Examples
|
|
367
|
+
|
|
368
|
+
Run with only educational resources and prompts, no tools:
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
DISABLE_TOOLS=true bunx bsv-mcp@latest
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
Run with only BSV tools, no wallet or other functionality:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
DISABLE_PROMPTS=true DISABLE_RESOURCES=true DISABLE_WALLET_TOOLS=true DISABLE_MNEE_TOOLS=true DISABLE_ORDINALS_TOOLS=true DISABLE_UTILS_TOOLS=true bunx bsv-mcp@latest
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Use all tools except wallet operations:
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
DISABLE_WALLET_TOOLS=true bunx bsv-mcp@latest
|
|
384
|
+
```
|
|
385
|
+
|
|
336
386
|
## Troubleshooting
|
|
337
387
|
|
|
338
388
|
If you're having issues with the BSV MCP server:
|
|
@@ -392,7 +442,7 @@ The tool supports the following endpoint categories and specific endpoints:
|
|
|
392
442
|
|
|
393
443
|
| Endpoint | Description | Required Parameters | Example Response |
|
|
394
444
|
| -------------------- | ----------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------- |
|
|
395
|
-
| `chain_info` | Network statistics, difficulty, and chain work | None | `{"chain":"main","blocks":826458,"headers":826458,"bestblockhash":"
|
|
445
|
+
| `chain_info` | Network statistics, difficulty, and chain work | None | `{"chain":"main","blocks":826458,"headers":826458,"bestblockhash":"0000000000..."}` |
|
|
396
446
|
| `chain_tips` | Current chain tips including heights and states | None | `[{"height":826458,"hash":"000000000000...","branchlen":0,"status":"active"}]` |
|
|
397
447
|
| `circulating_supply` | Current BSV circulating supply | None | `{"bsv":21000000}` |
|
|
398
448
|
| `peer_info` | Connected peer statistics | None | `[{"addr":"1.2.3.4:8333","services":"000000000000...","lastsend":1621234567}]` |
|
package/index.ts
CHANGED
|
@@ -5,9 +5,27 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
5
5
|
import { registerAllPrompts } from "./prompts";
|
|
6
6
|
import { registerResources } from "./resources/resources";
|
|
7
7
|
import { registerAllTools } from "./tools";
|
|
8
|
+
import { registerMneeTools } from "./tools/mnee";
|
|
8
9
|
import { registerWalletTools } from "./tools/wallet/tools";
|
|
9
10
|
import { Wallet } from "./tools/wallet/wallet";
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options from environment variables
|
|
14
|
+
*/
|
|
15
|
+
const CONFIG = {
|
|
16
|
+
// Whether to load various components
|
|
17
|
+
loadPrompts: process.env.DISABLE_PROMPTS !== "true",
|
|
18
|
+
loadResources: process.env.DISABLE_RESOURCES !== "true",
|
|
19
|
+
loadTools: process.env.DISABLE_TOOLS !== "true",
|
|
20
|
+
|
|
21
|
+
// Fine-grained tool category control
|
|
22
|
+
loadWalletTools: process.env.DISABLE_WALLET_TOOLS !== "true",
|
|
23
|
+
loadMneeTools: process.env.DISABLE_MNEE_TOOLS !== "true",
|
|
24
|
+
loadBsvTools: process.env.DISABLE_BSV_TOOLS !== "true",
|
|
25
|
+
loadOrdinalsTools: process.env.DISABLE_ORDINALS_TOOLS !== "true",
|
|
26
|
+
loadUtilsTools: process.env.DISABLE_UTILS_TOOLS !== "true",
|
|
27
|
+
loadA2bTools: process.env.DISABLE_A2B_TOOLS !== "true",
|
|
28
|
+
};
|
|
11
29
|
|
|
12
30
|
/**
|
|
13
31
|
* Try to initialize the private key from environment variables
|
|
@@ -52,7 +70,7 @@ function initializePrivateKey(): PrivateKey | undefined {
|
|
|
52
70
|
const privKey = initializePrivateKey();
|
|
53
71
|
|
|
54
72
|
const server = new McpServer(
|
|
55
|
-
{ name: "Bitcoin SV", version: "0.0.
|
|
73
|
+
{ name: "Bitcoin SV", version: "0.0.27" },
|
|
56
74
|
// {
|
|
57
75
|
// // Advertise only what you actually implement
|
|
58
76
|
// capabilities: {
|
|
@@ -71,25 +89,46 @@ const server = new McpServer(
|
|
|
71
89
|
// },
|
|
72
90
|
);
|
|
73
91
|
|
|
74
|
-
// Initialize wallet
|
|
92
|
+
// Initialize wallet and register tools based on configuration
|
|
75
93
|
let wallet: Wallet | null = null;
|
|
76
|
-
if (privKey) {
|
|
77
|
-
// Register MNEE tools
|
|
78
|
-
registerMneeTools(server);
|
|
79
|
-
// Initialize wallet with the private key
|
|
80
|
-
wallet = new Wallet(privKey);
|
|
81
|
-
// Register wallet tools
|
|
82
|
-
registerWalletTools(server, wallet);
|
|
83
|
-
}
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
if (CONFIG.loadTools) {
|
|
96
|
+
if (privKey) {
|
|
97
|
+
// Register MNEE tools if enabled
|
|
98
|
+
if (CONFIG.loadMneeTools) {
|
|
99
|
+
console.log("Registering MNEE tools");
|
|
100
|
+
registerMneeTools(server);
|
|
101
|
+
}
|
|
87
102
|
|
|
88
|
-
//
|
|
89
|
-
|
|
103
|
+
// Initialize wallet with the private key if wallet tools are enabled
|
|
104
|
+
if (CONFIG.loadWalletTools) {
|
|
105
|
+
console.log("Initializing wallet and registering wallet tools");
|
|
106
|
+
wallet = new Wallet(privKey);
|
|
107
|
+
registerWalletTools(server, wallet);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Register all other tools based on configuration
|
|
112
|
+
console.log("Registering other tools");
|
|
113
|
+
registerAllTools(server, {
|
|
114
|
+
enableBsvTools: CONFIG.loadBsvTools,
|
|
115
|
+
enableOrdinalsTools: CONFIG.loadOrdinalsTools,
|
|
116
|
+
enableUtilsTools: CONFIG.loadUtilsTools,
|
|
117
|
+
enableA2bTools: CONFIG.loadA2bTools,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
90
120
|
|
|
91
|
-
// Register
|
|
92
|
-
|
|
121
|
+
// Register resources if enabled
|
|
122
|
+
if (CONFIG.loadResources) {
|
|
123
|
+
console.log("Registering resources");
|
|
124
|
+
registerResources(server);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Register prompts if enabled
|
|
128
|
+
if (CONFIG.loadPrompts) {
|
|
129
|
+
console.log("Registering prompts");
|
|
130
|
+
registerAllPrompts(server);
|
|
131
|
+
}
|
|
93
132
|
|
|
94
133
|
// Connect to the transport
|
|
95
134
|
const transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "bsv-mcp",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.27",
|
|
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",
|
|
@@ -25,8 +25,13 @@
|
|
|
25
25
|
"*.ts",
|
|
26
26
|
"tools/*.ts",
|
|
27
27
|
"tools/**/*.ts",
|
|
28
|
+
"prompts/*.ts",
|
|
29
|
+
"prompts/**/*.ts",
|
|
30
|
+
"resources/*.ts",
|
|
31
|
+
"resources/**/*.ts",
|
|
28
32
|
"LICENSE",
|
|
29
33
|
"README.md",
|
|
34
|
+
"CHANGELOG.md",
|
|
30
35
|
"smithery.yaml"
|
|
31
36
|
],
|
|
32
37
|
"bin": {
|
|
@@ -51,7 +56,6 @@
|
|
|
51
56
|
},
|
|
52
57
|
"scripts": {
|
|
53
58
|
"lint": "biome check .",
|
|
54
|
-
"lint:fix": "biome check . --write"
|
|
55
|
-
"prepare": "chmod +x ./index.ts"
|
|
59
|
+
"lint:fix": "biome check . --write"
|
|
56
60
|
}
|
|
57
61
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
|
+
import type {
|
|
4
|
+
ServerNotification,
|
|
5
|
+
ServerRequest,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BSV SDK Authentication Prompt
|
|
10
|
+
*
|
|
11
|
+
* Provides detailed information about the authentication functionality in the BSV SDK,
|
|
12
|
+
* including identity protocols, certificates, and session management.
|
|
13
|
+
*/
|
|
14
|
+
export const BSV_SDK_AUTH_PROMPT = `
|
|
15
|
+
# BSV SDK - Authentication Module
|
|
16
|
+
|
|
17
|
+
The Authentication module in the BSV SDK provides robust mechanisms for identity management, peer authentication, and certificate handling on the Bitcoin SV blockchain.
|
|
18
|
+
|
|
19
|
+
## Key Components
|
|
20
|
+
|
|
21
|
+
This section includes a placeholder for detailed content about the BSV SDK authentication mechanisms.
|
|
22
|
+
|
|
23
|
+
## Core Features
|
|
24
|
+
|
|
25
|
+
- Identity management
|
|
26
|
+
- Certificate handling
|
|
27
|
+
- Peer authentication
|
|
28
|
+
- Session management
|
|
29
|
+
|
|
30
|
+
## Best Practices
|
|
31
|
+
|
|
32
|
+
1. **Security**: Follow best practices for authentication security
|
|
33
|
+
2. **Testing**: Test authentication flows thoroughly before production use
|
|
34
|
+
3. **Error Handling**: Implement proper error handling
|
|
35
|
+
|
|
36
|
+
For complete API documentation and additional authentication features, refer to the official BSV SDK documentation.
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Register the BSV SDK Authentication prompt with the MCP server
|
|
41
|
+
* @param server The MCP server instance
|
|
42
|
+
*/
|
|
43
|
+
export function registerAuthPrompt(server: McpServer): void {
|
|
44
|
+
server.prompt(
|
|
45
|
+
"bitcoin_sv_sdk_auth",
|
|
46
|
+
"Detailed information about the authentication functionality in the BSV SDK, including identity protocols, certificates, and session management.",
|
|
47
|
+
async (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {
|
|
48
|
+
return {
|
|
49
|
+
messages: [
|
|
50
|
+
{
|
|
51
|
+
role: "assistant",
|
|
52
|
+
content: {
|
|
53
|
+
type: "text",
|
|
54
|
+
text: BSV_SDK_AUTH_PROMPT,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
|
+
import type {
|
|
4
|
+
ServerNotification,
|
|
5
|
+
ServerRequest,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BSV SDK Cryptography Prompt
|
|
10
|
+
*
|
|
11
|
+
* Provides detailed information about the cryptographic functionality in the BSV SDK,
|
|
12
|
+
* including key generation, signing, encryption, and hashing.
|
|
13
|
+
*/
|
|
14
|
+
export const BSV_SDK_CRYPTOGRAPHY_PROMPT = `
|
|
15
|
+
# BSV SDK - Cryptography Module
|
|
16
|
+
|
|
17
|
+
The Cryptography module in the BSV SDK provides comprehensive tools for handling cryptographic operations required for secure Bitcoin transactions and applications.
|
|
18
|
+
|
|
19
|
+
## Key Cryptographic Operations
|
|
20
|
+
|
|
21
|
+
This section includes a placeholder for detailed content about the BSV SDK cryptographic operations.
|
|
22
|
+
|
|
23
|
+
## Core Features
|
|
24
|
+
|
|
25
|
+
- Key generation and management
|
|
26
|
+
- Digital signatures (ECDSA)
|
|
27
|
+
- Message signing and verification
|
|
28
|
+
- Encryption and decryption
|
|
29
|
+
- Hash functions (SHA-256, RIPEMD-160, etc.)
|
|
30
|
+
|
|
31
|
+
## Best Practices
|
|
32
|
+
|
|
33
|
+
1. **Key Security**: Always handle private keys securely
|
|
34
|
+
2. **Random Number Generation**: Use cryptographically secure random number generation
|
|
35
|
+
3. **Testing**: Verify cryptographic operations with known test vectors
|
|
36
|
+
|
|
37
|
+
For complete API documentation and additional cryptographic features, refer to the official BSV SDK documentation.
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Register the BSV SDK Cryptography prompt with the MCP server
|
|
42
|
+
* @param server The MCP server instance
|
|
43
|
+
*/
|
|
44
|
+
export function registerCryptographyPrompt(server: McpServer): void {
|
|
45
|
+
server.prompt(
|
|
46
|
+
"bitcoin_sv_sdk_cryptography",
|
|
47
|
+
"Detailed information about the cryptographic functionality in the BSV SDK, including key generation, signing, encryption, and hashing.",
|
|
48
|
+
async (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {
|
|
49
|
+
return {
|
|
50
|
+
messages: [
|
|
51
|
+
{
|
|
52
|
+
role: "assistant",
|
|
53
|
+
content: {
|
|
54
|
+
type: "text",
|
|
55
|
+
text: BSV_SDK_CRYPTOGRAPHY_PROMPT,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
|
|
3
|
+
import { registerAuthPrompt } from "./auth";
|
|
4
|
+
import { registerCryptographyPrompt } from "./cryptography";
|
|
5
|
+
// Import all prompt registration functions
|
|
6
|
+
import { registerOverviewPrompt } from "./overview";
|
|
7
|
+
import { registerPrimitivesPrompt } from "./primitives";
|
|
8
|
+
import { registerScriptPrompt } from "./script";
|
|
9
|
+
import { registerTransactionPrompt } from "./transaction";
|
|
10
|
+
import { registerWalletPrompt } from "./wallet";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Register all BSV SDK prompts with the MCP server
|
|
14
|
+
* @param server The MCP server instance
|
|
15
|
+
*/
|
|
16
|
+
export function registerAllBsvSdkPrompts(server: McpServer): void {
|
|
17
|
+
// Register all BSV SDK related prompts
|
|
18
|
+
registerOverviewPrompt(server);
|
|
19
|
+
registerWalletPrompt(server);
|
|
20
|
+
registerTransactionPrompt(server);
|
|
21
|
+
registerAuthPrompt(server);
|
|
22
|
+
registerCryptographyPrompt(server);
|
|
23
|
+
registerScriptPrompt(server);
|
|
24
|
+
registerPrimitivesPrompt(server);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Export all prompts
|
|
28
|
+
export { registerOverviewPrompt } from "./overview";
|
|
29
|
+
export { registerWalletPrompt } from "./wallet";
|
|
30
|
+
export { registerTransactionPrompt } from "./transaction";
|
|
31
|
+
export { registerAuthPrompt } from "./auth";
|
|
32
|
+
export { registerCryptographyPrompt } from "./cryptography";
|
|
33
|
+
export { registerScriptPrompt } from "./script";
|
|
34
|
+
export { registerPrimitivesPrompt } from "./primitives";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
|
+
import type {
|
|
4
|
+
ServerNotification,
|
|
5
|
+
ServerRequest,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BSV SDK Overview Prompt
|
|
10
|
+
*
|
|
11
|
+
* Provides a general overview of the Bitcoin SV SDK,
|
|
12
|
+
* including what it is, its purpose, and its main components.
|
|
13
|
+
*/
|
|
14
|
+
export const BSV_SDK_OVERVIEW_PROMPT = `
|
|
15
|
+
# BSV SDK - Overview
|
|
16
|
+
|
|
17
|
+
The BSV SDK is a comprehensive TypeScript/JavaScript library designed to provide a unified and modern
|
|
18
|
+
layer for developing scalable applications on the Bitcoin SV blockchain. This SDK addresses limitations
|
|
19
|
+
of previous tools by offering a fresh approach that adheres to the principles of SPV (Simplified Payment
|
|
20
|
+
Verification) while ensuring privacy and scalability.
|
|
21
|
+
|
|
22
|
+
## Core Objectives
|
|
23
|
+
|
|
24
|
+
- Provide a unified, modern API for Bitcoin SV development
|
|
25
|
+
- Enable secure, peer-to-peer operations
|
|
26
|
+
- Support SPV (Simplified Payment Verification) principles
|
|
27
|
+
- Ensure privacy and scalability in blockchain applications
|
|
28
|
+
- Simplify integration with the Bitcoin SV ecosystem
|
|
29
|
+
|
|
30
|
+
## Main Components
|
|
31
|
+
|
|
32
|
+
The BSV SDK is organized into several key modules:
|
|
33
|
+
|
|
34
|
+
1. **Wallet**: Manage keys, addresses, and UTXOs
|
|
35
|
+
2. **Transaction**: Build and manipulate Bitcoin transactions
|
|
36
|
+
3. **Auth**: Authentication and identity protocols
|
|
37
|
+
4. **Cryptography**: Signing, encryption, and verification
|
|
38
|
+
5. **Script**: Bitcoin scripting and contract capabilities
|
|
39
|
+
6. **Primitives**: Core data types and structures
|
|
40
|
+
7. **Messages**: Network message handling
|
|
41
|
+
8. **Overlay Tools**: Additional utilities and extensions
|
|
42
|
+
|
|
43
|
+
## Getting Started
|
|
44
|
+
|
|
45
|
+
To use the BSV SDK in your project:
|
|
46
|
+
|
|
47
|
+
\`\`\`bash
|
|
48
|
+
# Install with npm
|
|
49
|
+
npm install @bsv/sdk
|
|
50
|
+
|
|
51
|
+
# Or with yarn
|
|
52
|
+
yarn add @bsv/sdk
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
Then import the components you need:
|
|
56
|
+
|
|
57
|
+
\`\`\`typescript
|
|
58
|
+
import { PrivateKey, Transaction } from "@bsv/sdk";
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
## Use Cases
|
|
62
|
+
|
|
63
|
+
- Wallet applications
|
|
64
|
+
- Payment systems
|
|
65
|
+
- Smart contract platforms
|
|
66
|
+
- Token systems
|
|
67
|
+
- Identity solutions
|
|
68
|
+
- Data storage and verification
|
|
69
|
+
|
|
70
|
+
## Additional Resources
|
|
71
|
+
|
|
72
|
+
For detailed information about specific components, please see the dedicated prompts for each module:
|
|
73
|
+
- Wallet operations: Use prompt "bitcoin_sv_sdk_wallet"
|
|
74
|
+
- Transaction building: Use prompt "bitcoin_sv_sdk_transaction"
|
|
75
|
+
- Authentication: Use prompt "bitcoin_sv_sdk_auth"
|
|
76
|
+
- Cryptography: Use prompt "bitcoin_sv_sdk_cryptography"
|
|
77
|
+
- Scripting: Use prompt "bitcoin_sv_sdk_script"
|
|
78
|
+
- Primitives: Use prompt "bitcoin_sv_sdk_primitives"
|
|
79
|
+
|
|
80
|
+
For official documentation, visit the BSV Blockchain Libraries Project repository.
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Register the BSV SDK Overview prompt with the MCP server
|
|
85
|
+
* @param server The MCP server instance
|
|
86
|
+
*/
|
|
87
|
+
export function registerOverviewPrompt(server: McpServer): void {
|
|
88
|
+
server.prompt(
|
|
89
|
+
"bitcoin_sv_sdk_overview",
|
|
90
|
+
"General overview of the Bitcoin SV SDK, including its purpose and main components.",
|
|
91
|
+
async (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {
|
|
92
|
+
return {
|
|
93
|
+
messages: [
|
|
94
|
+
{
|
|
95
|
+
role: "assistant",
|
|
96
|
+
content: {
|
|
97
|
+
type: "text",
|
|
98
|
+
text: BSV_SDK_OVERVIEW_PROMPT,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
|
+
import type {
|
|
4
|
+
ServerNotification,
|
|
5
|
+
ServerRequest,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BSV SDK Primitives Prompt
|
|
10
|
+
*
|
|
11
|
+
* Provides detailed information about the primitive data types and structures in the BSV SDK,
|
|
12
|
+
* including Binary, Hex, Points, and other fundamental types.
|
|
13
|
+
*/
|
|
14
|
+
export const BSV_SDK_PRIMITIVES_PROMPT = `
|
|
15
|
+
# BSV SDK - Primitives Module
|
|
16
|
+
|
|
17
|
+
The Primitives module in the BSV SDK provides fundamental data types and structures that form the building blocks for working with Bitcoin transactions and blockchain data.
|
|
18
|
+
|
|
19
|
+
## Core Primitive Types
|
|
20
|
+
|
|
21
|
+
This section includes a placeholder for detailed content about the primitive types available in the BSV SDK.
|
|
22
|
+
|
|
23
|
+
## Key Primitives
|
|
24
|
+
|
|
25
|
+
- Binary data handling
|
|
26
|
+
- Hex string conversion
|
|
27
|
+
- Point and curve operations
|
|
28
|
+
- Bitcoin-specific data structures
|
|
29
|
+
- Network message formats
|
|
30
|
+
|
|
31
|
+
## Common Operations
|
|
32
|
+
|
|
33
|
+
- Serialization and deserialization
|
|
34
|
+
- Type conversion
|
|
35
|
+
- Data validation
|
|
36
|
+
- Encoding and decoding
|
|
37
|
+
|
|
38
|
+
## Best Practices
|
|
39
|
+
|
|
40
|
+
1. **Type Safety**: Use appropriate types for Bitcoin operations
|
|
41
|
+
2. **Validation**: Validate input data before processing
|
|
42
|
+
3. **Performance**: Consider performance implications when working with large data structures
|
|
43
|
+
|
|
44
|
+
For complete API documentation and additional information about primitives, refer to the official BSV SDK documentation.
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Register the BSV SDK Primitives prompt with the MCP server
|
|
49
|
+
* @param server The MCP server instance
|
|
50
|
+
*/
|
|
51
|
+
export function registerPrimitivesPrompt(server: McpServer): void {
|
|
52
|
+
server.prompt(
|
|
53
|
+
"bitcoin_sv_sdk_primitives",
|
|
54
|
+
"Detailed information about the primitive data types and structures in the BSV SDK, including Binary, Hex, Points, and other fundamental types.",
|
|
55
|
+
async (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {
|
|
56
|
+
return {
|
|
57
|
+
messages: [
|
|
58
|
+
{
|
|
59
|
+
role: "assistant",
|
|
60
|
+
content: {
|
|
61
|
+
type: "text",
|
|
62
|
+
text: BSV_SDK_PRIMITIVES_PROMPT,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
|
+
import type {
|
|
4
|
+
ServerNotification,
|
|
5
|
+
ServerRequest,
|
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BSV SDK Script Prompt
|
|
10
|
+
*
|
|
11
|
+
* Provides detailed information about the script functionality in the BSV SDK,
|
|
12
|
+
* including Bitcoin Script operations, locking and unlocking scripts, and OP_CODES.
|
|
13
|
+
*/
|
|
14
|
+
export const BSV_SDK_SCRIPT_PROMPT = `
|
|
15
|
+
# BSV SDK - Script Module
|
|
16
|
+
|
|
17
|
+
The Script module in the BSV SDK provides comprehensive tools for working with Bitcoin Script, the programming language used to specify conditions for spending Bitcoin.
|
|
18
|
+
|
|
19
|
+
## Bitcoin Script Basics
|
|
20
|
+
|
|
21
|
+
This section includes a placeholder for detailed content about Bitcoin Script and its implementation in the BSV SDK.
|
|
22
|
+
|
|
23
|
+
## Core Features
|
|
24
|
+
|
|
25
|
+
- Creating and manipulating scripts
|
|
26
|
+
- Locking script (scriptPubKey) creation
|
|
27
|
+
- Unlocking script (scriptSig) creation
|
|
28
|
+
- Script verification and execution
|
|
29
|
+
- Support for all Bitcoin OP_CODES
|
|
30
|
+
|
|
31
|
+
## Common Script Types
|
|
32
|
+
|
|
33
|
+
- P2PKH (Pay to Public Key Hash)
|
|
34
|
+
- P2PK (Pay to Public Key)
|
|
35
|
+
- P2MS (Multi-signature)
|
|
36
|
+
- OP_RETURN (Data storage)
|
|
37
|
+
- Custom scripts
|
|
38
|
+
|
|
39
|
+
## Best Practices
|
|
40
|
+
|
|
41
|
+
1. **Testing**: Test scripts thoroughly before production use
|
|
42
|
+
2. **Security**: Be aware of potential script vulnerabilities
|
|
43
|
+
3. **Compatibility**: Ensure scripts are compatible with network rules
|
|
44
|
+
|
|
45
|
+
For complete API documentation and additional script features, refer to the official BSV SDK documentation.
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Register the BSV SDK Script prompt with the MCP server
|
|
50
|
+
* @param server The MCP server instance
|
|
51
|
+
*/
|
|
52
|
+
export function registerScriptPrompt(server: McpServer): void {
|
|
53
|
+
server.prompt(
|
|
54
|
+
"bitcoin_sv_sdk_script",
|
|
55
|
+
"Detailed information about the script functionality in the BSV SDK, including Bitcoin Script operations, locking and unlocking scripts, and OP_CODES.",
|
|
56
|
+
async (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {
|
|
57
|
+
return {
|
|
58
|
+
messages: [
|
|
59
|
+
{
|
|
60
|
+
role: "assistant",
|
|
61
|
+
content: {
|
|
62
|
+
type: "text",
|
|
63
|
+
text: BSV_SDK_SCRIPT_PROMPT,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
}
|