@h0wzy/mcp 1.0.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.
Files changed (2) hide show
  1. package/bin/h0wzy-mcp.js +111 -0
  2. package/package.json +18 -0
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ // H0wZy/mcp — High-performance cross-platform runner for the Go CLI
3
+
4
+ import { spawnSync } from 'node:child_process';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { dirname, join } from 'node:path';
7
+ import { existsSync, mkdirSync, createWriteStream, chmodSync } from 'node:fs';
8
+ import { homedir, platform, arch } from 'node:os';
9
+ import https from 'node:https';
10
+
11
+ const VERSION = '1.0.0';
12
+ const GITHUB_REPO = 'H0wZy/mcp';
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const repoRoot = join(__dirname, '..', '..');
16
+ const cliDir = join(repoRoot, 'cli');
17
+
18
+ const isWindows = platform() === 'win32';
19
+ const isMac = platform() === 'darwin';
20
+ const isLinux = platform() === 'linux';
21
+
22
+ // Map platform and architecture to release asset names
23
+ function getBinaryAsset() {
24
+ const currentArch = arch();
25
+ if (isWindows) {
26
+ return 'h0wzy-mcp-windows-amd64.exe';
27
+ }
28
+ if (isMac) {
29
+ return currentArch === 'arm64' ? 'h0wzy-mcp-darwin-arm64' : 'h0wzy-mcp-darwin-amd64';
30
+ }
31
+ if (isLinux) {
32
+ return 'h0wzy-mcp-linux-amd64';
33
+ }
34
+ return null;
35
+ }
36
+
37
+ const binaryAsset = getBinaryAsset();
38
+ const args = process.argv.slice(2);
39
+
40
+ // 1. Check local checkout compiled binary
41
+ if (binaryAsset && existsSync(join(cliDir, binaryAsset))) {
42
+ const res = spawnSync(join(cliDir, binaryAsset), args, { stdio: 'inherit', shell: isWindows });
43
+ process.exit(res.status ?? 0);
44
+ }
45
+
46
+ // 2. If in dev repository with Go installed, run `go run ./cli`
47
+ if (existsSync(join(cliDir, 'main.go'))) {
48
+ const resGo = spawnSync('go', ['run', './cli', ...args], {
49
+ cwd: repoRoot,
50
+ stdio: 'inherit',
51
+ shell: isWindows,
52
+ });
53
+ if (!resGo.error && resGo.status === 0) {
54
+ process.exit(0);
55
+ }
56
+ }
57
+
58
+ // 3. Standalone mode: Cache & run prebuilt binary from GitHub Releases
59
+ if (!binaryAsset) {
60
+ console.error(`❌ Unsupported platform/architecture: ${platform()} ${arch()}`);
61
+ process.exit(1);
62
+ }
63
+
64
+ const cacheDir = join(homedir(), '.h0wzy', 'bin');
65
+ const cachedBinary = join(cacheDir, `${binaryAsset}-v${VERSION}`);
66
+
67
+ if (existsSync(cachedBinary)) {
68
+ const res = spawnSync(cachedBinary, args, { stdio: 'inherit', shell: isWindows });
69
+ process.exit(res.status ?? 0);
70
+ }
71
+
72
+ // Helper to download binary with redirect support
73
+ async function downloadBinary(url, dest) {
74
+ return new Promise((resolve, reject) => {
75
+ https.get(url, (res) => {
76
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
77
+ return downloadBinary(res.headers.location, dest).then(resolve).catch(reject);
78
+ }
79
+ if (res.statusCode !== 200) {
80
+ return reject(new Error(`Download failed with status ${res.statusCode}`));
81
+ }
82
+ const file = createWriteStream(dest);
83
+ res.pipe(file);
84
+ file.on('finish', () => {
85
+ file.close(() => resolve());
86
+ });
87
+ }).on('error', reject);
88
+ });
89
+ }
90
+
91
+ async function run() {
92
+ console.log(`⬇️ Downloading native H0wZy/mcp CLI (v${VERSION}) for ${platform()}-${arch()}...`);
93
+ mkdirSync(cacheDir, { recursive: true });
94
+ const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${binaryAsset}`;
95
+
96
+ try {
97
+ await downloadBinary(downloadUrl, cachedBinary);
98
+ if (!isWindows) {
99
+ chmodSync(cachedBinary, 0o755);
100
+ }
101
+ console.log('✅ Download complete! Starting CLI...\n');
102
+ const res = spawnSync(cachedBinary, args, { stdio: 'inherit', shell: isWindows });
103
+ process.exit(res.status ?? 0);
104
+ } catch (err) {
105
+ console.error(`❌ Could not download prebuilt binary: ${err.message}`);
106
+ console.error(` Please download manually from: https://github.com/${GITHUB_REPO}/releases/tag/v${VERSION}`);
107
+ process.exit(1);
108
+ }
109
+ }
110
+
111
+ run();
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@h0wzy/mcp",
3
+ "version": "1.0.0",
4
+ "description": "Interactive CLI runner for H0wZy/mcp — The Ultimate Multi-Agent MCP Hub",
5
+ "type": "module",
6
+ "bin": {
7
+ "h0wzy-mcp": "bin/h0wzy-mcp.js"
8
+ },
9
+ "author": "Marcos (H0wZy) <h0wzymarcos@gmail.com>",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/H0wZy/mcp.git"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ }
18
+ }