@nexusbloom/mcp-server 2.1.2 → 2.1.3

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 (2) hide show
  1. package/index.js +22 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -19,6 +19,9 @@
19
19
  * stdout is the MCP transport. All diagnostics go to stderr.
20
20
  */
21
21
 
22
+ import { realpathSync } from "node:fs";
23
+ import { pathToFileURL } from "node:url";
24
+
22
25
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
23
26
 
24
27
  import { ApiClient } from "./src/client.js";
@@ -85,8 +88,25 @@ export async function main(env = process.env, deps = {}) {
85
88
 
86
89
  // Only run when executed directly, so importing this module in a test does not
87
90
  // hijack stdio.
88
- const invokedDirectly =
89
- process.argv[1] && import.meta.url === `file://${process.argv[1]}`;
91
+ //
92
+ // Both sides have to be normalised, and both mistakes here are silent:
93
+ // - `npx @nexusbloom/mcp-server` launches the `.bin/nexusbloom-mcp` symlink,
94
+ // so `process.argv[1]` is the symlink path while the ESM loader resolves
95
+ // `import.meta.url` to the real one. Comparing them raw reports "not
96
+ // invoked directly", the server never starts, and the process exits 0 with
97
+ // no output — a host just reports "no tools".
98
+ // - `import.meta.url` is percent-encoded, so a path containing a space or
99
+ // `#` never string-matches the raw `process.argv[1]`.
100
+ // `pathToFileURL(realpathSync(argv[1]))` puts both sides in the same form.
101
+ const invokedDirectly = (() => {
102
+ const entry = process.argv[1];
103
+ if (!entry) return false;
104
+ try {
105
+ return import.meta.url === pathToFileURL(realpathSync(entry)).href;
106
+ } catch {
107
+ return false;
108
+ }
109
+ })();
90
110
 
91
111
  if (invokedDirectly) {
92
112
  main().catch((err) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexusbloom/mcp-server",
3
- "version": "2.1.2",
4
- "description": "MCP server for NexusBloom \u2014 agents discover tools by intent, read exact schemas, and execute them. Built on @nexusbloom/core.",
3
+ "version": "2.1.3",
4
+ "description": "MCP server for NexusBloom — agents discover tools by intent, read exact schemas, and execute them. Built on @nexusbloom/core.",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "bin": {