@mcpmesh/cli 0.7.2
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 +78 -0
- package/bin/meshctl +30 -0
- package/install.js +210 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @mcp-mesh/cli
|
|
2
|
+
|
|
3
|
+
CLI for **MCP Mesh** - Enterprise-Grade Distributed Service Mesh for AI Agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @mcpmesh/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Show help and available commands
|
|
15
|
+
meshctl --help
|
|
16
|
+
|
|
17
|
+
# Comprehensive documentation (great for LLMs!)
|
|
18
|
+
meshctl man
|
|
19
|
+
|
|
20
|
+
# Scaffold a new agent project
|
|
21
|
+
meshctl scaffold my-agent --dry-run
|
|
22
|
+
|
|
23
|
+
# List running agents
|
|
24
|
+
meshctl list
|
|
25
|
+
|
|
26
|
+
# List all tools across agents
|
|
27
|
+
meshctl list --tools
|
|
28
|
+
|
|
29
|
+
# Call an MCP tool
|
|
30
|
+
meshctl call get_current_time
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What is MCP Mesh?
|
|
34
|
+
|
|
35
|
+
MCP Mesh is an enterprise-grade distributed service mesh built on the Model Context Protocol (MCP). It enables:
|
|
36
|
+
|
|
37
|
+
- **AI Agent Orchestration** - Connect and coordinate multiple AI agents
|
|
38
|
+
- **Service Discovery** - Automatic registration and capability-based routing
|
|
39
|
+
- **Dependency Injection** - Automatic resolution of agent dependencies
|
|
40
|
+
- **Multi-Environment** - Local development, Docker, Kubernetes support
|
|
41
|
+
- **Production Ready** - Health monitoring, graceful degradation, resilience patterns
|
|
42
|
+
|
|
43
|
+
## Key Commands
|
|
44
|
+
|
|
45
|
+
| Command | Description |
|
|
46
|
+
| ------------------------- | --------------------------- |
|
|
47
|
+
| `meshctl man` | Comprehensive documentation |
|
|
48
|
+
| `meshctl scaffold <name>` | Generate new agent project |
|
|
49
|
+
| `meshctl list` | List running agents |
|
|
50
|
+
| `meshctl list --tools` | List all tools |
|
|
51
|
+
| `meshctl call <tool>` | Invoke an MCP tool |
|
|
52
|
+
| `meshctl registry` | Manage the registry |
|
|
53
|
+
|
|
54
|
+
## For LLMs
|
|
55
|
+
|
|
56
|
+
This package is designed to be easily discoverable by LLMs. After installation:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Get full documentation
|
|
60
|
+
meshctl man
|
|
61
|
+
|
|
62
|
+
# Discover available tools
|
|
63
|
+
meshctl list --tools
|
|
64
|
+
|
|
65
|
+
# Get tool details with input schema
|
|
66
|
+
meshctl list --tools=<tool_name>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Links
|
|
70
|
+
|
|
71
|
+
- [Documentation](https://dhyansraj.github.io/mcp-mesh/)
|
|
72
|
+
- [GitHub Repository](https://github.com/dhyansraj/mcp-mesh)
|
|
73
|
+
- [PyPI Package](https://pypi.org/project/mcp-mesh/)
|
|
74
|
+
- [Docker Images](https://hub.docker.com/u/mcpmesh)
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/bin/meshctl
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 binaryName = process.platform === "win32" ? "meshctl.exe" : "meshctl";
|
|
12
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
13
|
+
|
|
14
|
+
if (fs.existsSync(binaryPath) && binaryPath !== __filename) {
|
|
15
|
+
// Binary exists, execute it
|
|
16
|
+
const result = child_process.spawnSync(binaryPath, process.argv.slice(2), {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
});
|
|
19
|
+
process.exit(result.status || 0);
|
|
20
|
+
} else {
|
|
21
|
+
console.error("Error: meshctl binary not found.");
|
|
22
|
+
console.error("");
|
|
23
|
+
console.error("The meshctl binary was not properly installed. Try:");
|
|
24
|
+
console.error(" 1. Reinstall: npm install -g @mcp-mesh/cli");
|
|
25
|
+
console.error(" 2. Or install from source: https://github.com/dhyansraj/mcp-mesh");
|
|
26
|
+
console.error("");
|
|
27
|
+
console.error("If the problem persists, please report at:");
|
|
28
|
+
console.error(" https://github.com/dhyansraj/mcp-mesh/issues");
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const child_process = require("child_process");
|
|
7
|
+
|
|
8
|
+
const VERSION = require("./package.json").version;
|
|
9
|
+
|
|
10
|
+
// Platform mappings matching Go's GOOS/GOARCH
|
|
11
|
+
const knownPlatforms = {
|
|
12
|
+
"darwin arm64": "@mcpmesh/cli-darwin-arm64",
|
|
13
|
+
"darwin x64": "@mcpmesh/cli-darwin-x64",
|
|
14
|
+
"linux arm64": "@mcpmesh/cli-linux-arm64",
|
|
15
|
+
"linux x64": "@mcpmesh/cli-linux-x64",
|
|
16
|
+
"win32 arm64": "@mcpmesh/cli-win32-arm64",
|
|
17
|
+
"win32 x64": "@mcpmesh/cli-win32-x64",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function getPlatformPackage() {
|
|
21
|
+
const platformKey = `${process.platform} ${os.arch()}`;
|
|
22
|
+
const pkg = knownPlatforms[platformKey];
|
|
23
|
+
|
|
24
|
+
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`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
pkg,
|
|
33
|
+
subpath: process.platform === "win32" ? "bin/meshctl.exe" : "bin/meshctl",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getBinaryPath(pkg, subpath) {
|
|
38
|
+
// Try to find in node_modules (from optionalDependencies)
|
|
39
|
+
const possiblePaths = [
|
|
40
|
+
// Standard node_modules location
|
|
41
|
+
path.join(__dirname, "..", pkg, subpath),
|
|
42
|
+
// npm workspace location
|
|
43
|
+
path.join(__dirname, "..", "..", pkg, subpath),
|
|
44
|
+
// pnpm location
|
|
45
|
+
path.join(__dirname, "..", "..", ".pnpm", "node_modules", pkg, subpath),
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
for (const p of possiblePaths) {
|
|
49
|
+
if (fs.existsSync(p)) {
|
|
50
|
+
return p;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Try require.resolve as fallback
|
|
55
|
+
try {
|
|
56
|
+
return require.resolve(`${pkg}/${subpath}`);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function downloadFromNpm(pkg, subpath) {
|
|
63
|
+
const installDir = path.join(__dirname, ".npm-install-temp");
|
|
64
|
+
|
|
65
|
+
console.error(`[meshctl] Platform package ${pkg} not found in node_modules`);
|
|
66
|
+
console.error(`[meshctl] Installing ${pkg}@${VERSION}...`);
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
// Clean up any previous failed install
|
|
70
|
+
if (fs.existsSync(installDir)) {
|
|
71
|
+
fs.rmSync(installDir, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
75
|
+
fs.writeFileSync(path.join(installDir, "package.json"), JSON.stringify({ name: "temp" }));
|
|
76
|
+
|
|
77
|
+
// Install the platform-specific package
|
|
78
|
+
child_process.execSync(
|
|
79
|
+
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${VERSION}`,
|
|
80
|
+
{
|
|
81
|
+
cwd: installDir,
|
|
82
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
83
|
+
timeout: 120000, // 2 minute timeout
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
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;
|
|
94
|
+
} 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`);
|
|
97
|
+
|
|
98
|
+
// Cleanup on error
|
|
99
|
+
if (fs.existsSync(installDir)) {
|
|
100
|
+
try {
|
|
101
|
+
fs.rmSync(installDir, { recursive: true, force: true });
|
|
102
|
+
} catch (cleanupErr) {
|
|
103
|
+
// Ignore cleanup errors
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function copyBinaryToTarget(sourcePath, targetPath) {
|
|
112
|
+
// Ensure bin directory exists
|
|
113
|
+
const binDir = path.dirname(targetPath);
|
|
114
|
+
if (!fs.existsSync(binDir)) {
|
|
115
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Remove existing target if it exists
|
|
119
|
+
if (fs.existsSync(targetPath)) {
|
|
120
|
+
fs.unlinkSync(targetPath);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Try hard link first (more efficient, same inode)
|
|
124
|
+
try {
|
|
125
|
+
fs.linkSync(sourcePath, targetPath);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
// Fall back to copy if hard link fails (e.g., cross-device)
|
|
128
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Ensure executable permissions
|
|
132
|
+
fs.chmodSync(targetPath, 0o755);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function validateBinary(binPath) {
|
|
136
|
+
try {
|
|
137
|
+
const result = child_process
|
|
138
|
+
.execFileSync(binPath, ["--version"], {
|
|
139
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
140
|
+
timeout: 10000,
|
|
141
|
+
})
|
|
142
|
+
.toString()
|
|
143
|
+
.trim();
|
|
144
|
+
|
|
145
|
+
console.log(`[meshctl] ✓ Installed meshctl ${result}`);
|
|
146
|
+
return true;
|
|
147
|
+
} catch (e) {
|
|
148
|
+
// Version command might not exist, try --help
|
|
149
|
+
try {
|
|
150
|
+
child_process.execFileSync(binPath, ["--help"], {
|
|
151
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
152
|
+
timeout: 10000,
|
|
153
|
+
});
|
|
154
|
+
console.log(`[meshctl] ✓ Installed meshctl successfully`);
|
|
155
|
+
return true;
|
|
156
|
+
} catch (e2) {
|
|
157
|
+
console.error(`[meshctl] ⚠ Binary validation failed:`, e.message);
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
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);
|
|
170
|
+
let needsCleanup = false;
|
|
171
|
+
|
|
172
|
+
if (!binPath) {
|
|
173
|
+
binPath = downloadFromNpm(pkg, subpath);
|
|
174
|
+
needsCleanup = true;
|
|
175
|
+
}
|
|
176
|
+
|
|
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
|
+
);
|
|
183
|
+
|
|
184
|
+
// Copy binary to target location
|
|
185
|
+
copyBinaryToTarget(binPath, targetBin);
|
|
186
|
+
|
|
187
|
+
// Validate the binary works
|
|
188
|
+
validateBinary(targetBin);
|
|
189
|
+
|
|
190
|
+
// Clean up temporary install directory if we created one
|
|
191
|
+
if (needsCleanup) {
|
|
192
|
+
const installDir = path.join(__dirname, ".npm-install-temp");
|
|
193
|
+
if (fs.existsSync(installDir)) {
|
|
194
|
+
try {
|
|
195
|
+
fs.rmSync(installDir, { recursive: true, force: true });
|
|
196
|
+
} catch (e) {
|
|
197
|
+
// Ignore cleanup errors
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
console.log(`[meshctl] Run 'meshctl --help' to get started`);
|
|
203
|
+
console.log(`[meshctl] Run 'meshctl man' for comprehensive documentation`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Run installation
|
|
207
|
+
install().catch((e) => {
|
|
208
|
+
console.error("[meshctl] Installation failed:", e.message);
|
|
209
|
+
process.exit(1);
|
|
210
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcpmesh/cli",
|
|
3
|
+
"version": "0.7.2",
|
|
4
|
+
"description": "CLI for MCP Mesh - Enterprise-Grade Distributed Service Mesh for AI Agents",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/dhyansraj/mcp-mesh.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://dhyansraj.github.io/mcp-mesh/",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/dhyansraj/mcp-mesh/issues"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node install.js"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"meshctl": "bin/meshctl"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"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"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"mcp",
|
|
33
|
+
"mesh",
|
|
34
|
+
"ai",
|
|
35
|
+
"agents",
|
|
36
|
+
"kubernetes",
|
|
37
|
+
"microservices",
|
|
38
|
+
"orchestration",
|
|
39
|
+
"model-context-protocol",
|
|
40
|
+
"llm",
|
|
41
|
+
"claude",
|
|
42
|
+
"anthropic",
|
|
43
|
+
"service-mesh",
|
|
44
|
+
"distributed-systems"
|
|
45
|
+
],
|
|
46
|
+
"author": "Dhyan Sraj <dhyansraj@gmail.com>",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|