captain-tool 0.0.2 → 0.0.6

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 ADDED
@@ -0,0 +1,182 @@
1
+ # captain-tool
2
+
3
+ An MCP server that connects your AI coding agent to [Captain](https://app.getcaptain.dev) — a release train management and SDLC orchestration platform.
4
+
5
+ Once installed, your AI agent can interact with your Captain workspace directly in conversation: checking pipeline status, reviewing deployments, managing artifacts, and more.
6
+
7
+ ---
8
+
9
+ ## Supported clients
10
+
11
+ - Claude Desktop
12
+ - Claude Code (CLI)
13
+ - VS Code + Copilot
14
+ - Cursor
15
+ - Windsurf
16
+
17
+ ---
18
+
19
+ ## Requirements
20
+
21
+ - Node.js 16+
22
+ - A [Captain](https://app.getcaptain.dev) account
23
+ - One of the supported AI clients above
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install -g captain-tool
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Setup (recommended)
36
+
37
+ Run the interactive setup wizard to automatically configure your AI client(s):
38
+
39
+ ```bash
40
+ captain-tool setup
41
+ ```
42
+
43
+ The wizard will detect your platform, find the binary, and write the correct MCP config for whichever client(s) you select. Supports all 5 clients above in one step.
44
+
45
+ ---
46
+
47
+ ## Manual setup
48
+
49
+ ### Claude Desktop
50
+
51
+ Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
52
+
53
+ **macOS / Linux:**
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "captain-tool": {
58
+ "command": "captain-tool",
59
+ "env": {
60
+ "CAPTAIN_API_URL": "https://app.getcaptain.dev/"
61
+ }
62
+ }
63
+ }
64
+ }
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
+
82
+ Restart Claude Desktop to activate.
83
+
84
+ ### Claude Code (CLI)
85
+
86
+ ```bash
87
+ claude mcp add captain-tool -- cmd /c captain-tool
88
+ ```
89
+
90
+ ### VS Code + Copilot
91
+
92
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_Server-0098FF?logo=visualstudiocode)](vscode:mcp/install?%7B%22name%22%3A%22captain-tool%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22captain-tool%22%5D%2C%22env%22%3A%7B%22CAPTAIN_API_URL%22%3A%22https%3A%2F%2Fapp.getcaptain.dev%2F%22%7D%7D)
93
+
94
+ Or edit `%APPDATA%\Code\User\mcp.json` (Windows) / `~/.config/Code/User/mcp.json` (Linux) / `~/Library/Application Support/Code/User/mcp.json` (macOS):
95
+
96
+ ```json
97
+ {
98
+ "servers": {
99
+ "captain-tool": {
100
+ "type": "stdio",
101
+ "command": "captain-tool",
102
+ "env": {
103
+ "CAPTAIN_API_URL": "https://app.getcaptain.dev/"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ Reload VS Code (`Ctrl+Shift+P` → "Developer: Reload Window") to activate.
111
+
112
+ ### Cursor
113
+
114
+ Edit `~/.cursor/mcp.json`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "captain-tool": {
120
+ "command": "captain-tool",
121
+ "env": {
122
+ "CAPTAIN_API_URL": "https://app.getcaptain.dev/"
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ Restart Cursor to activate.
130
+
131
+ ### Windsurf
132
+
133
+ Edit `~/.codeium/windsurf/mcp_config.json` (macOS/Linux) or `%USERPROFILE%\.codeium\windsurf\mcp_config.json` (Windows):
134
+
135
+ ```json
136
+ {
137
+ "mcpServers": {
138
+ "captain-tool": {
139
+ "command": "captain-tool",
140
+ "env": {
141
+ "CAPTAIN_API_URL": "https://app.getcaptain.dev/"
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ Restart Windsurf to activate.
149
+
150
+ ---
151
+
152
+ ## First use
153
+
154
+ Once connected, ask your AI agent:
155
+
156
+ > "Check captain status and get me set up."
157
+
158
+ It will walk you through logging in and selecting your workspace. After that, you can ask things like:
159
+
160
+ ```
161
+ Show me all my pipelines.
162
+ What's the current state of my active workspace?
163
+ List any unhealthy connectors.
164
+ What components do we have?
165
+ Show me the deployment history for component comp-xyz.
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Configuration
171
+
172
+ | Variable | Default | Description |
173
+ |----------|---------|-------------|
174
+ | `CAPTAIN_API_URL` | `https://app.getcaptain.dev/` | Captain backend URL |
175
+ | `CAPTAIN_DB_PATH` | platform default | Local state and auth token |
176
+ | `CAPTAIN_REQUEST_TIMEOUT_SECONDS` | `30` | HTTP timeout per request |
177
+
178
+ ---
179
+
180
+ ## Learn more
181
+
182
+ Visit [app.getcaptain.dev](https://app.getcaptain.dev) to learn more about Captain.
@@ -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.2",
3
+ "version": "0.0.6",
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.2",
14
- "@captain-tool/captain-tool-darwin-x64": "0.0.2",
15
- "@captain-tool/captain-tool-darwin-arm64": "0.0.2",
16
- "@captain-tool/captain-tool-linux-x64": "0.0.2"
13
+ "@captain-tool/captain-tool-win32-x64": "0.0.6",
14
+ "@captain-tool/captain-tool-darwin-x64": "0.0.6",
15
+ "@captain-tool/captain-tool-darwin-arm64": "0.0.6",
16
+ "@captain-tool/captain-tool-linux-x64": "0.0.6"
17
17
  },
18
18
  "files": [
19
19
  "bin/",