homebutler 0.0.1 → 0.7.4
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/LICENSE +21 -0
- package/README.md +23 -4
- package/install.js +166 -0
- package/package.json +28 -4
- package/run.js +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sanghee Son (Higangssh)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
# homebutler
|
|
2
2
|
|
|
3
|
-
**Manage your homelab from any AI — Claude, ChatGPT, Cursor, or terminal.**
|
|
3
|
+
**Manage your homelab from any AI — Claude, ChatGPT, Cursor, or terminal. One binary. Zero dependencies.**
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
This npm package downloads the homebutler Go binary and provides an MCP server wrapper.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
npm install -g homebutler
|
|
10
|
+
npm install -g homebutler
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage with MCP clients
|
|
14
|
+
|
|
15
|
+
Add to your Claude Desktop / Cursor / Claude Code config:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"homebutler": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "homebutler@latest"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
9
26
|
```
|
|
10
27
|
|
|
11
|
-
|
|
28
|
+
## Full documentation
|
|
29
|
+
|
|
30
|
+
Visit: https://github.com/Higangssh/homebutler
|
package/install.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const { createWriteStream } = require("fs");
|
|
9
|
+
const { pipeline } = require("stream/promises");
|
|
10
|
+
|
|
11
|
+
const REPO = "Higangssh/homebutler";
|
|
12
|
+
const BIN_NAME = process.platform === "win32" ? "homebutler.exe" : "homebutler";
|
|
13
|
+
const BIN_DIR = path.join(__dirname, "bin");
|
|
14
|
+
const BIN_PATH = path.join(BIN_DIR, BIN_NAME);
|
|
15
|
+
|
|
16
|
+
function getPlatform() {
|
|
17
|
+
const platform = process.platform;
|
|
18
|
+
const arch = process.arch;
|
|
19
|
+
|
|
20
|
+
const osMap = { linux: "linux", darwin: "darwin", win32: "windows" };
|
|
21
|
+
const archMap = { x64: "amd64", arm64: "arm64" };
|
|
22
|
+
|
|
23
|
+
const os = osMap[platform];
|
|
24
|
+
const cpu = archMap[arch];
|
|
25
|
+
|
|
26
|
+
if (!os || !cpu) {
|
|
27
|
+
throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return { os, cpu };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function fetchJSON(url) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const req = https.get(url, { headers: { "User-Agent": "homebutler-mcp" }, timeout: 10000 }, (res) => {
|
|
36
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
37
|
+
return fetchJSON(res.headers.location).then(resolve, reject);
|
|
38
|
+
}
|
|
39
|
+
if (res.statusCode !== 200) {
|
|
40
|
+
return reject(new Error(`HTTP ${res.statusCode}`));
|
|
41
|
+
}
|
|
42
|
+
let data = "";
|
|
43
|
+
res.on("data", (c) => (data += c));
|
|
44
|
+
res.on("end", () => {
|
|
45
|
+
try { resolve(JSON.parse(data)); } catch (e) { reject(e); }
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
req.on("error", reject);
|
|
49
|
+
req.on("timeout", () => { req.destroy(); reject(new Error("timeout")); });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function getVersion() {
|
|
54
|
+
try {
|
|
55
|
+
const data = await fetchJSON(
|
|
56
|
+
`https://api.github.com/repos/${REPO}/releases/latest`
|
|
57
|
+
);
|
|
58
|
+
if (data.tag_name) return data.tag_name.replace(/^v/, "");
|
|
59
|
+
} catch {}
|
|
60
|
+
return require("./package.json").version;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function fetch(url) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const req = https.get(url, { headers: { "User-Agent": "homebutler-mcp" }, timeout: 60000 }, (res) => {
|
|
66
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
67
|
+
return fetch(res.headers.location).then(resolve, reject);
|
|
68
|
+
}
|
|
69
|
+
if (res.statusCode !== 200) {
|
|
70
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
71
|
+
}
|
|
72
|
+
resolve(res);
|
|
73
|
+
});
|
|
74
|
+
req.on("error", reject);
|
|
75
|
+
req.on("timeout", () => { req.destroy(); reject(new Error("download timeout")); });
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function downloadAndExtract() {
|
|
80
|
+
const { os, cpu } = getPlatform();
|
|
81
|
+
const version = await getVersion();
|
|
82
|
+
const tag = `v${version}`;
|
|
83
|
+
|
|
84
|
+
const ext = os === "windows" ? "zip" : "tar.gz";
|
|
85
|
+
const assetName = `homebutler_${version}_${os}_${cpu}.${ext}`;
|
|
86
|
+
const url = `https://github.com/${REPO}/releases/download/${tag}/${assetName}`;
|
|
87
|
+
|
|
88
|
+
process.stderr.write(`Downloading homebutler ${tag} for ${os}/${cpu}...\n`);
|
|
89
|
+
|
|
90
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
91
|
+
|
|
92
|
+
const tmpFile = path.join(BIN_DIR, assetName);
|
|
93
|
+
const stream = createWriteStream(tmpFile);
|
|
94
|
+
const res = await fetch(url);
|
|
95
|
+
await pipeline(res, stream);
|
|
96
|
+
|
|
97
|
+
if (ext === "tar.gz") {
|
|
98
|
+
execSync(`tar -xzf "${tmpFile}" -C "${BIN_DIR}"`, { stdio: "pipe" });
|
|
99
|
+
} else {
|
|
100
|
+
execSync(`unzip -o "${tmpFile}" -d "${BIN_DIR}"`, { stdio: "pipe" });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Find the binary (goreleaser puts it inside a directory or at root)
|
|
104
|
+
if (!fs.existsSync(BIN_PATH)) {
|
|
105
|
+
const found = findFile(BIN_DIR, BIN_NAME);
|
|
106
|
+
if (found && found !== BIN_PATH) {
|
|
107
|
+
fs.renameSync(found, BIN_PATH);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!fs.existsSync(BIN_PATH)) {
|
|
112
|
+
throw new Error(`Binary not found after extraction: ${BIN_PATH}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
fs.chmodSync(BIN_PATH, 0o755);
|
|
116
|
+
|
|
117
|
+
// Cleanup
|
|
118
|
+
fs.unlinkSync(tmpFile);
|
|
119
|
+
for (const entry of fs.readdirSync(BIN_DIR)) {
|
|
120
|
+
const full = path.join(BIN_DIR, entry);
|
|
121
|
+
if (fs.statSync(full).isDirectory()) {
|
|
122
|
+
fs.rmSync(full, { recursive: true });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
process.stderr.write(`homebutler ${tag} installed successfully.\n`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function findFile(dir, name) {
|
|
130
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
131
|
+
const full = path.join(dir, entry.name);
|
|
132
|
+
if (entry.isFile() && entry.name === name) return full;
|
|
133
|
+
if (entry.isDirectory()) {
|
|
134
|
+
const found = findFile(full, name);
|
|
135
|
+
if (found) return found;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function main() {
|
|
142
|
+
// Skip if binary already exists and is correct version
|
|
143
|
+
if (fs.existsSync(BIN_PATH)) {
|
|
144
|
+
try {
|
|
145
|
+
const version = await getVersion();
|
|
146
|
+
const out = execSync(`"${BIN_PATH}" version`, { encoding: "utf8" });
|
|
147
|
+
if (out.includes(version)) {
|
|
148
|
+
process.stderr.write(`homebutler ${version} already installed.\n`);
|
|
149
|
+
process.exit(0);
|
|
150
|
+
}
|
|
151
|
+
} catch {}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
await downloadAndExtract();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
main().catch((err) => {
|
|
158
|
+
process.stderr.write(`Failed to install homebutler: ${err.message}\n`);
|
|
159
|
+
// Don't exit(1) during postinstall — let run.js handle lazy install
|
|
160
|
+
// This prevents npm install -g from failing if download is slow
|
|
161
|
+
if (process.env.npm_lifecycle_event === "postinstall") {
|
|
162
|
+
process.stderr.write("Binary will be downloaded on first run.\n");
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}
|
|
165
|
+
process.exit(1);
|
|
166
|
+
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebutler",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Homelab management CLI + MCP server
|
|
5
|
-
"keywords": [
|
|
3
|
+
"version": "0.7.4",
|
|
4
|
+
"description": "Homelab management CLI + MCP server — manage servers, Docker, ports, alerts via AI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"homelab",
|
|
8
|
+
"server",
|
|
9
|
+
"docker",
|
|
10
|
+
"claude",
|
|
11
|
+
"ai",
|
|
12
|
+
"devops",
|
|
13
|
+
"monitoring"
|
|
14
|
+
],
|
|
6
15
|
"license": "MIT",
|
|
7
16
|
"author": "Higangssh",
|
|
8
17
|
"repository": {
|
|
@@ -10,7 +19,22 @@
|
|
|
10
19
|
"url": "https://github.com/Higangssh/homebutler"
|
|
11
20
|
},
|
|
12
21
|
"homepage": "https://github.com/Higangssh/homebutler",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/Higangssh/homebutler/issues"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"homebutler-mcp": "run.js"
|
|
27
|
+
},
|
|
13
28
|
"scripts": {
|
|
14
|
-
"postinstall": "
|
|
29
|
+
"postinstall": "node install.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"install.js",
|
|
33
|
+
"run.js",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16"
|
|
15
39
|
}
|
|
16
40
|
}
|
package/run.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawn, execSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
|
|
8
|
+
const BIN_NAME = process.platform === "win32" ? "homebutler.exe" : "homebutler";
|
|
9
|
+
const BIN_PATH = path.join(__dirname, "bin", BIN_NAME);
|
|
10
|
+
|
|
11
|
+
// Lazy install: download binary on first run if postinstall was skipped/failed
|
|
12
|
+
if (!fs.existsSync(BIN_PATH)) {
|
|
13
|
+
console.error("homebutler binary not found, downloading...");
|
|
14
|
+
try {
|
|
15
|
+
execSync("node " + JSON.stringify(path.join(__dirname, "install.js")), {
|
|
16
|
+
stdio: "inherit",
|
|
17
|
+
timeout: 120000,
|
|
18
|
+
});
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error("Failed to install homebutler:", err.message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!fs.existsSync(BIN_PATH)) {
|
|
26
|
+
console.error("homebutler binary not found after install.");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const args = ["mcp", ...process.argv.slice(2)];
|
|
31
|
+
|
|
32
|
+
const child = spawn(BIN_PATH, args, {
|
|
33
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
37
|
+
child.on("error", (err) => {
|
|
38
|
+
console.error("Failed to start homebutler:", err.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|