@weibaohui/mcp2cli 0.2.8 → 0.3.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/README.md CHANGED
@@ -8,7 +8,10 @@
8
8
  ## Quick Usage
9
9
 
10
10
  ```bash
11
- # Install
11
+ # Install via npm (recommended)
12
+ npm install -g @weibaohui/mcp2cli
13
+
14
+ # Or install via Go
12
15
  go install github.com/weibaohui/mcp2cli@latest
13
16
 
14
17
  # Rename to mcp for convenience
@@ -57,14 +60,41 @@ mcp server tool name:string=John age:number=30 enabled:bool=true
57
60
 
58
61
  ## Installation
59
62
 
60
- ### Binary (latest release)
63
+ ### npm (multi-platform) - recommended
61
64
 
62
- Download from [GitHub Releases](https://github.com/weibaohui/mcp2cli/releases/latest)
65
+ ```bash
66
+ npm install -g @weibaohui/mcp2cli
67
+ ```
63
68
 
64
- ### From source
69
+ Supports Linux, macOS, Windows on amd64/arm64. 安装后直接使用 `mcp` 命令,无需额外操作。
70
+
71
+ ### Go install
65
72
 
66
73
  ```bash
67
74
  go install github.com/weibaohui/mcp2cli@latest
75
+
76
+ # Rename to mcp for convenience
77
+ mv $(go env GOPATH)/bin/mcp2cli $(go env GOPATH)/bin/mcp
78
+ ```
79
+
80
+ 安装后可执行文件名为 `mcp2cli`,需手动重命名为 `mcp`:
81
+
82
+ ```bash
83
+ mv $(go env GOPATH)/bin/mcp2cli $(go env GOPATH)/bin/mcp
84
+ ```
85
+
86
+ ### Binary download
87
+
88
+ Download from [GitHub Releases](https://github.com/weibaohui/mcp2cli/releases/latest), then rename and install:
89
+
90
+ ```bash
91
+ # macOS / Linux
92
+ mv mcp2cli-darwin-arm64 mcp
93
+ chmod +x mcp
94
+ sudo mv mcp /usr/local/bin/
95
+
96
+ # Windows
97
+ ren mcp2cli-windows-amd64.exe mcp.exe
68
98
  ```
69
99
 
70
100
  ### Build from source
@@ -73,6 +103,7 @@ go install github.com/weibaohui/mcp2cli@latest
73
103
  git clone https://github.com/weibaohui/mcp2cli.git
74
104
  cd mcp2cli
75
105
  make build
106
+ cp bin/mcp2cli /usr/local/bin/mcp
76
107
  ```
77
108
 
78
109
  ## Configuration
@@ -203,7 +234,7 @@ All commands return unified JSON:
203
234
  ## Architecture
204
235
 
205
236
  ```
206
- cmd/mcp/main.go # CLI entry point, argument routing
237
+ main.go # CLI entry point, argument routing
207
238
  internal/mcp/
208
239
  ├── types.go # Error codes, shared types
209
240
  ├── config.go # Config loading & merging
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weibaohui/mcp2cli",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "CLI tool for interacting with MCP (Model Context Protocol) Servers",
5
5
  "author": "weibaohui",
6
6
  "license": "MIT",
@@ -24,20 +24,19 @@
24
24
  "x64",
25
25
  "arm64"
26
26
  ],
27
- "main": "index.js",
28
27
  "bin": {
29
- "mcp": "./install.js"
28
+ "mcp": "./run.js"
30
29
  },
31
30
  "files": [
32
31
  "dist/",
33
- "index.js",
34
- "install.js",
32
+ "run.js",
33
+ "postinstall.js",
35
34
  "README.md"
36
35
  ],
37
36
  "engines": {
38
37
  "node": ">=18.0.0"
39
38
  },
40
39
  "scripts": {
41
- "postinstall": "node install.js"
40
+ "postinstall": "node postinstall.js"
42
41
  }
43
42
  }
@@ -6,14 +6,12 @@ const path = require('path');
6
6
  const platform = process.platform;
7
7
  const arch = process.arch;
8
8
 
9
- // Map platform names
10
9
  const platformMap = {
11
10
  'darwin': 'darwin',
12
11
  'linux': 'linux',
13
12
  'win32': 'windows'
14
13
  };
15
14
 
16
- // Map arch names - npm uses x64, Go uses amd64
17
15
  const archMap = {
18
16
  'x64': 'amd64',
19
17
  'arm64': 'arm64'
@@ -29,10 +27,7 @@ if (!npmPlatform || !npmArch) {
29
27
 
30
28
  const binaryName = `mcp2cli-${npmPlatform}-${npmArch}`;
31
29
  const binaryPath = path.join(__dirname, 'dist', binaryName);
32
- const targetPath = path.join(__dirname, 'mcp2cli');
33
-
34
- // Add .exe on Windows
35
- const exeTargetPath = platform === 'win32' ? targetPath + '.exe' : targetPath;
30
+ const targetPath = path.join(__dirname, platform === 'win32' ? 'mcp2cli.exe' : 'mcp2cli');
36
31
 
37
32
  if (!fs.existsSync(binaryPath)) {
38
33
  console.error(`Binary not found: ${binaryPath}`);
@@ -40,12 +35,8 @@ if (!fs.existsSync(binaryPath)) {
40
35
  process.exit(1);
41
36
  }
42
37
 
43
- // Copy binary to target location
44
- fs.copyFileSync(binaryPath, exeTargetPath);
38
+ fs.copyFileSync(binaryPath, targetPath);
45
39
 
46
- // Make executable on Unix systems
47
40
  if (platform !== 'win32') {
48
- fs.chmodSync(exeTargetPath, 0o755);
41
+ fs.chmodSync(targetPath, 0o755);
49
42
  }
50
-
51
- console.log(`Installed mcp2cli ${npmPlatform}/${npmArch} successfully`);
package/run.js ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const binary = process.platform === 'win32'
7
+ ? path.join(__dirname, 'mcp2cli.exe')
8
+ : path.join(__dirname, 'mcp2cli');
9
+
10
+ try {
11
+ execFileSync(binary, process.argv.slice(2), { stdio: 'inherit' });
12
+ } catch (e) {
13
+ process.exit(e.status || 1);
14
+ }