-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·50 lines (42 loc) · 1.3 KB
/
index.js
File metadata and controls
executable file
·50 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env node
/**
* ENCODE Toolkit — npm wrapper for the Python MCP server.
*
* This is a thin wrapper that spawns the Python-based encode-toolkit
* MCP server using uvx. The actual server code is in the encode-toolkit
* PyPI package.
*
* Usage:
* npx encode-toolkit
*
* Or in MCP client config:
* { "command": "npx", "args": ["encode-toolkit"] }
*/
const { spawn } = require("child_process");
// Try uvx first (recommended), fall back to encode-toolkit command
function startServer() {
const uvx = spawn("uvx", ["encode-toolkit"], {
stdio: "inherit",
shell: process.platform === "win32",
});
uvx.on("error", () => {
// uvx not found, try direct command
const direct = spawn("encode-toolkit", [], {
stdio: "inherit",
shell: process.platform === "win32",
});
direct.on("error", () => {
console.error(
"Error: Could not start encode-toolkit server.\n\n" +
"Please install the Python package first:\n" +
" pip install encode-toolkit\n\n" +
"Or install uv for automatic management:\n" +
" curl -LsSf https://astral.sh/uv/install.sh | sh"
);
process.exit(1);
});
direct.on("exit", (code) => process.exit(code ?? 0));
});
uvx.on("exit", (code) => process.exit(code ?? 0));
}
startServer();