@tronsfey/ucli 0.5.2 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tronsfey/ucli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "ucli — proxy OpenAPI and MCP services for AI agents",
5
5
  "keywords": [
6
6
  "openapi",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@modelcontextprotocol/server-filesystem": "2026.1.14",
47
- "@tronsfey/mcp2cli": "1.3.0",
47
+ "@tronsfey/mcp2cli": "workspace:*",
48
48
  "@types/node": "^22.14.0",
49
49
  "tsup": "^8.4.0",
50
50
  "tsx": "^4.19.3",
package/skill.md CHANGED
@@ -34,9 +34,9 @@ Use `ucli` whenever you need to call any external business API or MCP server too
34
34
  ucli is designed around the **Observe → Orient → Decide → Act** (OODA) loop for AI agent workflows:
35
35
 
36
36
  1. **Observe** — Discover all available capabilities with `ucli introspect`
37
- 2. **Orient** — Understand specific operations with `ucli services info <name>` or `ucli mcp tools <server>`
37
+ 2. **Orient** — Understand specific operations with `ucli oas <service> listapi` or `ucli mcp <server> listtool`
38
38
  3. **Decide** — Choose the right operation and parameters based on the task
39
- 4. **Act** — Execute with `ucli run` or `ucli mcp run`
39
+ 4. **Act** — Execute with `ucli oas <service> invokeapi <api>` or `ucli mcp <server> invoketool <tool>`
40
40
 
41
41
  ### Recommended First Call
42
42
 
@@ -57,7 +57,7 @@ This returns a complete manifest in a single call:
57
57
  { "name": "weather", "description": "...", "transport": "http", ... }
58
58
  ],
59
59
  "commands": [
60
- { "name": "run", "description": "...", "usage": "...", "examples": [...] }
60
+ { "name": "oas invokeapi", "description": "...", "usage": "...", "examples": [...] }
61
61
  ]
62
62
  }
63
63
  }
@@ -84,7 +84,7 @@ When `--output json` is passed, every command emits exactly one JSON object to s
84
84
 
85
85
  **Error:**
86
86
  ```json
87
- { "success": false, "error": { "code": 6, "message": "Service not found: foo", "hint": "Run: ucli services list" } }
87
+ { "success": false, "error": { "code": 6, "message": "Service not found: foo", "hint": "Run: ucli listoas" } }
88
88
  ```
89
89
 
90
90
  Error codes: `0`=success, `1`=general, `2`=usage, `3`=config, `4`=auth, `5`=connectivity, `6`=not-found, `7`=server-error.
@@ -96,7 +96,7 @@ Error codes: `0`=success, `1`=general, `2`=usage, `3`=config, `4`=auth, `5`=conn
96
96
  ## Step 1 — Discover Available Services
97
97
 
98
98
  ```bash
99
- ucli services list
99
+ ucli listoas
100
100
  ```
101
101
 
102
102
  Returns a table of service names, auth type, and descriptions. Run this first to see what's available.
@@ -112,7 +112,7 @@ crm oauth2_cc Customer relationship management
112
112
 
113
113
  For machine-readable output:
114
114
  ```bash
115
- ucli services list --output json
115
+ ucli listoas --output json
116
116
  ```
117
117
 
118
118
  ---
@@ -120,14 +120,19 @@ ucli services list --output json
120
120
  ## Step 2 — Inspect a Service's Operations
121
121
 
122
122
  ```bash
123
- ucli services info <service-name>
123
+ ucli oas <service-name> listapi
124
124
  ```
125
125
 
126
126
  Shows all available operations, their parameters, and expected inputs.
127
127
 
128
128
  **Example:**
129
129
  ```bash
130
- ucli services info payments
130
+ ucli oas payments listapi
131
+ ```
132
+
133
+ For detailed information about a specific API operation:
134
+ ```bash
135
+ ucli oas payments apiinfo createCharge
131
136
  ```
132
137
 
133
138
  ---
@@ -135,7 +140,7 @@ ucli services info payments
135
140
  ## Step 3 — Execute an Operation
136
141
 
137
142
  ```bash
138
- ucli run <service> <operation> [options]
143
+ ucli oas <service> invokeapi <api> [options]
139
144
  ```
140
145
 
141
146
  ### Options
@@ -154,11 +159,11 @@ Use `--machine` for structured JSON envelope output that agents can parse determ
154
159
 
