@weibaohui/mcp2cli 0.3.0 → 0.4.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 +154 -185
- package/dist/mcp2cli-darwin-amd64 +0 -0
- package/dist/mcp2cli-darwin-arm64 +0 -0
- package/dist/mcp2cli-linux-amd64 +0 -0
- package/dist/mcp2cli-linux-arm64 +0 -0
- package/dist/mcp2cli-windows-amd64.exe +0 -0
- package/dist/mcp2cli-windows-arm64.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,265 +1,234 @@
|
|
|
1
1
|
# mcp2cli
|
|
2
2
|
|
|
3
|
-
> A
|
|
3
|
+
> A CLI-native MCP client that loads tool schemas on-demand and resolves discover-then-call into a single invocation — keeping tool definitions out of your context window.
|
|
4
|
+
|
|
5
|
+
**One bash command → tool discovery + schema resolution + precise invocation. No persistent tool definitions, no token waste.**
|
|
4
6
|
|
|
5
7
|
[](https://golang.org)
|
|
6
8
|
[](LICENSE)
|
|
9
|
+
[](https://www.npmjs.com/package/@weibaohui/mcp2cli)
|
|
7
10
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
# Install via npm (recommended)
|
|
12
|
-
npm install -g @weibaohui/mcp2cli
|
|
13
|
-
|
|
14
|
-
# Or install via Go
|
|
15
|
-
go install github.com/weibaohui/mcp2cli@latest
|
|
16
|
-
|
|
17
|
-
# Rename to mcp for convenience
|
|
18
|
-
mv $(go env GOPATH)/bin/mcp2cli $(go env GOPATH)/bin/mcp
|
|
19
|
-
|
|
20
|
-
# List configured servers (no server connection)
|
|
21
|
-
mcp
|
|
11
|
+
## Why mcp2cli?
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
When an LLM uses MCP tools directly, every call carries heavy overhead:
|
|
14
|
+
- Tool discovery: list tools → read schemas → understand parameters → construct call → parse response
|
|
15
|
+
- Each MCP tool definition (schema, descriptions, types) stays in context, consuming tokens for the **entire conversation**
|
|
16
|
+
- A single "search GitHub and summarize" task can burn thousands of tokens just on protocol overhead
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
mcp openDeepWiki list_repositories
|
|
18
|
+
**mcp2cli compresses that into one bash command:**
|
|
28
19
|
|
|
29
|
-
# Call a tool
|
|
30
|
-
mcp openDeepWiki list_repositories limit=3
|
|
31
|
-
|
|
32
|
-
# Call with typed arguments (recommended)
|
|
33
|
-
mcp openDeepWiki list_repositories limit:number=3 enabled:bool=true
|
|
34
20
|
```
|
|
21
|
+
# Direct MCP: 3 rounds, ~2000+ tokens of context
|
|
22
|
+
1. list_tools(server) → get all tool schemas
|
|
23
|
+
2. get_tool_details(server, tool) → read parameter definitions
|
|
24
|
+
3. call_tool(server, tool, args) → get result
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Arguments can be in two formats:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# Simple key=value (string type by default)
|
|
42
|
-
mcp server tool name=John age=30
|
|
43
|
-
|
|
44
|
-
# Typed key:type=value (recommended for precision)
|
|
45
|
-
mcp server tool name:string=John age:number=30 enabled:bool=true
|
|
26
|
+
# mcp2cli: 1 bash call, ~200 tokens
|
|
27
|
+
mcp openDeepWiki get_repo_structure repoOwner=github repoName=vscode
|
|
46
28
|
```
|
|
47
29
|
|
|
48
|
-
**
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Features
|
|
30
|
+
**Result: 80-90% fewer tokens per tool interaction.**
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
- **📋 Explore Tools** - View detailed tool information with formatted parameters
|
|
56
|
-
- **🚀 Invoke Tools** - Call tools directly with type-safe arguments
|
|
57
|
-
- **🔌 Multiple Transports** - Support for SSE, Streamable HTTP, and Stdio
|
|
58
|
-
- **📁 Smart Config** - Auto-detects and merges configs from standard locations
|
|
59
|
-
- **📤 Unified JSON Output** - Machine-readable output for scripting
|
|
60
|
-
|
|
61
|
-
## Installation
|
|
62
|
-
|
|
63
|
-
### npm (multi-platform) - recommended
|
|
32
|
+
## Quick Start
|
|
64
33
|
|
|
65
34
|
```bash
|
|
35
|
+
# Install
|
|
66
36
|
npm install -g @weibaohui/mcp2cli
|
|
67
|
-
```
|
|
68
37
|
|
|
69
|
-
|
|
38
|
+
# List servers
|
|
39
|
+
mcp
|
|
70
40
|
|
|
71
|
-
|
|
41
|
+
# Explore tools on a server
|
|
42
|
+
mcp openDeepWiki
|
|
72
43
|
|
|
73
|
-
|
|
74
|
-
|
|
44
|
+
# View tool details + param examples
|
|
45
|
+
mcp openDeepWiki get_repo_structure
|
|
75
46
|
|
|
76
|
-
#
|
|
77
|
-
|
|
47
|
+
# Call a tool
|
|
48
|
+
mcp openDeepWiki get_repo_structure repoOwner=github repoName=vscode
|
|
78
49
|
```
|
|
79
50
|
|
|
80
|
-
|
|
51
|
+
## How It Saves Tokens
|
|
81
52
|
|
|
82
|
-
|
|
83
|
-
mv $(go env GOPATH)/bin/mcp2cli $(go env GOPATH)/bin/mcp
|
|
84
|
-
```
|
|
53
|
+
### Before: Direct MCP (verbose)
|
|
85
54
|
|
|
86
|
-
|
|
55
|
+
Every MCP interaction requires the LLM to maintain tool schemas in context:
|
|
87
56
|
|
|
88
|
-
|
|
57
|
+
```json
|
|
58
|
+
// Tool schema alone = ~500 tokens, stays in EVERY message
|
|
59
|
+
{
|
|
60
|
+
"name": "get_repo_structure",
|
|
61
|
+
"description": "Retrieves the complete file and directory structure of a Git repository...",
|
|
62
|
+
"inputSchema": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"repoOwner": {"type": "string", "description": "..."},
|
|
66
|
+
"repoName": {"type": "string", "description": "..."},
|
|
67
|
+
...
|
|
68
|
+
},
|
|
69
|
+
"required": ["repoOwner", "repoName"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
89
73
|
|
|
90
|
-
|
|
91
|
-
# macOS / Linux
|
|
92
|
-
mv mcp2cli-darwin-arm64 mcp
|
|
93
|
-
chmod +x mcp
|
|
94
|
-
sudo mv mcp /usr/local/bin/
|
|
74
|
+
Multiply this by **every tool on every server** — a server with 20 tools = ~10,000 tokens permanently in context.
|
|
95
75
|
|
|
96
|
-
|
|
97
|
-
ren mcp2cli-windows-amd64.exe mcp.exe
|
|
98
|
-
```
|
|
76
|
+
### After: mcp2cli (lean)
|
|
99
77
|
|
|
100
|
-
|
|
78
|
+
The LLM only needs a short bash command. No schemas, no tool definitions, no protocol overhead:
|
|
101
79
|
|
|
102
80
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
make build
|
|
106
|
-
cp bin/mcp2cli /usr/local/bin/mcp
|
|
81
|
+
# Token cost: just the command string (~30 tokens)
|
|
82
|
+
mcp openDeepWiki get_repo_structure repoOwner=github repoName=vscode
|
|
107
83
|
```
|
|
108
84
|
|
|
109
|
-
## Configuration
|
|
110
|
-
|
|
111
|
-
Create `~/.config/mcp/config.json`:
|
|
112
|
-
|
|
113
85
|
```json
|
|
86
|
+
// Output is concise JSON (~100 tokens)
|
|
114
87
|
{
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"timeout": 30000
|
|
119
|
-
}
|
|
120
|
-
}
|
|
88
|
+
"success": true,
|
|
89
|
+
"data": { "server": "openDeepWiki", "method": "get_repo_structure", "result": "..." },
|
|
90
|
+
"meta": { "timestamp": "2026-03-28T10:00:00Z", "version": "v0.3.0" }
|
|
121
91
|
}
|
|
122
92
|
```
|
|
123
93
|
|
|
124
|
-
###
|
|
94
|
+
### Token Comparison
|
|
125
95
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
|
|
|
129
|
-
|
|
|
96
|
+
| Scenario | Direct MCP | mcp2cli | Saving |
|
|
97
|
+
|----------|-----------|---------|--------|
|
|
98
|
+
| Discover 1 tool | ~500 tokens (schema in context) | ~100 tokens (one bash call) | 80% |
|
|
99
|
+
| Call 1 tool | ~300 tokens (schema + call overhead) | ~130 tokens (command + output) | 57% |
|
|
100
|
+
| 10-tool server in context | ~10,000 tokens (persistent) | 0 tokens (loaded on demand) | 100% |
|
|
101
|
+
| Full workflow (discover + call) | ~2,000 tokens | ~230 tokens | 89% |
|
|
130
102
|
|
|
131
|
-
|
|
103
|
+
## Usage in Claude Code / Cursor / Windsurf
|
|
104
|
+
|
|
105
|
+
Add to your project's MCP config (e.g. `.mcp/config.json` or `~/.config/mcp/config.json`):
|
|
132
106
|
|
|
133
107
|
```json
|
|
134
108
|
{
|
|
135
109
|
"mcpServers": {
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"url": "https://example.com/mcp",
|
|
139
|
-
"command": "npx",
|
|
140
|
-
"args": ["-y", "@server/mcp"],
|
|
141
|
-
"env": {"KEY": "value"},
|
|
142
|
-
"timeout": 30000,
|
|
143
|
-
"headers": {
|
|
144
|
-
"Authorization": "Bearer ${API_TOKEN}",
|
|
145
|
-
"X-API-Key": "${API_KEY}"
|
|
146
|
-
}
|
|
110
|
+
"openDeepWiki": {
|
|
111
|
+
"url": "https://opendeepwiki.k8m.site/mcp/streamable"
|
|
147
112
|
}
|
|
148
113
|
}
|
|
149
114
|
}
|
|
150
115
|
```
|
|
151
116
|
|
|
152
|
-
|
|
117
|
+
Then in your AI tool, just run bash commands:
|
|
153
118
|
|
|
154
|
-
**HTTP Headers (API Key / Bearer Token):**
|
|
155
|
-
```json
|
|
156
|
-
{
|
|
157
|
-
"mcpServers": {
|
|
158
|
-
"secure-server": {
|
|
159
|
-
"url": "https://api.example.com/mcp",
|
|
160
|
-
"headers": {
|
|
161
|
-
"Authorization": "Bearer ${API_TOKEN}",
|
|
162
|
-
"X-API-Key": "${API_KEY}"
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
119
|
```
|
|
120
|
+
# The LLM can explore and call tools in one step
|
|
121
|
+
$ mcp openDeepWiki list_repositories limit=3
|
|
168
122
|
|
|
169
|
-
|
|
123
|
+
# No need to load tool schemas — just call
|
|
124
|
+
$ mcp openDeepWiki get_repo_structure repoOwner=weibaohui repoName=mcp2cli
|
|
125
|
+
```
|
|
170
126
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
127
|
+
## Argument Format
|
|
128
|
+
|
|
129
|
+
### Simple Arguments (key=value)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Simple key=value (string by default)
|
|
133
|
+
mcp server tool name=John age=30
|
|
134
|
+
|
|
135
|
+
# Typed key:type=value (for precision)
|
|
136
|
+
mcp server tool name:string=John age:number=30 enabled:bool=true
|
|
185
137
|
```
|
|
186
138
|
|
|
187
|
-
**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
| `streamable` | Modern streaming HTTP (default) |
|
|
191
|
-
| `sse` | Server-Sent Events over HTTP |
|
|
192
|
-
| `stdio` | Local subprocess communication |
|
|
139
|
+
**Supported types:** `string`, `number`, `int`, `float`, `bool`
|
|
140
|
+
|
|
141
|
+
### YAML Input (for complex parameters)
|
|
193
142
|
|
|
194
|
-
|
|
143
|
+
For complex parameters (objects, arrays, multi-line text), use YAML format:
|
|
195
144
|
|
|
196
145
|
```bash
|
|
197
|
-
#
|
|
198
|
-
mcp
|
|
146
|
+
# Inline YAML with --yaml or -y
|
|
147
|
+
mcp server tool --yaml 'name: John details: {age: 30, city: NYC}'
|
|
148
|
+
mcp server tool -y 'tags: [dev, ops] enabled: true'
|
|
199
149
|
|
|
200
|
-
#
|
|
201
|
-
mcp
|
|
150
|
+
# Multi-line YAML
|
|
151
|
+
mcp server tool --yaml 'limit: 10
|
|
152
|
+
offset: 5
|
|
153
|
+
status: "ready"'
|
|
202
154
|
|
|
203
|
-
#
|
|
204
|
-
mcp
|
|
155
|
+
# Read from file (like kubectl apply -f)
|
|
156
|
+
mcp server tool -f params.yaml
|
|
205
157
|
|
|
206
|
-
#
|
|
207
|
-
|
|
158
|
+
# Pipe YAML to stdin
|
|
159
|
+
cat params.yaml | mcp server tool
|
|
208
160
|
```
|
|
209
161
|
|
|
210
|
-
|
|
162
|
+
**Priority:** `-f` > `--yaml/-y` > stdin pipe > `key=value`
|
|
211
163
|
|
|
212
|
-
|
|
164
|
+
### Output Format
|
|
213
165
|
|
|
214
|
-
|
|
215
|
-
{
|
|
216
|
-
"success": true,
|
|
217
|
-
"data": {
|
|
218
|
-
"configFiles": ["/home/user/.config/mcp/config.json"],
|
|
219
|
-
"servers": [
|
|
220
|
-
{
|
|
221
|
-
"name": "openDeepWiki",
|
|
222
|
-
"transport": "streamable",
|
|
223
|
-
"url": "https://opendeepwiki.k8m.site/mcp/streamable"
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
},
|
|
227
|
-
"meta": {
|
|
228
|
-
"timestamp": "2026-03-24T10:00:00Z",
|
|
229
|
-
"version": "v0.2.8"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
```
|
|
166
|
+
Control output format with `--output` / `-o`:
|
|
233
167
|
|
|
234
|
-
|
|
168
|
+
```bash
|
|
169
|
+
# JSON (default, human-readable with indentation)
|
|
170
|
+
mcp server tool
|
|
171
|
+
|
|
172
|
+
# YAML output
|
|
173
|
+
mcp --output yaml server tool
|
|
235
174
|
|
|
175
|
+
# Text output (compact JSON, good for piping)
|
|
176
|
+
mcp -o text server tool
|
|
236
177
|
```
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
178
|
+
|
|
179
|
+
| Format | Description | Use Case |
|
|
180
|
+
|--------|-------------|----------|
|
|
181
|
+
| `json` | Pretty-printed JSON | Default, debugging |
|
|
182
|
+
| `yaml` | YAML format | Config files, readability |
|
|
183
|
+
| `text` | Compact JSON | Piping, scripts |
|
|
184
|
+
|
|
185
|
+
## Installation
|
|
186
|
+
|
|
187
|
+
### npm (recommended)
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install -g @weibaohui/mcp2cli
|
|
245
191
|
```
|
|
246
192
|
|
|
247
|
-
|
|
193
|
+
Supports Linux, macOS, Windows on amd64/arm64. `mcp` command ready immediately.
|
|
194
|
+
|
|
195
|
+
### Go install
|
|
248
196
|
|
|
249
197
|
```bash
|
|
250
|
-
|
|
251
|
-
|
|
198
|
+
go install github.com/weibaohui/mcp2cli@latest
|
|
199
|
+
mv $(go env GOPATH)/bin/mcp2cli $(go env GOPATH)/bin/mcp
|
|
200
|
+
```
|
|
252
201
|
|
|
253
|
-
|
|
254
|
-
make build-all
|
|
202
|
+
### Binary download
|
|
255
203
|
|
|
256
|
-
|
|
257
|
-
make test
|
|
204
|
+
Download from [GitHub Releases](https://github.com/weibaohui/mcp2cli/releases/latest):
|
|
258
205
|
|
|
259
|
-
|
|
260
|
-
|
|
206
|
+
```bash
|
|
207
|
+
# macOS / Linux
|
|
208
|
+
mv mcp2cli-darwin-arm64 mcp && chmod +x mcp && sudo mv mcp /usr/local/bin/
|
|
209
|
+
|
|
210
|
+
# Windows
|
|
211
|
+
ren mcp2cli-windows-amd64.exe mcp.exe
|
|
261
212
|
```
|
|
262
213
|
|
|
214
|
+
## Command Reference
|
|
215
|
+
|
|
216
|
+
| Command | Description |
|
|
217
|
+
|---------|-------------|
|
|
218
|
+
| `mcp` | List configured servers |
|
|
219
|
+
| `mcp <server>` | List tools on a server |
|
|
220
|
+
| `mcp <server> <tool>` | Show tool details + param examples |
|
|
221
|
+
| `mcp <server> <tool> key=value ...` | Call a tool |
|
|
222
|
+
|
|
223
|
+
### Global Flags
|
|
224
|
+
|
|
225
|
+
| Flag | Short | Description | Default |
|
|
226
|
+
|------|-------|-------------|---------|
|
|
227
|
+
| `--output` | `-o` | Output format (json\|yaml\|text) | `json` |
|
|
228
|
+
| `--yaml` | `-y` | YAML parameters (inline) | |
|
|
229
|
+
| `--file` | `-f` | YAML file with parameters | |
|
|
230
|
+
| `--stream` | `-s` | Enable streaming output | `false` |
|
|
231
|
+
|
|
263
232
|
## License
|
|
264
233
|
|
|
265
234
|
MIT License - see [LICENSE](LICENSE) for details.
|
|
Binary file
|
|
Binary file
|
package/dist/mcp2cli-linux-amd64
CHANGED
|
Binary file
|
package/dist/mcp2cli-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|