bsv-mcp 0.0.28 → 0.0.30

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 CHANGED
@@ -1,6 +1,16 @@
1
1
  # BSV MCP Server Changelog
2
2
 
3
- ## v0.0.28 - Enhanced Server Configuration & Maintenance
3
+ ## v0.0.30 - Reliability Improvements
4
+
5
+ ### Bug Fixes
6
+ - **Changelog Loading**: Improved changelog loading mechanism with multiple path resolution strategies
7
+ - Added detailed logging for debugging path resolution issues
8
+ - Better error reporting for troubleshooting in production environments
9
+ - **Package Structure**: Enhanced package.json to include all necessary files in npm package
10
+ - Added prompts, resources, and CHANGELOG.md to the published files list
11
+ - Fixed import issues when running from installed npm package
12
+
13
+ ## v0.0.29 - Enhanced Server Configuration & Maintenance
4
14
 
5
15
  ### Major Changes
6
16
  - **Improved Changelog Management**: Added changelog as a MCP resource so you can just ask what has changed between versions
package/README.md CHANGED
@@ -10,11 +10,11 @@ A collection of Bitcoin SV (BSV) tools for the Model Context Protocol (MCP) fram
10
10
 
11
11
  ## Installation and Setup
12
12
 
13
- ### Prerequisites
13
+ ### Use Bun (Optional but recommended)
14
14
 
15
- 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.
15
+ 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
16
 
17
- #### Installing Bun (Recommended)
17
+ #### Installing Bun
18
18
 
19
19
  **macOS (using Homebrew):**
20
20
  ```bash
@@ -65,7 +65,8 @@ To use the BSV MCP server with [Cursor](https://cursor.sh/):
65
65
  }
66
66
  ```
67
67
 
68
- 5. Replace `<your_private_key_wif>` with your actual private key WIF (keep this secure!)
68
+ 5. Replace `<your_private_key_wif>` with your actual private key WIF (keep this secure!) If you dont have one you can leave this off for now but you wont be able to use tools that require a wallet.
69
+
69
70
  6. Click "Save"
70
71
 
71
72
  The BSV tools will now be available to Cursor's AI assistant under the "Bitcoin SV" namespace.
package/index.ts CHANGED
@@ -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.28" },
73
+ { name: "Bitcoin SV", version: "0.0.30" },
74
74
  // {
75
75
  // // Advertise only what you actually implement
76
76
  // capabilities: {
