bsv-mcp 0.0.21 → 0.0.23
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/README.md +17 -40
- package/index.ts +28 -28
- package/package.json +4 -4
- package/tools/bsv/explore.ts +331 -261
- package/tools/bsv/getPrice.ts +19 -10
- package/tools/bsv/index.ts +1 -1
- package/tools/index.ts +10 -10
- package/tools/mnee/getBalance.ts +53 -43
- package/tools/mnee/index.ts +7 -7
- package/tools/mnee/parseTx.ts +31 -27
- package/tools/mnee/sendMnee.ts +70 -66
- package/tools/ordinals/getTokenByIdOrTicker.ts +14 -7
- package/tools/ordinals/marketListings.ts +26 -13
- package/tools/ordinals/marketSales.ts +11 -17
- package/tools/utils/index.ts +19 -15
- package/tools/wallet/createOrdinals.ts +27 -13
- package/tools/wallet/getAddress.ts +6 -1
- package/tools/wallet/purchaseListing.ts +18 -16
- package/tools/wallet/schemas.ts +55 -32
- package/tools/wallet/sendOrdinals.ts +106 -92
- package/tools/wallet/sendToAddress.ts +1 -1
- package/tools/wallet/tools.test.ts +3 -3
- package/tools/wallet/tools.ts +51 -38
- package/tools/wallet/transferOrdToken.ts +138 -0
- package/tools/wallet/wallet.ts +3 -9
- package/tools/wallet/transferOrdToken/index.ts +0 -103
package/README.md
CHANGED
|
@@ -8,35 +8,12 @@
|
|
|
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
|
|
12
|
-
|
|
13
|
-
To install dependencies:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
bun install
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## External Dependencies
|
|
20
|
-
|
|
21
|
-
For full functionality of all tools, the following additional dependencies are installed:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# For ordinal listing purchase functionality
|
|
25
|
-
js-1sat-ord
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Running the Server
|
|
29
|
-
|
|
30
|
-
Start the MCP server:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
bun run index.ts
|
|
34
|
-
```
|
|
35
|
-
|
|
36
11
|
## Connecting to MCP Clients
|
|
37
12
|
|
|
38
13
|
This server implements the [Model Context Protocol](https://modelcontextprotocol.io/) (MCP), allowing AI assistants to utilize Bitcoin SV functionalities. You can connect this server to various MCP-compatible clients.
|
|
39
14
|
|
|
15
|
+

|
|
16
|
+
|
|
40
17
|
### Cursor
|
|
41
18
|
|
|
42
19
|
To use the BSV MCP server with [Cursor](https://cursor.sh/):
|
|
@@ -86,19 +63,19 @@ To connect this server to Claude for Desktop:
|
|
|
86
63
|
|
|
87
64
|
4. Add the BSV MCP server to your configuration (create the file if it doesn't exist):
|
|
88
65
|
```json
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"Bitcoin SV": {
|
|
69
|
+
"command": "bunx",
|
|
70
|
+
"args": [
|
|
71
|
+
"bsv-mcp@latest"
|
|
72
|
+
],
|
|
73
|
+
"env": {
|
|
74
|
+
"PRIVATE_KEY_WIF": "<your_private_key_wif>"
|
|
75
|
+
}
|
|
98
76
|
}
|
|
99
77
|
}
|
|
100
78
|
}
|
|
101
|
-
}
|
|
102
79
|
```
|
|
103
80
|
5. Replace `<your_private_key_wif>` with your actual private key WIF
|
|
104
81
|
6. Save the file and restart Claude for Desktop
|
|
@@ -335,13 +312,13 @@ The tool supports both mainnet and testnet:
|
|
|
335
312
|
- `main`: Bitcoin SV mainnet (default)
|
|
336
313
|
- `test`: Bitcoin SV testnet
|
|
337
314
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
315
|
+
# Development
|
|
341
316
|
|
|
342
|
-
|
|
317
|
+
## Running the Server
|
|
343
318
|
|
|
344
|
-
|
|
319
|
+
```bash
|
|
320
|
+
bun run index.ts
|
|
321
|
+
```
|
|
345
322
|
|
|
346
323
|
### Running Tests
|
|
347
324
|
|
package/index.ts
CHANGED
|
@@ -11,33 +11,33 @@ import { Wallet } from "./tools/wallet/wallet";
|
|
|
11
11
|
* Exits the process with an error message if validation fails
|
|
12
12
|
*/
|
|
13
13
|
function validatePrivateKey(): PrivateKey {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
const privateKeyWif = process.env.PRIVATE_KEY_WIF;
|
|
15
|
+
|
|
16
|
+
// Check if private key is set
|
|
17
|
+
if (!privateKeyWif) {
|
|
18
|
+
console.error(
|
|
19
|
+
"\x1b[31mError: PRIVATE_KEY_WIF environment variable is not set\x1b[0m",
|
|
20
|
+
);
|
|
21
|
+
console.error(
|
|
22
|
+
"Please set this variable with a valid Bitcoin SV private key in WIF format",
|
|
23
|
+
);
|
|
24
|
+
console.error(
|
|
25
|
+
"Example: PRIVATE_KEY_WIF=your_private_key_wif bun run index.ts",
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Validate the private key format
|
|
31
|
+
try {
|
|
32
|
+
return PrivateKey.fromWif(privateKeyWif);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("\x1b[31mError: Invalid private key format\x1b[0m");
|
|
35
|
+
console.error(
|
|
36
|
+
"The PRIVATE_KEY_WIF provided is not a valid Bitcoin SV private key in WIF format",
|
|
37
|
+
);
|
|
38
|
+
console.error("Please check your key and try again");
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// Validate private key early before starting the server
|
|
@@ -45,7 +45,7 @@ const privKey = validatePrivateKey();
|
|
|
45
45
|
|
|
46
46
|
const server = new McpServer({
|
|
47
47
|
name: "Bitcoin SV MCP Server",
|
|
48
|
-
version: "0.0.
|
|
48
|
+
version: "0.0.23",
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// Initialize wallet with the validated private key
|
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.23",
|
|
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",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@bsv/sdk": "^1.4.19",
|
|
45
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.10.1",
|
|
46
46
|
"@types/node": "^22.14.1",
|
|
47
|
-
"js-1sat-ord": "^0.1.
|
|
47
|
+
"js-1sat-ord": "^0.1.81",
|
|
48
48
|
"mnee": "^2.0.0",
|
|
49
49
|
"satoshi-token": "^0.0.4",
|
|
50
|
-
"zod": "^3.24.
|
|
50
|
+
"zod": "^3.24.3"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"lint": "biome check .",
|