mcp-cron 0.1.0
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/bin/mcp-cron.js +74 -0
- package/package.json +21 -0
package/bin/mcp-cron.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
|
|
5
|
+
const { spawn } = require("child_process");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
const PLATFORM_PACKAGES = {
|
|
10
|
+
"darwin-arm64": "mcp-cron-darwin-arm64",
|
|
11
|
+
"darwin-x64": "mcp-cron-darwin-amd64",
|
|
12
|
+
"linux-x64": "mcp-cron-linux-amd64",
|
|
13
|
+
"linux-arm64": "mcp-cron-linux-arm64",
|
|
14
|
+
"win32-x64": "mcp-cron-windows-amd64",
|
|
15
|
+
"win32-arm64": "mcp-cron-windows-arm64",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function getBinaryPath() {
|
|
19
|
+
const key = `${process.platform}-${process.arch}`;
|
|
20
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
21
|
+
if (!pkg) {
|
|
22
|
+
console.error(`Unsupported platform: ${key}`);
|
|
23
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(", ")}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const exe = process.platform === "win32" ? "mcp-cron.exe" : "mcp-cron";
|
|
28
|
+
|
|
29
|
+
// Try require.resolve first (works when installed via npm)
|
|
30
|
+
try {
|
|
31
|
+
return path.join(
|
|
32
|
+
path.dirname(require.resolve(`${pkg}/package.json`)),
|
|
33
|
+
"bin",
|
|
34
|
+
exe
|
|
35
|
+
);
|
|
36
|
+
} catch {
|
|
37
|
+
// Fallback: look for binary in sibling directory (local development)
|
|
38
|
+
const localPath = path.join(__dirname, "..", "..", pkg, "bin", exe);
|
|
39
|
+
if (fs.existsSync(localPath)) {
|
|
40
|
+
return localPath;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.error(`Could not find the binary package "${pkg}" for your platform (${key}).`);
|
|
44
|
+
console.error("This usually means the optional dependency was not installed.");
|
|
45
|
+
console.error("Try reinstalling: npm install mcp-cron");
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const binPath = getBinaryPath();
|
|
51
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
52
|
+
stdio: "inherit",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Forward signals to the child process
|
|
56
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"]) {
|
|
57
|
+
process.on(signal, () => {
|
|
58
|
+
if (!child.killed) {
|
|
59
|
+
child.kill(signal);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
child.on("error", (err) => {
|
|
65
|
+
console.error(`Failed to start mcp-cron: ${err.message}`);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
child.on("exit", (code, signal) => {
|
|
70
|
+
if (signal) {
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
process.exit(code ?? 0);
|
|
74
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-cron",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for cron task scheduling (shell commands and AI prompts)",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp-cron": "bin/mcp-cron.js"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/jolks/mcp-cron.git"
|
|
12
|
+
},
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"mcp-cron-darwin-amd64": "0.1.0",
|
|
15
|
+
"mcp-cron-darwin-arm64": "0.1.0",
|
|
16
|
+
"mcp-cron-linux-amd64": "0.1.0",
|
|
17
|
+
"mcp-cron-linux-arm64": "0.1.0",
|
|
18
|
+
"mcp-cron-windows-amd64": "0.1.0",
|
|
19
|
+
"mcp-cron-windows-arm64": "0.1.0"
|
|
20
|
+
}
|
|
21
|
+
}
|