@mcpmesh/cli 0.7.2 → 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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @mcp-mesh/cli
1
+ # @mcpmesh/cli
2
2
 
3
3
  CLI for **MCP Mesh** - Enterprise-Grade Distributed Service Mesh for AI Agents.
4
4
 
@@ -8,6 +8,13 @@ CLI for **MCP Mesh** - Enterprise-Grade Distributed Service Mesh for AI Agents.
8
8
  npm install -g @mcpmesh/cli
9
9
  ```
10
10
 
11
+ This installs two binaries:
12
+
13
+ - **meshctl** - CLI tool for managing MCP Mesh agents and tools
14
+ - **mcp-mesh-registry** - Registry service for service discovery
15
+
16
+ > **Note:** This package supports Linux and macOS only. For Windows, use WSL2 or Docker.
17
+
11
18
  ## Quick Start
12
19
 
13
20
  ```bash
@@ -28,6 +35,9 @@ meshctl list --tools
28
35
 
29
36
  # Call an MCP tool
30
37
  meshctl call get_current_time
38
+
39
+ # Start the registry service (Linux/macOS)
40
+ mcp-mesh-registry --help
31
41
  ```
32
42
 
33
43
  ## What is MCP Mesh?
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // This is a fallback script that gets replaced by the actual binary after installation.
5
+ // If you're seeing this error, the installation might have failed.
6
+
7
+ const fs = require("fs");
8
+ const path = require("path");
9
+ const child_process = require("child_process");
10
+
11
+ const binaryPath = path.join(__dirname, "mcp-mesh-registry");
12
+
13
+ if (fs.existsSync(binaryPath) && binaryPath !== __filename) {
14
+ // Binary exists, execute it
15
+ const result = child_process.spawnSync(binaryPath, process.argv.slice(2), {
16
+ stdio: "inherit",
17
+ });
18
+ process.exit(result.status || 0);
19
+ } else {
20
+ console.error("Error: mcp-mesh-registry binary not found.");
21
+ console.error("");
22
+ console.error("The mcp-mesh-registry binary was not properly installed. Try:");
23
+ console.error(" 1. Reinstall: npm install -g @mcpmesh/cli");
24
+ console.error(" 2. Or install from source: https://github.com/dhyansraj/mcp-mesh");
25
+ console.error("");
26
+ console.error("If the problem persists, please report at:");
27
+ console.error(" https://github.com/dhyansraj/mcp-mesh/issues");
28
+ process.exit(1);
29
+ }
package/bin/meshctl CHANGED
@@ -8,8 +8,7 @@ const fs = require("fs");
8
8
  const path = require("path");
9
9
  const child_process = require("child_process");
10
10
 
11
- const binaryName = process.platform === "win32" ? "meshctl.exe" : "meshctl";
12
- const binaryPath = path.join(__dirname, binaryName);
11
+ const binaryPath = path.join(__dirname, "meshctl");
13
12
 
14
13
  if (fs.existsSync(binaryPath) && binaryPath !== __filename) {
15
14
  // Binary exists, execute it
@@ -21,7 +20,7 @@ if (fs.existsSync(binaryPath) && binaryPath !== __filename) {
21
20
  console.error("Error: meshctl binary not found.");
22
21
  console.error("");
23
22
  console.error("The meshctl binary was not properly installed. Try:");
24
- console.error(" 1. Reinstall: npm install -g @mcp-mesh/cli");
23
+ console.error(" 1. Reinstall: npm install -g @mcpmesh/cli");
25
24
  console.error(" 2. Or install from source: https://github.com/dhyansraj/mcp-mesh");
26
25
  console.error("");
27
26
  console.error("If the problem persists, please report at:");
package/install.js CHANGED
@@ -7,34 +7,37 @@ const child_process = require("child_process");
7
7
 
8
8
  const VERSION = require("./package.json").version;
9
9
 
10
- // Platform mappings matching Go's GOOS/GOARCH
10
+ // Platform mappings matching Go's GOOS/GOARCH (Linux and macOS only)
11
11
  const knownPlatforms = {
12
12
  "darwin arm64": "@mcpmesh/cli-darwin-arm64",
13
13
  "darwin x64": "@mcpmesh/cli-darwin-x64",
14
14
  "linux arm64": "@mcpmesh/cli-linux-arm64",
15
15
  "linux x64": "@mcpmesh/cli-linux-x64",
16
- "win32 arm64": "@mcpmesh/cli-win32-arm64",
17
- "win32 x64": "@mcpmesh/cli-win32-x64",
18
16
  };
19
17
 
18
+ // Binaries to install
19
+ const BINARIES = [
20
+ { name: "meshctl", required: true },
21
+ { name: "mcp-mesh-registry", required: true },
22
+ ];
23
+
20
24
  function getPlatformPackage() {
21
25
  const platformKey = `${process.platform} ${os.arch()}`;
22
26
  const pkg = knownPlatforms[platformKey];
23
27
 
24
28
  if (!pkg) {
25
- console.error(`[meshctl] Unsupported platform: ${platformKey}`);
26
- console.error(`[meshctl] Supported platforms: ${Object.keys(knownPlatforms).join(", ")}`);
27
- console.error(`[meshctl] You can build from source: https://github.com/dhyansraj/mcp-mesh`);
29
+ console.error(`[mcp-mesh] Unsupported platform: ${platformKey}`);
30
+ console.error(`[mcp-mesh] Supported platforms: ${Object.keys(knownPlatforms).join(", ")}`);
31
+ console.error(`[mcp-mesh] You can build from source: https://github.com/dhyansraj/mcp-mesh`);
28
32
  process.exit(1);
