captain-tool 0.0.3 → 0.0.7

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 CHANGED
@@ -50,6 +50,7 @@ The wizard will detect your platform, find the binary, and write the correct MCP
50
50
 
51
51
  Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
52
52
 
53
+ **macOS / Linux:**
53
54
  ```json
54
55
  {
55
56
  "mcpServers": {
@@ -63,6 +64,21 @@ Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Appli
63
64
  }
64
65
  ```
65
66
 
67
+ **Windows** (requires `cmd /c` wrapper so the shell can resolve the `.cmd` shim):
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "captain-tool": {
72
+ "command": "cmd",
73
+ "args": ["/c", "captain-tool"],
74
+ "env": {
75
+ "CAPTAIN_API_URL": "https://app.getcaptain.dev/"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
66
82
  Restart Claude Desktop to activate.
67
83
 
68
84
  ### Claude Code (CLI)
@@ -132,6 +132,29 @@ const CLIENTS = [
132
132
 
133
133
  // ── Config entry builders ─────────────────────────────────────────────────────
134
134
 
135
+ /**
136
+ * Build { command, args } that correctly invokes the captain-tool binary
137
+ * (or npx fallback) on the current OS.
138
+ *
139
+ * WHY the cmd /c wrapper on Windows?
140
+ * On Windows, `npx` is installed as `npx.cmd` — a CMD batch script.
141
+ * Processes launched without a shell (as MCP hosts do) cannot execute .cmd
142
+ * files directly; they must be routed through `cmd /c`. A bare .exe path
143
+ * does NOT need this wrapper, so we only apply it when falling back to npx.
144
+ */
145
+ function resolveCommand(binaryPath) {
146
+ if (binaryPath) {
147
+ // Direct binary — works on all platforms without a shell wrapper.
148
+ return { command: binaryPath, args: [] };
149
+ }
150
+ // Fallback: invoke via npx. On Windows wrap with cmd /c so the host can
151
+ // execute the npx.cmd batch script.
152
+ if (process.platform === 'win32') {
153
+ return { command: 'cmd', args: ['/c', 'npx', 'captain-tool'] };
154
+ }
155
+ return { command: 'npx', args: ['captain-tool'] };
156
+ }
157
+
135
158
  /**
136
159
  * Build the MCP server entry object for Format A clients
137
160
  * (Claude Desktop, Claude Code, Cursor, Windsurf).
@@ -140,9 +163,10 @@ const CLIENTS = [
140
163
  * No "type" field required.
141
164
  */
142
165
  function buildEntryFormatA(binaryPath) {
166
+ const { command, args } = resolveCommand(binaryPath);
143
167
  return {
144
- command: binaryPath,
145
- args: [],
168
+ command,
169
+ args,
146
170
  env: {
147
171
  CAPTAIN_API_URL,
148
172
  },
@@ -156,10 +180,11 @@ function buildEntryFormatA(binaryPath) {
156
180
  * Requires a "type": "stdio" field.
157
181
  */
158
182
  function buildEntryFormatB(binaryPath) {
183
+ const { command, args } = resolveCommand(binaryPath);
159
184
  return {
160
185
  type: 'stdio',
161
- command: binaryPath,
162
- args: [],
186
+ command,
187
+ args,
163
188
  env: {
164
189
  CAPTAIN_API_URL,
165
190
  },
@@ -258,17 +283,21 @@ async function main() {
258
283
  console.log('');
259
284
 
260
285
  // Resolve the absolute binary path — same logic as the runner.
286
+ // If no platform binary is installed we fall back to npx (null triggers the
287
+ // npx path in resolveCommand / buildEntry*).
261
288
  const binaryPath = findBinary();
262
- if (!binaryPath) {
263
- console.error(
264
- 'Error: captain-tool binary not found.\n' +
265
- 'Make sure you installed the package on a supported platform:\n' +
266
- ' npm install -g captain-tool\n'
289
+ if (binaryPath) {
290
+ console.log(`Binary path: ${binaryPath}`);
291
+ } else {
292
+ const fallback = process.platform === 'win32'
293
+ ? 'cmd /c npx captain-tool'
294
+ : 'npx captain-tool';
295
+ console.warn(
296
+ `Warning: no pre-built binary found for this platform.\n` +
297
+ `Falling back to: ${fallback}\n` +
298
+ `For best performance, install on a supported platform: win32-x64, darwin-x64, darwin-arm64, linux-x64\n`
267
299
  );
268
- process.exit(1);
269
300
  }
270
-
271
- console.log(`Binary path: ${binaryPath}`);
272
301
  console.log('');
273
302
 
274
303
  // Present the client menu.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captain-tool",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "MCP server connecting Claude Desktop and VS Code Copilot to Captain Cloud",
5
5
  "bin": {
6
6
  "captain-tool": "bin/captain-tool",
@@ -10,10 +10,10 @@
10
10
  "postinstall": "node scripts/postinstall.js"
11
11
  },
12
12
  "optionalDependencies": {
13
- "@captain-tool/captain-tool-win32-x64": "0.0.3",
14
- "@captain-tool/captain-tool-darwin-x64": "0.0.3",
15
- "@captain-tool/captain-tool-darwin-arm64": "0.0.3",
16
- "@captain-tool/captain-tool-linux-x64": "0.0.3"
13
+ "@captain-tool/captain-tool-win32-x64": "0.0.7",
14
+ "@captain-tool/captain-tool-darwin-x64": "0.0.7",
15
+ "@captain-tool/captain-tool-darwin-arm64": "0.0.7",
16
+ "@captain-tool/captain-tool-linux-x64": "0.0.7"
17
17
  },
18
18
  "files": [
19
19
  "bin/",