You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: v1.3 advanced features + WebSocket transport + batch command (#12)
* feat: v1.3 advanced features -- schema caching, access control, gateway resilience, output formats, skill auto-regen
Phase 15 - Schema Intelligence (ADV-01, ADV-02):
- Schema caching with 24hr TTL at ~/.cache/mcp2cli/schemas/
- SHA-256 drift detection with per-tool change alerts
- Cache clear/status commands, --fresh bypass flag
Phase 16 - Access Control & Discovery (ADV-05, INFRA-03):
- allowTools/blockTools glob patterns in services.json
- Cross-service tool search via `mcp2cli grep`
- TOOL_BLOCKED errors for policy-restricted tools
Phase 17 - Gateway Resilience (INFRA-01, INFRA-02):
- HTTP gateway with stdio fallback config
- Circuit breaker (5 failures, 60s cooldown, disk-persisted)
Phase 18 - Output Formats (ADV-03, ADV-04):
- --format table/yaml/csv/ndjson alongside default json
- Errors always JSON regardless of format flag
Phase 19 - Skill Auto-Regeneration (ADV-06):
- Drift-triggered skill file regeneration
- Manual section preservation via MANUAL:START/END markers
- --diff preview flag, access control integration
Security hardening from agent swarm review:
- Path traversal protection on cache/circuit-breaker file paths
- Input validation on schema command service/tool names
- ReDoS mitigation in glob patterns (collapse wildcards, length guard, cache)
- Circuit breaker state enum validation
- YAML key escaping for injection prevention
- Exhaustiveness guard on format switch
678 tests, 0 failures, 0 TypeScript errors across 79 source files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add example configs, generated skills, and fix test cache isolation
Examples:
- examples/services-basic.json -- single service config
- examples/services-multi.json -- multi-service with access control
- examples/services-http-fallback.json -- HTTP gateway with stdio fallback
- examples/skills/qmd/ -- real generated skill for QMD (6 tools, 247 tokens)
- examples/skills/n8n/ -- real generated skill for n8n (20 tools, 467 tokens)
- examples/skills/vaultwarden-secrets/ -- real generated skill (11 tools, 328 tokens)
Test isolation:
- Fix 4 daemon test files leaking cache artifacts into ~/.cache/mcp2cli/
- All tests now use isolated MCP2CLI_CACHE_DIR via mkdtemp
README:
- Add description fields to all example config blocks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add WebSocket transport and batch command
WebSocket transport:
- New "websocket" backend type in services.json config
- Uses SDK's built-in WebSocketClientTransport (persistent connection)
- Fallback to stdio with circuit breaker (same as HTTP)
- Wired into daemon pool, schema, service-help, tool-call, generate-skills
Batch command:
- `mcp2cli batch` reads NDJSON tool calls from stdin
- Executes sequentially by default, --parallel for concurrent execution
- Outputs NDJSON results with service.tool correlation
- Individual errors don't abort the batch
703 tests, 0 failures, 0 TypeScript errors across 81 source files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use direct imports for WebSocket transport to avoid CI module resolution failure
The barrel re-export from connection/index.ts caused a cascading module
evaluation failure in CI when the SDK's WebSocket module couldn't load.
Direct imports from websocket-transport.ts avoid this -- callers only
load the module when a websocket backend is actually configured.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(ci): use explicit LiteLLM model aliases in claude-code-review workflow
The claude-code-action expands 'sonnet' to 'claude-sonnet-4-6' internally,
which isn't a registered alias in our LiteLLM proxy. Using 'sonnet4.6'
and 'opus4.6' directly matches the LiteLLM model registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: retrigger PR checks after runner migration to dedicated LXC 106
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This pattern keeps MCP tool definitions out of the agent's system prompt entirely. The agent only pays context cost when it actually needs to call a tool, and even then only for the specific tool's schema -- not all tools from all servers.
251
253
254
+
## v1.3 Advanced Features
255
+
256
+
### Schema Caching
257
+
258
+
Schemas are cached locally to avoid re-fetching on every invocation. Cached schemas live at `~/.cache/mcp2cli/schemas/` with a 24-hour TTL. Cache drift is detected via SHA-256 hashing -- if the upstream schema changes, the cache is automatically invalidated.
259
+
260
+
```bash
261
+
# Check cache status (age, TTL, drift)
262
+
mcp2cli cache status
263
+
264
+
# Clear all cached schemas
265
+
mcp2cli cache clear
266
+
267
+
# Clear cache for a specific service
268
+
mcp2cli cache clear n8n
269
+
270
+
# Bypass cache for a single schema lookup
271
+
mcp2cli schema n8n.n8n_list_workflows --fresh
272
+
```
273
+
274
+
Override the cache directory with `MCP2CLI_CACHE_DIR`.
275
+
276
+
### Access Control
277
+
278
+
Restrict which tools are exposed per service using `allowTools` and `blockTools` in `services.json`. Both accept glob patterns.
279
+
280
+
```json
281
+
{
282
+
"services": {
283
+
"n8n": {
284
+
"description": "n8n workflow automation",
285
+
"backend": "stdio",
286
+
"command": "npx",
287
+
"args": ["-y", "@anthropic/n8n-mcp"],
288
+
"allowTools": ["n8n_list_*", "n8n_get_*"],
289
+
"blockTools": ["n8n_delete_*"]
290
+
}
291
+
}
292
+
}
293
+
```
294
+
295
+
When both are present, `allowTools` is evaluated first (whitelist), then `blockTools` removes matches from the allowed set.
296
+
297
+
#### Cross-Service Tool Search
298
+
299
+
Search for tools across all services using cached schemas:
300
+
301
+
```bash
302
+
# Find all tools matching a pattern
303
+
mcp2cli grep "workflow"
304
+
305
+
# Regex patterns work
306
+
mcp2cli grep "delete|remove"
307
+
```
308
+
309
+
This searches cached schemas only -- no MCP connections are made.
310
+
311
+
### WebSocket Transport
312
+
313
+
Connect to MCP servers over WebSocket. Supports optional stdio fallback and access control, same as HTTP.
314
+
315
+
```json
316
+
{
317
+
"services": {
318
+
"remote-mcp": {
319
+
"description": "Remote MCP server via WebSocket",
320
+
"backend": "websocket",
321
+
"url": "ws://mcp-gateway.local:3000/mcp",
322
+
"fallback": {
323
+
"command": "npx",
324
+
"args": ["-y", "@anthropic/n8n-mcp"]
325
+
}
326
+
}
327
+
}
328
+
}
329
+
```
330
+
331
+
WebSocket services benefit from the same circuit breaker and fallback behavior as HTTP services.
332
+
333
+
### Batch Tool Calls
334
+
335
+
Execute multiple tool calls in a single invocation by piping NDJSON to `mcp2cli batch`. Each line is a JSON object with `service`, `tool`, and `params` fields:
Errors for individual calls are reported inline without aborting the batch.
359
+
360
+
### Gateway Resilience
361
+
362
+
HTTP/SSE services can define a `fallback` stdio config. If the remote gateway is unreachable, mcp2cli transparently falls back to a local MCP server process.
363
+
364
+
```json
365
+
{
366
+
"services": {
367
+
"n8n": {
368
+
"description": "n8n via HTTP gateway with stdio fallback",
369
+
"backend": "http",
370
+
"url": "http://mcp-gateway:3000/n8n",
371
+
"fallback": {
372
+
"command": "npx",
373
+
"args": ["-y", "@anthropic/n8n-mcp"]
374
+
}
375
+
}
376
+
}
377
+
}
378
+
```
379
+
380
+
A circuit breaker protects against repeated failures: after 5 consecutive failures the circuit opens and routes directly to fallback for 60 seconds before re-probing the primary. Circuit state is persisted to `~/.cache/mcp2cli/circuit-breaker/` so it survives process restarts.
|`csv`| RFC 4180 CSV -- pipe to spreadsheets or `csvtool`|
399
+
|`ndjson`| One JSON object per line -- for streaming pipelines |
400
+
401
+
Error responses are always JSON regardless of the `--format` flag.
402
+
403
+
### Skill Auto-Regeneration
404
+
405
+
Generated skill files can be previewed and kept in sync with upstream schema changes:
406
+
407
+
```bash
408
+
# Preview what would change without writing
409
+
mcp2cli generate-skills --diff n8n
410
+
411
+
# Regenerate (preserves manual sections)
412
+
mcp2cli generate-skills n8n
413
+
```
414
+
415
+
Manual edits inside `MANUAL:START` / `MANUAL:END` markers are preserved across regeneration. When schema drift is detected (via the caching layer), skill regeneration can be triggered automatically.
416
+
417
+
## v1.3 Environment Variables
418
+
419
+
In addition to the variables listed above, v1.3 adds:
420
+
421
+
| Variable | Default | Description |
422
+
|----------|---------|-------------|
423
+
|`MCP2CLI_CACHE_DIR`|`~/.cache/mcp2cli`| Base directory for schema cache and circuit breaker state |
0 commit comments