155
160
  ```bash
156
161
  # Structured success output
157
- ucli run payments listTransactions --machine
162
+ ucli oas payments invokeapi listTransactions --machine
158
163
  # → { "success": true, "data": {...}, "meta": { "durationMs": 42 } }
159
164
 
160
165
  # Structured error output
161
- ucli run payments getTransaction --transactionId invalid --machine
166
+ ucli oas payments invokeapi getTransaction --params '{"transactionId": "invalid"}' --machine
162
167
  # → { "success": false, "error": { "type": "HttpClientError", "message": "...", "statusCode": 404 } }
163
168
  ```
164
169
 
@@ -167,7 +172,7 @@ ucli run payments getTransaction --transactionId invalid --machine
167
172
  Preview the HTTP request that *would* be sent, without actually executing it:
168
173
 
169
174
  ```bash
170
- ucli run payments createCharge --dry-run --data '{"amount": 5000, "currency": "USD"}'
175
+ ucli oas payments invokeapi createCharge --dry-run --data '{"amount": 5000, "currency": "USD"}'
171
176
  # → { "method": "POST", "url": "https://api.example.com/charges", "headers": {...}, "body": {...} }
172
177
  ```
173
178
 
@@ -177,34 +182,34 @@ This is useful for verifying parameters before making destructive or costly API
177
182
 
178
183
  **List resources (GET):**
179
184
  ```bash
180
- ucli run payments listTransactions --format json
185
+ ucli oas payments invokeapi listTransactions --format json
181
186
  ```
182
187
 
183
188
  **Filter response:**
184
189
  ```bash
185
- ucli run inventory listProducts --query "items[?stock > \`0\`].name"
190
+ ucli oas inventory invokeapi listProducts --query "items[?stock > \`0\`].name"
186
191
  ```
187
192
 
188
193
  **Create a resource (POST):**
189
194
  ```bash
190
- ucli run payments createCharge --data '{"amount": 5000, "currency": "USD", "customerId": "cus_123"}'
195
+ ucli oas payments invokeapi createCharge --data '{"amount": 5000, "currency": "USD", "customerId": "cus_123"}'
191
196
  ```
192
197
 
193
198
  **Update a resource (PUT/PATCH):**
194
199
  ```bash
195
- ucli run crm updateContact --data '{"email": "new@example.com"}' --contactId abc123
200
+ ucli oas crm invokeapi updateContact --data '{"email": "new@example.com"}' --params '{"contactId": "abc123"}'
196
201
  ```
197
202
 
198
203
  **Get a specific resource:**
199
204
  ```bash
200
- ucli run inventory getProduct --productId SKU-001
205
+ ucli oas inventory invokeapi getProduct --params '{"productId": "SKU-001"}'
201
206
  ```
202
207
 
203
208
  ---
204
209
 
205
210
  ## Step 4 — Process the Output
206
211
 
207
- By default, `ucli run` returns JSON. You can:
212
+ By default, `ucli oas <service> invokeapi` returns JSON. You can:
208
213
  - Parse it directly as structured data
209
214
  - Use `--query` to extract specific fields (JMESPath syntax)
210
215
  - Use `--format table` for human-readable display
@@ -232,29 +237,35 @@ By default, `ucli run` returns JSON. You can:
232
237
  # 1. Discover all capabilities (single call)
233
238
  ucli introspect --output json
234
239
 
235
- # 2. Inspect a specific service's operations
236
- ucli services info payments --output json
240
+ # 2. List available services
241
+ ucli listoas
237
242
 
238
- # 3. Preview a request (dry-run, no execution)
239
- ucli run payments createCharge --dry-run --data '{"amount": 9900, "currency": "USD"}'
243
+ # 3. Inspect a service's API operations
244
+ ucli oas payments listapi
240
245
 
241
- # 4. Execute with structured output (--machine)
242
- ucli run payments listTransactions --machine --query "transactions[*].{id:id,amount:amount,status:status}"
246
+ # 4. Get detailed info about a specific API
247
+ ucli oas payments apiinfo createCharge
243
248
 
244
- # 5. Get a specific transaction
245
- ucli run payments getTransaction --transactionId txn_abc123
249
+ # 5. Preview a request (dry-run, no execution)
250
+ ucli oas payments invokeapi createCharge --dry-run --data '{"amount": 9900, "currency": "USD"}'
246
251
 