29
33
  }
30
34
 
31
- return {
32
- pkg,
33
- subpath: process.platform === "win32" ? "bin/meshctl.exe" : "bin/meshctl",
34
- };
35
+ return pkg;
35
36
  }
36
37
 
37
- function getBinaryPath(pkg, subpath) {
38
+ function getBinaryPath(pkg, binaryName) {
39
+ const subpath = `bin/${binaryName}`;
40
+
38
41
  // Try to find in node_modules (from optionalDependencies)
39
42
  const possiblePaths = [
40
43
  // Standard node_modules location
@@ -59,11 +62,11 @@ function getBinaryPath(pkg, subpath) {
59
62
  }
60
63
  }
61
64
 
62
- function downloadFromNpm(pkg, subpath) {
65
+ function downloadFromNpm(pkg) {
63
66
  const installDir = path.join(__dirname, ".npm-install-temp");
64
67
 
65
- console.error(`[meshctl] Platform package ${pkg} not found in node_modules`);
66
- console.error(`[meshctl] Installing ${pkg}@${VERSION}...`);
68
+ console.error(`[mcp-mesh] Platform package ${pkg} not found in node_modules`);
69
+ console.error(`[mcp-mesh] Installing ${pkg}@${VERSION}...`);
67
70
 
68
71
  try {
69
72
  // Clean up any previous failed install
@@ -84,16 +87,10 @@ function downloadFromNpm(pkg, subpath) {
84
87
  }
85
88
  );
86
89
 
87
- const installedPath = path.join(installDir, "node_modules", pkg, subpath);
88
-
89
- if (!fs.existsSync(installedPath)) {
90
- throw new Error(`Binary not found at expected path: ${installedPath}`);
91
- }
92
-
93
- return installedPath;
90
+ return path.join(installDir, "node_modules", pkg);
94
91
  } catch (e) {
95
- console.error(`[meshctl] Failed to install ${pkg}:`, e.message);
96
- console.error(`[meshctl] You can install manually from: https://github.com/dhyansraj/mcp-mesh/releases`);
92
+ console.error(`[mcp-mesh] Failed to install ${pkg}:`, e.message);
93
+ console.error(`[mcp-mesh] You can install manually from: https://github.com/dhyansraj/mcp-mesh/releases`);
97
94
 
98
95
  // Cleanup on error
99
96
  if (fs.existsSync(installDir)) {
@@ -132,7 +129,7 @@ function copyBinaryToTarget(sourcePath, targetPath) {
132
129
  fs.chmodSync(targetPath, 0o755);
133
130
  }
134
131
 
135
- function validateBinary(binPath) {
132
+ function validateBinary(binPath, binaryName) {
136
133
  try {
137
134
  const result = child_process
138
135
  .execFileSync(binPath, ["--version"], {
@@ -142,7 +139,7 @@ function validateBinary(binPath) {
142
139
  .toString()
143
140
  .trim();
144
141
 
145
- console.log(`[meshctl] Installed meshctl ${result}`);
142
+ console.log(`[mcp-mesh] Installed ${binaryName} ${result}`);
146
143
  return true;
147
144
  } catch (e) {
148
145
  // Version command might not exist, try --help
@@ -151,41 +148,65 @@ function validateBinary(binPath) {
151
148
  stdio: ["pipe", "pipe", "pipe"],
152
149
  timeout: 10000,
153
150
  });
154
- console.log(`[meshctl] Installed meshctl successfully`);
151
+ console.log(`[mcp-mesh] Installed ${binaryName} successfully`);
155
152
  return true;
156
153
  } catch (e2) {
157
- console.error(`[meshctl] Binary validation failed:`, e.message);
154
+ console.error(`[mcp-mesh] Binary validation failed for ${binaryName}:`, e.message);
158
155
  return false;
159
156
  }
160
157
  }
161
158
  }
162
159
 
163
160
  async function install() {
164
- const { pkg, subpath } = getPlatformPackage();
165
-
166
- console.log(`[meshctl] Installing for ${process.platform} ${os.arch()}...`);
167
-
168
- // Check if binary already exists from optionalDependencies
169
- let binPath = getBinaryPath(pkg, subpath);
161
+ const pkg = getPlatformPackage();
170
162
  let needsCleanup = false;
163
+ let pkgDir = null;
171
164
 
172
- if (!binPath) {
173
- binPath = downloadFromNpm(pkg, subpath);
165
+ console.log(`[mcp-mesh] Installing for ${process.platform} ${os.arch()}...`);
166
+
167
+ // Check if any binary exists from optionalDependencies
168
+ const testBinPath = getBinaryPath(pkg, "meshctl");
169
+ if (!testBinPath) {
170
+ // Need to download the package
171
+ pkgDir = downloadFromNpm(pkg);
174
172
  needsCleanup = true;
175
173
  }
176
174
 
177
- // Target path in our package's bin directory
178
- const targetBin = path.join(
179
- __dirname,
180
- "bin",
181
- process.platform === "win32" ? "meshctl.exe" : "meshctl"
182
- );
175
+ let installedCount = 0;
183
176
 
184
- // Copy binary to target location
185
- copyBinaryToTarget(binPath, targetBin);
177
+ for (const binary of BINARIES) {
178
+ const binaryName = binary.name;
186
179
 
187
- // Validate the binary works
188
- validateBinary(targetBin);
180
+ // Get source path
181
+ let sourcePath;
182
+ if (pkgDir) {
183
+ sourcePath = path.join(pkgDir, "bin", binaryName);
184
+ } else {
185
+ sourcePath = getBinaryPath(pkg, binaryName);
186
+ }
187
+
188
+ // Check if binary exists in package
189
+ if (!sourcePath || !fs.existsSync(sourcePath)) {
190
+ if (binary.required) {
191
+ console.error(`[mcp-mesh] Required binary ${binaryName} not found`);
192
+ process.exit(1);
193
+ } else {
194
+ console.log(`[mcp-mesh] Optional binary ${binaryName} not available for this platform`);
195
+ continue;
196
+ }
197
+ }
198
+
199
+ // Target path in our package's bin directory
200
+ const targetPath = path.join(__dirname, "bin", binaryName);
201
+
202
+ // Copy binary to target location
203
+ copyBinaryToTarget(sourcePath, targetPath);
204
+
205
+ // Validate the binary works
206
+ if (validateBinary(targetPath, binaryName)) {
207
+ installedCount++;
208
+ }
209
+ }
189
210
 
190
211
  // Clean up temporary install directory if we created one
191
212
  if (needsCleanup) {
@@ -199,12 +220,13 @@ async function install() {
199
220
  }
200
221
  }
201
222
 
202
- console.log(`[meshctl] Run 'meshctl --help' to get started`);
203
- console.log(`[meshctl] Run 'meshctl man' for comprehensive documentation`);
223
+ console.log(`[mcp-mesh] Installed ${installedCount} binaries`);
224
+ console.log(`[mcp-mesh] Run 'meshctl --help' to get started`);
225
+ console.log(`[mcp-mesh] Run 'mcp-mesh-registry --help' for registry options`);
204
226
  }
205
227
 
206
228
  // Run installation
207
229
  install().catch((e) => {
208
- console.error("[meshctl] Installation failed:", e.message);
230
+ console.error("[mcp-mesh] Installation failed:", e.message);
209
231
  process.exit(1);
210
232
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpmesh/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "CLI for MCP Mesh - Enterprise-Grade Distributed Service Mesh for AI Agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,18 +15,17 @@
15
15
  "postinstall": "node install.js"
16
16
  },
17
17
  "bin": {
18
- "meshctl": "bin/meshctl"
18
+ "meshctl": "bin/meshctl",
19
+ "mcp-mesh-registry": "bin/mcp-mesh-registry"
19
20
  },
20
21
  "engines": {
21
22
  "node": ">=18"
22
23
  },
23
24
  "optionalDependencies": {
24
- "@mcpmesh/cli-linux-x64": "0.7.2",
25
- "@mcpmesh/cli-linux-arm64": "0.7.2",
26
- "@mcpmesh/cli-darwin-x64": "0.7.2",
27
- "@mcpmesh/cli-darwin-arm64": "0.7.2",
28
- "@mcpmesh/cli-win32-x64": "0.7.2",
29
- "@mcpmesh/cli-win32-arm64": "0.7.2"
25
+ "@mcpmesh/cli-linux-x64": "0.7.4",
26
+ "@mcpmesh/cli-linux-arm64": "0.7.4",
27
+ "@mcpmesh/cli-darwin-x64": "0.7.4",
28
+ "@mcpmesh/cli-darwin-arm64": "0.7.4"
30
29
  },
31
30
  "keywords": [
32
31
  "mcp",