mcp-supervisor 0.4.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/install.js +103 -0
- package/package.json +22 -0
- package/run.js +15 -0
- package/server.json +13 -0
package/install.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const https = require("https");
|
|
7
|
+
|
|
8
|
+
const VERSION = require("./package.json").version;
|
|
9
|
+
const REPO = "miyamiyaz/mcp-supervisor";
|
|
10
|
+
|
|
11
|
+
const PLATFORM_MAP = {
|
|
12
|
+
darwin: "darwin",
|
|
13
|
+
linux: "linux",
|
|
14
|
+
win32: "windows",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ARCH_MAP = {
|
|
18
|
+
x64: "amd64",
|
|
19
|
+
arm64: "arm64",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getArchiveName() {
|
|
23
|
+
const os = PLATFORM_MAP[process.platform];
|
|
24
|
+
const arch = ARCH_MAP[process.arch];
|
|
25
|
+
if (!os || !arch) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Unsupported platform: ${process.platform}-${process.arch}`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const ext = os === "windows" ? "zip" : "tar.gz";
|
|
31
|
+
return `mcp-supervisor_${VERSION}_${os}_${arch}.${ext}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function fetch(url) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
https
|
|
37
|
+
.get(url, (res) => {
|
|
38
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
39
|
+
return fetch(res.headers.location).then(resolve, reject);
|
|
40
|
+
}
|
|
41
|
+
if (res.statusCode !== 200) {
|
|
42
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
43
|
+
}
|
|
44
|
+
const chunks = [];
|
|
45
|
+
res.on("data", (c) => chunks.push(c));
|
|
46
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
47
|
+
res.on("error", reject);
|
|
48
|
+
})
|
|
49
|
+
.on("error", reject);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function extractTarGz(buf, destDir) {
|
|
54
|
+
const tmp = path.join(destDir, "_archive.tar.gz");
|
|
55
|
+
fs.writeFileSync(tmp, buf);
|
|
56
|
+
execSync(`tar xzf ${JSON.stringify(tmp)} -C ${JSON.stringify(destDir)}`);
|
|
57
|
+
fs.unlinkSync(tmp);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function extractZip(buf, destDir) {
|
|
61
|
+
const tmp = path.join(destDir, "_archive.zip");
|
|
62
|
+
fs.writeFileSync(tmp, buf);
|
|
63
|
+
execSync(
|
|
64
|
+
`powershell -NoProfile -Command "Expand-Archive -Force '${tmp}' '${destDir}'"`
|
|
65
|
+
);
|
|
66
|
+
fs.unlinkSync(tmp);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function main() {
|
|
70
|
+
const archive = getArchiveName();
|
|
71
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${archive}`;
|
|
72
|
+
|
|
73
|
+
console.log(`Downloading ${archive}...`);
|
|
74
|
+
const buf = await fetch(url);
|
|
75
|
+
|
|
76
|
+
const binDir = path.join(__dirname, "bin");
|
|
77
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
78
|
+
|
|
79
|
+
if (archive.endsWith(".zip")) {
|
|
80
|
+
extractZip(buf, binDir);
|
|
81
|
+
} else {
|
|
82
|
+
extractTarGz(buf, binDir);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const binaryName =
|
|
86
|
+
process.platform === "win32" ? "supervisor-mcp.exe" : "supervisor-mcp";
|
|
87
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
88
|
+
|
|
89
|
+
if (!fs.existsSync(binaryPath)) {
|
|
90
|
+
throw new Error(`Binary not found at ${binaryPath} after extraction`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (process.platform !== "win32") {
|
|
94
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log("Installed supervisor-mcp binary.");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main().catch((err) => {
|
|
101
|
+
console.error(err.message);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-supervisor",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "MCP server that dynamically starts and manages other MCP servers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/miyamiyaz/mcp-supervisor"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"supervisor-mcp": "run.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node install.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"install.js",
|
|
18
|
+
"run.js",
|
|
19
|
+
"server.json",
|
|
20
|
+
"bin/"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const binaryName =
|
|
8
|
+
process.platform === "win32" ? "supervisor-mcp.exe" : "supervisor-mcp";
|
|
9
|
+
const binaryPath = path.join(__dirname, "bin", binaryName);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
} catch (err) {
|
|
14
|
+
process.exit(err.status ?? 1);
|
|
15
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.miyamiyaz/mcp-supervisor",
|
|
4
|
+
"description": "MCP server that dynamically starts and manages other MCP servers",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"packages": [
|
|
7
|
+
{
|
|
8
|
+
"registry_type": "npm",
|
|
9
|
+
"identifier": "mcp-supervisor",
|
|
10
|
+
"transport": { "type": "stdio" }
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|