247
- # 6. Create a new charge
248
- ucli run payments createCharge --data '{
252
+ # 6. Execute with structured output (--machine)
253
+ ucli oas payments invokeapi listTransactions --machine --query "transactions[*].{id:id,amount:amount,status:status}"
254
+
255
+ # 7. Get a specific transaction
256
+ ucli oas payments invokeapi getTransaction --params '{"transactionId": "txn_abc123"}'
257
+
258
+ # 8. Create a new charge
259
+ ucli oas payments invokeapi createCharge --data '{
249
260
  "amount": 9900,
250
261
  "currency": "USD",
251
262
  "customerId": "cus_xyz789",
252
263
  "description": "Monthly subscription"
253
264
  }'
254
265
 
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"}'
266
+ # 9. MCP: inspect a tool's parameters, then call it
267
+ ucli mcp weather toolinfo get_forecast --json
268
+ ucli mcp weather invoketool get_forecast --data '{"location": "New York", "units": "metric"}'
258
269
  ```
259
270
 
260
271
  ---
@@ -264,8 +275,8 @@ ucli mcp run weather get_forecast --input-json '{"location": "New York", "units"
264
275
  | Error | Cause | Resolution |
265
276
  |-------|-------|------------|
266
277
  | `Authentication failed` | Token expired or invalid | Run `ucli configure --server <url> --token <jwt>` |
267
- | `Unknown service: <name>` | Service not registered | Run `ucli services list` to see valid names |
268
- | `400 Bad Request` | Invalid parameters | Check operation signature with `ucli services info <service>` |
278
+ | `Unknown service: <name>` | Service not registered | Run `ucli listoas` to see valid names |
279
+ | `400 Bad Request` | Invalid parameters | Check operation signature with `ucli oas <service> apiinfo <api>` |
269
280
  | `404 Not Found` | Resource doesn't exist | Verify the resource ID |
270
281
  | `429 Too Many Requests` | Rate limit exceeded | Wait and retry |
271
282
  | `5xx Server Error` | Upstream service error | Retry once; if persistent, report to the service owner |
@@ -286,7 +297,7 @@ ucli refresh
286
297
  ucli doctor --output json
287
298
 
288
299
  # Then retry the operation
289
- ucli run <service> <operation>
300
+ ucli oas <service> invokeapi <api>
290
301
  ```
291
302
 
292
303
  ---
