waxmcp 0.1.4 → 0.1.13
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 +36 -7
- package/bin/waxmcp.js +85 -15
- package/dist/darwin-arm64/{WaxCLI → wax-cli} +0 -0
- package/dist/darwin-arm64/wax-cli.sha256 +1 -0
- package/dist/darwin-arm64/wax-mcp +0 -0
- package/dist/darwin-arm64/wax-mcp.sha256 +1 -0
- package/package.json +1 -1
- package/dist/darwin-x64/WaxCLI +0 -0
package/README.md
CHANGED
|
@@ -16,19 +16,48 @@ npm version patch # or minor/major/1.2.3
|
|
|
16
16
|
npm publish --access public
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This repo also ships a release script that updates `version`, syncs
|
|
20
|
+
`Sources/WaxMCPServer/main.swift`'s `serverVersion`, and rebuilds both Darwin binaries:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd /path/to/Wax
|
|
24
|
+
./scripts/release-waxmcp.sh patch # or minor / major / 1.2.3
|
|
25
|
+
git add npm/waxmcp/package.json Sources/WaxMCPServer/main.swift npm/waxmcp/dist/darwin-*/wax-cli npm/waxmcp/dist/darwin-*/wax-cli.sha256 npm/waxmcp/dist/darwin-*/wax-mcp npm/waxmcp/dist/darwin-*/wax-mcp.sha256
|
|
26
|
+
git commit -m "release: bump waxmcp version"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`package.json` and `Sources/WaxMCPServer/main.swift` are required to stay in lockstep; the release
|
|
30
|
+
workflow checks this before publishing.
|
|
31
|
+
|
|
32
|
+
Artifacts are packaged with `wax-cli.sha256` and `wax-mcp.sha256` checksums generated by the release
|
|
33
|
+
scripts for each platform binary.
|
|
34
|
+
|
|
35
|
+
### MCP mode (default)
|
|
36
|
+
|
|
37
|
+
When invoked with no arguments or with `mcp serve`, the launcher directly invokes the `wax-mcp`
|
|
38
|
+
binary using this search order:
|
|
39
|
+
|
|
40
|
+
1. `$WAX_MCP_BIN`
|
|
41
|
+
2. Bundled `dist/darwin-arm64/wax-mcp` or `dist/darwin-x64/wax-mcp`
|
|
42
|
+
3. `wax-mcp` in PATH
|
|
43
|
+
4. `./.build/debug/wax-mcp` (current working directory)
|
|
44
|
+
|
|
45
|
+
### CLI mode
|
|
46
|
+
|
|
47
|
+
For all other subcommands (remember, recall, search, etc.), the launcher invokes the `wax-cli`
|
|
48
|
+
binary using this search order:
|
|
20
49
|
|
|
21
50
|
1. `$WAX_CLI_BIN`
|
|
22
|
-
2. Bundled `dist/darwin-arm64/
|
|
23
|
-
3. `wax`
|
|
24
|
-
4. `
|
|
25
|
-
5. `./.build/debug/WaxCLI` (current working directory)
|
|
51
|
+
2. Bundled `dist/darwin-arm64/wax-cli` or `dist/darwin-x64/wax-cli`
|
|
52
|
+
3. `wax-cli` in PATH
|
|
53
|
+
4. `./.build/debug/wax-cli` (current working directory)
|
|
26
54
|
|
|
27
55
|
## Local development
|
|
28
56
|
|
|
29
57
|
```bash
|
|
30
58
|
cd /path/to/Wax
|
|
31
|
-
swift build --product
|
|
32
|
-
|
|
59
|
+
swift build --product wax-cli --traits MCPServer
|
|
60
|
+
swift build --product wax-mcp --traits MCPServer
|
|
61
|
+
export WAX_CLI_BIN=/path/to/Wax/.build/debug/wax-cli
|
|
33
62
|
npx --yes ./npm/waxmcp mcp doctor
|
|
34
63
|
```
|
package/bin/waxmcp.js
CHANGED
|
@@ -8,6 +8,11 @@ const fs = require("node:fs");
|
|
|
8
8
|
const forwardedArgs = process.argv.slice(2);
|
|
9
9
|
const args = forwardedArgs.length > 0 ? forwardedArgs : ["mcp", "serve"];
|
|
10
10
|
|
|
11
|
+
// Detect if we're in MCP server mode (default or explicit "mcp serve")
|
|
12
|
+
const isMCPServe =
|
|
13
|
+
(forwardedArgs.length === 0) ||
|
|
14
|
+
(forwardedArgs.length >= 2 && forwardedArgs[0] === "mcp" && forwardedArgs[1] === "serve");
|
|
15
|
+
|
|
11
16
|
function isExecutable(filePath) {
|
|
12
17
|
try {
|
|
13
18
|
fs.accessSync(filePath, fs.constants.X_OK);
|
|
@@ -17,7 +22,7 @@ function isExecutable(filePath) {
|
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
function
|
|
25
|
+
function platformDistDir() {
|
|
21
26
|
if (os.platform() !== "darwin") {
|
|
22
27
|
return null;
|
|
23
28
|
}
|
|
@@ -28,20 +33,86 @@ function resolveBundledBinary() {
|
|
|
28
33
|
return null;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
return path.join(__dirname, "..", "dist", `darwin-${mappedArch}
|
|
36
|
+
return path.join(__dirname, "..", "dist", `darwin-${mappedArch}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function resolveBundledBinary(name) {
|
|
40
|
+
const distDir = platformDistDir();
|
|
41
|
+
if (!distDir) return null;
|
|
42
|
+
return path.join(distDir, name);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// --- MCP mode: invoke wax-mcp directly ---
|
|
46
|
+
if (isMCPServe) {
|
|
47
|
+
// Extract flags that come after "mcp serve" (e.g. --store-path, --no-embedder)
|
|
48
|
+
const mcpFlags = forwardedArgs.length >= 2 ? forwardedArgs.slice(2) : [];
|
|
49
|
+
|
|
50
|
+
const mcpCandidates = [];
|
|
51
|
+
if (process.env.WAX_MCP_BIN) {
|
|
52
|
+
mcpCandidates.push(process.env.WAX_MCP_BIN);
|
|
53
|
+
}
|
|
54
|
+
const bundledMcp = resolveBundledBinary("wax-mcp");
|
|
55
|
+
if (bundledMcp) {
|
|
56
|
+
mcpCandidates.push(bundledMcp);
|
|
57
|
+
}
|
|
58
|
+
mcpCandidates.push("wax-mcp");
|
|
59
|
+
mcpCandidates.push(path.join(process.cwd(), ".build", "debug", "wax-mcp"));
|
|
60
|
+
|
|
61
|
+
for (const command of mcpCandidates) {
|
|
62
|
+
if (path.isAbsolute(command) && !isExecutable(command)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const result = spawnSync(command, mcpFlags, {
|
|
66
|
+
stdio: "inherit",
|
|
67
|
+
env: process.env,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (result.error && result.error.code === "ENOENT") {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (result.error) {
|
|
75
|
+
console.error(`waxmcp: failed to launch '${command}': ${result.error.message}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// All wax-mcp candidates exhausted — fail with clear error
|
|
83
|
+
const mcpCheckedLocations = [
|
|
84
|
+
process.env.WAX_MCP_BIN
|
|
85
|
+
? ` 1. $WAX_MCP_BIN = ${process.env.WAX_MCP_BIN}`
|
|
86
|
+
: " 1. $WAX_MCP_BIN (not set)",
|
|
87
|
+
` 2. Bundled binary at dist/darwin-${os.arch()}/wax-mcp`,
|
|
88
|
+
" 3. 'wax-mcp' in PATH",
|
|
89
|
+
` 4. ${path.join(process.cwd(), ".build", "debug", "wax-mcp")}`,
|
|
90
|
+
];
|
|
91
|
+
console.error(`
|
|
92
|
+
ERROR: No valid wax-mcp binary found.
|
|
93
|
+
|
|
94
|
+
Checked:
|
|
95
|
+
${mcpCheckedLocations.join("\n")}
|
|
96
|
+
|
|
97
|
+
Fix options:
|
|
98
|
+
Install: npx waxmcp@latest
|
|
99
|
+
Build: swift build --product wax-mcp --traits MCPServer
|
|
100
|
+
Override: export WAX_MCP_BIN=/path/to/wax-mcp
|
|
101
|
+
`);
|
|
102
|
+
process.exit(1);
|
|
32
103
|
}
|
|
33
104
|
|
|
105
|
+
// --- CLI mode: invoke wax CLI binary ---
|
|
34
106
|
const candidates = [];
|
|
35
107
|
if (process.env.WAX_CLI_BIN) {
|
|
36
108
|
candidates.push(process.env.WAX_CLI_BIN);
|
|
37
109
|
}
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
candidates.push(
|
|
110
|
+
const bundledCli = resolveBundledBinary("wax-cli");
|
|
111
|
+
if (bundledCli) {
|
|
112
|
+
candidates.push(bundledCli);
|
|
41
113
|
}
|
|
42
|
-
candidates.push("wax");
|
|
43
|
-
candidates.push("
|
|
44
|
-
candidates.push(path.join(process.cwd(), ".build", "debug", "WaxCLI"));
|
|
114
|
+
candidates.push("wax-cli");
|
|
115
|
+
candidates.push(path.join(process.cwd(), ".build", "debug", "wax-cli"));
|
|
45
116
|
|
|
46
117
|
for (const command of candidates) {
|
|
47
118
|
if (path.isAbsolute(command) && !isExecutable(command)) {
|
|
@@ -68,20 +139,19 @@ const checkedLocations = [
|
|
|
68
139
|
process.env.WAX_CLI_BIN
|
|
69
140
|
? ` 1. $WAX_CLI_BIN = ${process.env.WAX_CLI_BIN}`
|
|
70
141
|
: " 1. $WAX_CLI_BIN (not set)",
|
|
71
|
-
` 2. Bundled binary at dist/darwin-${os.arch()}/
|
|
72
|
-
" 3. 'wax' in PATH",
|
|
73
|
-
|
|
74
|
-
` 5. ${path.join(process.cwd(), ".build", "debug", "WaxCLI")}`,
|
|
142
|
+
` 2. Bundled binary at dist/darwin-${os.arch()}/wax-cli`,
|
|
143
|
+
" 3. 'wax-cli' in PATH",
|
|
144
|
+
` 4. ${path.join(process.cwd(), ".build", "debug", "wax-cli")}`,
|
|
75
145
|
];
|
|
76
146
|
console.error(`
|
|
77
|
-
ERROR: No valid
|
|
147
|
+
ERROR: No valid wax-cli binary found.
|
|
78
148
|
|
|
79
149
|
Checked:
|
|
80
150
|
${checkedLocations.join("\n")}
|
|
81
151
|
|
|
82
152
|
Fix options:
|
|
83
153
|
Install: npx waxmcp@latest
|
|
84
|
-
Build: swift build --product
|
|
85
|
-
Override: export WAX_CLI_BIN=/path/to/
|
|
154
|
+
Build: swift build --product wax-cli --traits MCPServer
|
|
155
|
+
Override: export WAX_CLI_BIN=/path/to/wax-cli
|
|
86
156
|
`);
|
|
87
157
|
process.exit(1);
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
829f83da1c29c9dab858353001b7eef5ddaf39eca590a08686990df01ede76ab wax-cli
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6d274752f6475b1b8a6fb6cd998b928074264393b3a309997e5743a54ddfc3f3 wax-mcp
|
package/package.json
CHANGED
package/dist/darwin-x64/WaxCLI
DELETED
|
Binary file
|