@@ -96,20 +96,17 @@ if (CONFIG.loadTools) {
96
96
  if (privKey) {
97
97
  // Register MNEE tools if enabled
98
98
  if (CONFIG.loadMneeTools) {
99
- console.log("Registering MNEE tools");
100
99
  registerMneeTools(server);
101
100
  }
102
101
 
103
102
  // Initialize wallet with the private key if wallet tools are enabled
104
103
  if (CONFIG.loadWalletTools) {
105
- console.log("Initializing wallet and registering wallet tools");
106
104
  wallet = new Wallet(privKey);
107
105
  registerWalletTools(server, wallet);
108
106
  }
109
107
  }
110
108
 
111
109
  // Register all other tools based on configuration
112
- console.log("Registering other tools");
113
110
  registerAllTools(server, {
114
111
  enableBsvTools: CONFIG.loadBsvTools,
115
112
  enableOrdinalsTools: CONFIG.loadOrdinalsTools,
@@ -120,13 +117,11 @@ if (CONFIG.loadTools) {
120
117
 
121
118
  // Register resources if enabled
122
119
  if (CONFIG.loadResources) {
123
- console.log("Registering resources");
124
120
  registerResources(server);
125
121
  }
126
122
 
127
123
  // Register prompts if enabled
128
124
  if (CONFIG.loadPrompts) {
129
- console.log("Registering prompts");
130
125
  registerAllPrompts(server);
131
126
  }
132
127
 
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.28",
5
+ "version": "0.0.30",
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",
@@ -1,6 +1,71 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { readFileSync, existsSync } from "node:fs";
3
+ import { join, dirname } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ /**
7
+ * Try multiple strategies to find the CHANGELOG.md file
8
+ * Returns the content of the file or throws an error if not found
9
+ */
10
+ function findAndReadChangelog(): string {
11
+ // Log which paths we're trying
12
+ console.log("Attempting to locate CHANGELOG.md...");
13
+
14
+ // Strategy 1: Try to resolve from the current module's directory
15
+ try {
16
+ // Convert the URL of the current ESM module to a path
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const __dirname = dirname(__filename);
19
+
20
+ // Look for CHANGELOG.md in the project root (2 levels up from resources dir)
21
+ const changelogPath = join(__dirname, "..", "..", "CHANGELOG.md");
22
+ console.log(`Checking path: ${changelogPath}`);
23
+
24
+ if (existsSync(changelogPath)) {
25
+ console.log(`Found CHANGELOG.md at: ${changelogPath}`);
26
+ return readFileSync(changelogPath, "utf-8");
27
+ }
28
+ } catch (error) {
29
+ console.error("Error checking module path:", error);
30
+ }
31
+
32
+ // Strategy 2: Try to resolve from the current working directory
33
+ try {
34
+ const changelogPath = join(process.cwd(), "CHANGELOG.md");
35
+ console.log(`Checking path: ${changelogPath}`);
36
+
37
+ if (existsSync(changelogPath)) {
38
+ console.log(`Found CHANGELOG.md at: ${changelogPath}`);
39
+ return readFileSync(changelogPath, "utf-8");
40
+ }
41
+ } catch (error) {
42
+ console.error("Error checking current working directory:", error);
43
+ }
44
+
45
+ // Strategy 3: Try to load from node_modules if running from installed package
46
+ try {
47
+ const changelogPath = join(process.cwd(), "node_modules", "bsv-mcp", "CHANGELOG.md");
48
+ console.log(`Checking path: ${changelogPath}`);
49
+
50
+ if (existsSync(changelogPath)) {
51
+ console.log(`Found CHANGELOG.md at: ${changelogPath}`);
52
+ return readFileSync(changelogPath, "utf-8");
53
+ }
54
+ } catch (error) {
55
+ console.error("Error checking node_modules path:", error);
56
+ }
57
+
58
+ // List all files in current directory to help with debugging
59
+ try {
60
+ const fs = require("node:fs");
61
+ console.log("Files in current directory:", fs.readdirSync(process.cwd()));
62
+ } catch (error) {
63
+ console.error("Error listing directory contents:", error);
64
+ }
65
+
66
+ // If we get here, we couldn't find the file
67
+ throw new Error("Could not locate CHANGELOG.md in any of the expected locations");
68
+ }
4
69
 
5
70
  /**
6
71
  * Register the changelog resource with the MCP server
@@ -16,10 +81,7 @@ export function registerChangelogResource(server: McpServer): void {
16
81
  },
17
82
  async (uri) => {
18
83
  try {
19
- // Read the CHANGELOG.md file from the project root
20
- const changelogPath = join(process.cwd(), "CHANGELOG.md");
21
- const changelogContent = readFileSync(changelogPath, "utf-8");
22
-
84
+ const changelogContent = findAndReadChangelog();
23
85
  return {
24
86
  contents: [
25
87
  {
@@ -29,16 +91,16 @@ export function registerChangelogResource(server: McpServer): void {
29
91
  ],
30
92
  };
31
93
  } catch (error) {
32
- console.error("Error reading CHANGELOG.md:", error);
94
+ console.error("Failed to read CHANGELOG.md:", error);
33
95
  return {
34
96
  contents: [
35
97
  {
36
98
  uri: uri.href,
37
- text: "# BSV MCP Server Changelog\n\nError: Could not load changelog content.",
99
+ text: "# BSV MCP Server Changelog\n\nError: Could not load changelog content.\nPlease check the server logs for more details.",
38
100
  },
39
101
  ],
40
102
  };
41
103
  }
42
- },
104
+ }
43
105
  );
44
106
  }