@@ -299,75 +310,72 @@ In addition to OpenAPI services, ucli can interact with MCP (Model Context Proto
299
310
 
300
311
  ```bash
301
312
  # Step 1: Discover available MCP servers
302
- ucli mcp list
313
+ ucli listmcp
303
314
 
304
315
  # Step 2: Inspect a server's available tools
305
- ucli mcp tools <server-name>
316
+ ucli mcp <server-name> listtool
306
317
 
307
318
  # Step 3: Describe a specific tool's schema (parameters, types)
308
- ucli mcp describe <server-name> <tool-name>
319
+ ucli mcp <server-name> toolinfo <tool-name>
309
320
 
310
- # Step 4: Run a tool (args as key=value pairs)
311
- ucli mcp run <server-name> <tool-name> [key=value ...]
321
+ # Step 4: Run a tool (pass arguments as JSON with --data)
322
+ ucli mcp <server-name> invoketool <tool-name> --data <json>
312
323
  ```
313
324
 
314
325
  ### Commands
315
326
 
316
327
  | Command | Description |
317
328
  |---------|-------------|
318
- | `ucli mcp list` | List all MCP servers available to your group |
319
- | `ucli mcp tools <server>` | List tools available on the server |
320
- | `ucli mcp describe <server> <tool>` | Show detailed parameter schema for a tool |
321
- | `ucli mcp run <server> <tool> [args...]` | Execute a tool on the server |
329
+ | `ucli listmcp` | List all MCP servers available to your group |
330
+ | `ucli mcp <server> listtool` | List tools available on the server |
331
+ | `ucli mcp <server> toolinfo <tool>` | Show detailed parameter schema for a tool |
332
+ | `ucli mcp <server> invoketool <tool> --data <json>` | Execute a tool on the server |
322
333
 
323
- ### Tool Introspection (`mcp describe`)
334
+ ### Tool Introspection (`mcp toolinfo`)
324
335
 
325
- Before calling a tool, use `mcp describe` to discover its parameters:
336
+ Before calling a tool, use `mcp toolinfo` to discover its parameters:
326
337
 
327
338
  ```bash
328
339
  # Human-readable description
329
- ucli mcp describe weather get_forecast
340
+ ucli mcp weather toolinfo get_forecast
330
341
 
331
342
  # JSON schema (for agent consumption)
332
- ucli mcp describe weather get_forecast --json
343
+ ucli mcp weather toolinfo get_forecast --json
333
344
  ```
334
345
 
335
- ### JSON Input Mode (`--input-json`)
346
+ ### JSON Input Mode (`--data`)
336
347
 
337
- For agent callers, use `--input-json` to pass tool arguments as a JSON object (bypasses CLI flag parsing):
348
+ Pass tool arguments as a JSON object with `--data`:
338
349
 
339
350
  ```bash
340
- ucli mcp run weather get_forecast --input-json '{"location": "New York", "units": "metric"}'
351
+ ucli mcp weather invoketool get_forecast --data '{"location": "New York", "units": "metric"}'
341
352
  ```
342
353
 
343
354
  ### JSON Output Mode (`--json`)
344
355
 
345
- Use `--json` on `mcp run` to get structured JSON envelope output:
356
+ Use `--json` on `mcp invoketool` to get structured JSON envelope output:
346
357
 
347
358
  ```bash
348
- ucli mcp run weather get_forecast --json location="New York"
359
+ ucli mcp weather invoketool get_forecast --json --data '{"location": "New York"}'
349
360
  ```
350
361
 
351
362
  ### Examples
352
363
 
353
364
  ```bash
354
365
  # List available MCP servers
355
- ucli mcp list
366
+ ucli listmcp
356
367
 
357
368
  # See what tools are available on "weather" server
358
- ucli mcp tools weather
369
+ ucli mcp weather listtool
359
370
 
360
371
  # 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
364
- ucli mcp run weather get_forecast location="New York" units=metric
372
+ ucli mcp weather toolinfo get_forecast
365
373
 
366
- # Call with JSON input (preferred for agents)
367
- ucli mcp run weather get_forecast --input-json '{"location": "New York", "units": "metric"}'
374
+ # Call the get_forecast tool with JSON input
375
+ ucli mcp weather invoketool get_forecast --data '{"location": "New York", "units": "metric"}'
368
376
 
369
377
  # Call a search tool with structured JSON output
370
- ucli mcp run search-server web_search --json query="ucli documentation" limit=5
378
+ ucli mcp search-server invoketool web_search --json --data '{"query": "ucli documentation", "limit": 5}'
371
379
  ```
372
380
 
373
381
  ---
@@ -384,15 +392,15 @@ ucli mcp run search-server web_search --json query="ucli documentation" limit=5
384
392
 
385
393
  5. **Use `--query` to extract.** Instead of parsing the entire response, use JMESPath to extract exactly what you need.
386
394
 
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.
395
+ 6. **Use `mcp toolinfo` before `mcp invoketool`.** Use `ucli mcp <server> toolinfo <tool> --json` to discover a tool's full parameter schema before calling it. This avoids parameter errors.
388
396
 
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.
397
+ 7. **Use `--data` for tool/API calls.** When calling MCP tools or OAS APIs programmatically, prefer `--data '{"key": "value"}'` to pass arguments as JSON. JSON input is more reliable for complex or nested arguments.
390
398
 
391
399
  8. **Chain operations.** Use the output of one operation as input to the next:
392
400
  ```bash
393
401
  # Get customer ID, then create a charge
394
- CUSTOMER_ID=$(ucli run crm findCustomer --email user@example.com --query "id" | tr -d '"')
395
- ucli run payments createCharge --data "{\"customerId\": \"$CUSTOMER_ID\", \"amount\": 1000}"
402
+ CUSTOMER_ID=$(ucli oas crm invokeapi findCustomer --params '{"email":"user@example.com"}' --query "id" | tr -d '"')
403
+ ucli oas payments invokeapi createCharge --data "{\"customerId\": \"$CUSTOMER_ID\", \"amount\": 1000}"
396
404
  ```
397
405
 
398
406
  9. **Check pagination.** Large result sets may be paginated. Look for `nextPage`, `cursor`, or `Link` headers in the response.