bsv-mcp 0.0.26 → 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 +2 -2
- package/index.ts +3 -3
- 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 +5 -5
- 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
|
@@ -112,9 +112,9 @@ Open the Claude configuration json file in your favorite text editor. If you pre
|
|
|
112
112
|
{
|
|
113
113
|
"mcpServers": {
|
|
114
114
|
"Bitcoin SV": {
|
|
115
|
-
"command": "
|
|
115
|
+
"command": "bun",
|
|
116
116
|
"args": [
|
|
117
|
-
"bsv-mcp@latest"
|
|
117
|
+
"run", "bsv-mcp@latest"
|
|
118
118
|
],
|
|
119
119
|
"env": {
|
|
120
120
|
"PRIVATE_KEY_WIF": "<your_private_key_wif>"
|
package/index.ts
CHANGED
|
@@ -5,9 +5,9 @@ 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
|
-
import { registerMneeTools } from "./tools/mnee";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Configuration options from environment variables
|
|
@@ -17,7 +17,7 @@ const CONFIG = {
|
|
|
17
17
|
loadPrompts: process.env.DISABLE_PROMPTS !== "true",
|
|
18
18
|
loadResources: process.env.DISABLE_RESOURCES !== "true",
|
|
19
19
|
loadTools: process.env.DISABLE_TOOLS !== "true",
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
// Fine-grained tool category control
|
|
22
22
|
loadWalletTools: process.env.DISABLE_WALLET_TOOLS !== "true",
|
|
23
23
|
loadMneeTools: process.env.DISABLE_MNEE_TOOLS !== "true",
|
|
@@ -70,7 +70,7 @@ function initializePrivateKey(): PrivateKey | undefined {
|
|
|
70
70
|
const privKey = initializePrivateKey();
|
|
71
71
|
|
|
72
72
|
const server = new McpServer(
|
|
73
|
-
{ name: "Bitcoin SV", version: "0.0.
|
|
73
|
+
{ name: "Bitcoin SV", version: "0.0.27" },
|
|
74
74
|
// {
|
|
75
75
|
// // Advertise only what you actually implement
|
|
76
76
|
// capabilities: {
|
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
|
+
}
|