@tronsfey/ucli 0.5.1 → 0.5.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 +64 -6
- package/README.zh.md +63 -5
- package/dist/{client-LCWUZRZX.js → client-Y6NONDCI.js} +25 -11
- package/dist/{client-LCWUZRZX.js.map → client-Y6NONDCI.js.map} +1 -1
- package/dist/index.js +77 -14
- package/dist/index.js.map +1 -1
- package/dist/{runner-HH357SRR.js → runner-ROLDMGH3.js} +250 -60
- package/dist/runner-ROLDMGH3.js.map +1 -0
- package/package.json +4 -4
- package/skill.md +93 -15
- package/dist/runner-HH357SRR.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tronsfey/ucli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "ucli — proxy OpenAPI and MCP services for AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"clean": "rm -rf dist"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tronsfey/openapi2cli": "1.0.
|
|
40
|
+
"@tronsfey/openapi2cli": "1.0.17",
|
|
41
41
|
"axios": "^1.8.4",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"conf": "^13.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@modelcontextprotocol/server-filesystem": "2026.1.14",
|
|
47
|
-
"@tronsfey/mcp2cli": "1.0
|
|
47
|
+
"@tronsfey/mcp2cli": "1.3.0",
|
|
48
48
|
"@types/node": "^22.14.0",
|
|
49
49
|
"tsup": "^8.4.0",
|
|
50
50
|
"tsx": "^4.19.3",
|
|
51
|
-
"typescript": "
|
|
51
|
+
"typescript": "~5.8.3",
|
|
52
52
|
"vitest": "^3.1.1"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/skill.md
CHANGED
|
@@ -145,6 +145,33 @@ ucli run <service> <operation> [options]
|
|
|
145
145
|
| `--format json\|table\|yaml` | Output format (default: json) | `--format table` |
|
|
146
146
|
| `--query <jmespath>` | Filter response with JMESPath | `--query "items[*].id"` |
|
|
147
147
|
| `--data <json\|@file>` | Request body for POST/PUT/PATCH | `--data '{"amount":100}'` |
|
|
148
|
+
| `--machine` | Structured JSON envelope output (agent-friendly) | `--machine` |
|
|
149
|
+
| `--dry-run` | Preview the HTTP request without executing (implies `--machine`) | `--dry-run` |
|
|
150
|
+
|
|
151
|
+
### Agent-Friendly Mode (`--machine`)
|
|
152
|
+
|
|
153
|
+
Use `--machine` for structured JSON envelope output that agents can parse deterministically:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Structured success output
|
|
157
|
+
ucli run payments listTransactions --machine
|
|
158
|
+
# → { "success": true, "data": {...}, "meta": { "durationMs": 42 } }
|
|
159
|
+
|
|
160
|
+
# Structured error output
|
|
161
|
+
ucli run payments getTransaction --transactionId invalid --machine
|
|
162
|
+
# → { "success": false, "error": { "type": "HttpClientError", "message": "...", "statusCode": 404 } }
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Dry-Run Mode (`--dry-run`)
|
|
166
|
+
|
|
167
|
+
Preview the HTTP request that *would* be sent, without actually executing it:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
ucli run payments createCharge --dry-run --data '{"amount": 5000, "currency": "USD"}'
|
|
171
|
+
# → { "method": "POST", "url": "https://api.example.com/charges", "headers": {...}, "body": {...} }
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This is useful for verifying parameters before making destructive or costly API calls.
|
|
148
175
|
|
|
149
176
|
### Examples
|
|
150
177
|
|
|
@@ -208,19 +235,26 @@ ucli introspect --output json
|
|
|
208
235
|
# 2. Inspect a specific service's operations
|
|
209
236
|
ucli services info payments --output json
|
|
210
237
|
|
|
211
|
-
# 3.
|
|
212
|
-
ucli run payments
|
|
238
|
+
# 3. Preview a request (dry-run, no execution)
|
|
239
|
+
ucli run payments createCharge --dry-run --data '{"amount": 9900, "currency": "USD"}'
|
|
240
|
+
|
|
241
|
+
# 4. Execute with structured output (--machine)
|
|
242
|
+
ucli run payments listTransactions --machine --query "transactions[*].{id:id,amount:amount,status:status}"
|
|
213
243
|
|
|
214
|
-
#
|
|
244
|
+
# 5. Get a specific transaction
|
|
215
245
|
ucli run payments getTransaction --transactionId txn_abc123
|
|
216
246
|
|
|
217
|
-
#
|
|
247
|
+
# 6. Create a new charge
|
|
218
248
|
ucli run payments createCharge --data '{
|
|
219
249
|
"amount": 9900,
|
|
220
250
|
"currency": "USD",
|
|
221
251
|
"customerId": "cus_xyz789",
|
|
222
252
|
"description": "Monthly subscription"
|
|
223
253
|
}'
|
|
254
|
+
|
|
255
|
+
# 7. MCP: describe a tool's parameters, then call it
|
|
256
|
+
ucli mcp describe weather get_forecast --json
|
|
257
|
+
ucli mcp run weather get_forecast --input-json '{"location": "New York", "units": "metric"}'
|
|
224
258
|
```
|
|
225
259
|
|
|
226
260
|
---
|
|
@@ -270,7 +304,10 @@ ucli mcp list
|
|
|
270
304
|
# Step 2: Inspect a server's available tools
|
|
271
305
|
ucli mcp tools <server-name>
|
|
272
306
|
|
|
273
|
-
# Step 3:
|
|
307
|
+
# Step 3: Describe a specific tool's schema (parameters, types)
|
|
308
|
+
ucli mcp describe <server-name> <tool-name>
|
|
309
|
+
|
|
310
|
+
# Step 4: Run a tool (args as key=value pairs)
|
|
274
311
|
ucli mcp run <server-name> <tool-name> [key=value ...]
|
|
275
312
|
```
|
|
276
313
|
|
|
@@ -280,8 +317,37 @@ ucli mcp run <server-name> <tool-name> [key=value ...]
|
|
|
280
317
|
|---------|-------------|
|
|
281
318
|
| `ucli mcp list` | List all MCP servers available to your group |
|
|
282
319
|
| `ucli mcp tools <server>` | List tools available on the server |
|
|
320
|
+
| `ucli mcp describe <server> <tool>` | Show detailed parameter schema for a tool |
|
|
283
321
|
| `ucli mcp run <server> <tool> [args...]` | Execute a tool on the server |
|
|
284
322
|
|
|
323
|
+
### Tool Introspection (`mcp describe`)
|
|
324
|
+
|
|
325
|
+
Before calling a tool, use `mcp describe` to discover its parameters:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# Human-readable description
|
|
329
|
+
ucli mcp describe weather get_forecast
|
|
330
|
+
|
|
331
|
+
# JSON schema (for agent consumption)
|
|
332
|
+
ucli mcp describe weather get_forecast --json
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### JSON Input Mode (`--input-json`)
|
|
336
|
+
|
|
337
|
+
For agent callers, use `--input-json` to pass tool arguments as a JSON object (bypasses CLI flag parsing):
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
ucli mcp run weather get_forecast --input-json '{"location": "New York", "units": "metric"}'
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### JSON Output Mode (`--json`)
|
|
344
|
+
|
|
345
|
+
Use `--json` on `mcp run` to get structured JSON envelope output:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
ucli mcp run weather get_forecast --json location="New York"
|
|
349
|
+
```
|
|
350
|
+
|
|
285
351
|
### Examples
|
|
286
352
|
|
|
287
353
|
```bash
|
|
@@ -291,11 +357,17 @@ ucli mcp list
|
|
|
291
357
|
# See what tools are available on "weather" server
|
|
292
358
|
ucli mcp tools weather
|
|
293
359
|
|
|
294
|
-
#
|
|
360
|
+
# Describe the get_forecast tool's parameters
|
|
361
|
+
ucli mcp describe weather get_forecast
|
|
362
|
+
|
|
363
|
+
# Call the get_forecast tool with key=value arguments
|
|
295
364
|
ucli mcp run weather get_forecast location="New York" units=metric
|
|
296
365
|
|
|
297
|
-
# Call
|
|
298
|
-
ucli mcp run
|
|
366
|
+
# Call with JSON input (preferred for agents)
|
|
367
|
+
ucli mcp run weather get_forecast --input-json '{"location": "New York", "units": "metric"}'
|
|
368
|
+
|
|
369
|
+
# Call a search tool with structured JSON output
|
|
370
|
+
ucli mcp run search-server web_search --json query="ucli documentation" limit=5
|
|
299
371
|
```
|
|
300
372
|
|
|
301
373
|
---
|
|
@@ -306,19 +378,25 @@ ucli mcp run search-server web_search query="ucli documentation" limit=5
|
|
|
306
378
|
|
|
307
379
|
2. **Always use `--output json`.** This wraps every result in `{ success: true, data }` or `{ success: false, error }`. Never parse human-readable text output.
|
|
308
380
|
|
|
309
|
-
3. **Use `--
|
|
381
|
+
3. **Use `--machine` for operation execution.** When running API operations, use `--machine` to get structured envelope output with metadata (timing, method, path). This is more reliable than parsing raw API responses.
|
|
382
|
+
|
|
383
|
+
4. **Preview before mutating with `--dry-run`.** Before making POST/PUT/DELETE calls, use `--dry-run` to verify the request URL, headers, and body without actually executing. This prevents accidental mutations.
|
|
310
384
|
|
|
311
|
-
|
|
385
|
+
5. **Use `--query` to extract.** Instead of parsing the entire response, use JMESPath to extract exactly what you need.
|
|
386
|
+
|
|
387
|
+
6. **Use `mcp describe` before `mcp run`.** Use `ucli mcp describe <server> <tool> --json` to discover a tool's full parameter schema before calling it. This avoids parameter errors.
|
|
388
|
+
|
|
389
|
+
7. **Use `--input-json` for MCP tool calls.** When calling MCP tools programmatically, prefer `--input-json '{"key": "value"}'` over `key=value` pairs. JSON input is more reliable for complex or nested arguments.
|
|
390
|
+
|
|
391
|
+
8. **Chain operations.** Use the output of one operation as input to the next:
|
|
312
392
|
```bash
|
|
313
393
|
# Get customer ID, then create a charge
|
|
314
394
|
CUSTOMER_ID=$(ucli run crm findCustomer --email user@example.com --query "id" | tr -d '"')
|
|
315
395
|
ucli run payments createCharge --data "{\"customerId\": \"$CUSTOMER_ID\", \"amount\": 1000}"
|
|
316
396
|
```
|
|
317
397
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
6. **Validate before mutating.** For destructive operations (DELETE, large updates), confirm the resource exists and is correct before proceeding.
|
|
398
|
+
9. **Check pagination.** Large result sets may be paginated. Look for `nextPage`, `cursor`, or `Link` headers in the response.
|
|
321
399
|
|
|
322
|
-
|
|
400
|
+
10. **Use exit codes for control flow.** Exit code `0` = success, non-zero = failure. Use `--output json` for richer error context.
|
|
323
401
|
|
|
324
|
-
|
|
402
|
+
11. **Re-introspect on capability changes.** If you encounter a `not found` error for a service that should exist, run `ucli refresh` then `ucli introspect` to refresh your model of available capabilities.
|