diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f16c30f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,63 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +- OpenClaw skill (`skills/ocli-api/SKILL.md`) published to [ClawHub](https://clawhub.ai/skills/ocli-api) +- Fair 4-strategy token benchmark: MCP Naive, MCP+Search Full, MCP+Search Compact, CLI +- mcp2cli added to comparison table with MCP/GraphQL/TOON/OAuth features +- CHANGELOG.md + +### Changed +- README rewritten: "CLI vs MCP" positioning replaced with 4-layer model (Built-in Tools, MCP, Skills, CLI) +- README reduced from 285 to 175 lines — removed implementation details available via `--help` +- Benchmark now uses same BM25 engine for all strategies (fair comparison) + +### Fixed +- Nested JSON values for body flags now parsed correctly (#5, thanks @veged) + +## [0.1.3] - 2026-03-12 + +### Added +- BM25 command search (`ocli commands --query "..."`) +- Regex command search (`ocli commands --regex "..."`) +- YAML spec support (Box API 258 endpoints tested) +- GitHub API test fixture (845 endpoints) +- Box API test fixture (258 endpoints) +- `ocli commands` replaces deprecated `ocli search` +- CLI-Anything added to comparison table +- MIT license file + +## [0.1.2] - 2026-03-12 + +### Added +- Command generation from OpenAPI paths and methods + +## [0.1.1] - 2026-03-12 + +### Fixed +- Version tag generation + +## [0.1.0] - 2026-03-12 + +### Added +- Initial release +- OpenAPI/Swagger spec loading (URL and local file) +- Spec caching in `.ocli/specs/` +- Profile management (`profiles add/list/show/remove`, `use`) +- Command generation from OpenAPI paths with method suffix logic +- Path and query parameter extraction +- HTTP request execution (GET, POST, PUT, DELETE, PATCH) +- Basic and Bearer token authentication +- GitHub Actions CI/CD workflows + +[Unreleased]: https://github.com/EvilFreelancer/openapi-to-cli/compare/v0.1.3...HEAD +[0.1.3]: https://github.com/EvilFreelancer/openapi-to-cli/compare/v0.1.2...v0.1.3 +[0.1.2]: https://github.com/EvilFreelancer/openapi-to-cli/compare/v0.1.1...v0.1.2 +[0.1.1]: https://github.com/EvilFreelancer/openapi-to-cli/compare/v0.1.0...v0.1.1 +[0.1.0]: https://github.com/EvilFreelancer/openapi-to-cli/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 5cc38b0..dd7f9f2 100644 --- a/README.md +++ b/README.md @@ -2,376 +2,172 @@ `openapi-to-cli` (short `ocli`) is a TypeScript CLI that turns any HTTP API described by an OpenAPI/Swagger spec into a set of CLI commands — at runtime, without code generation. -- **Input**: OpenAPI/Swagger spec (URL or file) plus API connection settings. -- **Output**: an executable `ocli` binary where each API operation is exposed as a dedicated subcommand. - -Unlike [openapi-to-mcp](https://github.com/EvilFreelancer/openapi-to-mcp), which starts an MCP server with tools, `ocli` provides a direct command-line interface. - -### Why convert OpenAPI spec to CLI? +```bash +npm install -g openapi-to-cli -The trend is clear: **CLI commands are cheaper and more native than MCP tools** for AI agents. +ocli profiles add github \ + --api-base-url https://api.github.com \ + --openapi-spec https://api.github.com/openapi.json \ + --api-bearer-token "$GITHUB_TOKEN" -| Factor | MCP Tools | CLI Commands | -|--------|-----------|--------------| -| **Token cost** | Each tool call requires full JSON schema in context on every request | CLI commands are invoked by name with flags — minimal token overhead | -| **Startup overhead** | MCP server must be running, connected via transport layer | Single process, instant execution, zero transport cost | -| **Composability** | Tools are isolated in MCP server scope | CLI commands pipe, chain, and integrate with shell scripts natively | -| **Agent compatibility** | Requires MCP-aware client (Claude, Cursor, etc.) | Any agent that can run shell commands — universal | -| **Discoverability** | Agent must hold all tool schemas in context window | `--help` for quick lookup, `search --query` for BM25-ranked discovery | -| **Multi-API** | One MCP server per API, each consuming context | Multiple profiles in one binary, switch with `ocli use ` | -| **Endpoint scoping** | All tools exposed at once, no per-session filtering | Per-profile `--include/--exclude-endpoints` — same API, different command sets for different roles | -| **Debugging** | Opaque transport, hard to inspect | Plain HTTP requests, visible in terminal | +ocli commands --query "create pull request" --limit 3 +ocli repos_owner_repo_pulls_post --owner octocat --repo hello --title "Fix bug" --head feature --base main +``` -When an agent has access to 200+ API endpoints, loading all of them as MCP tools burns thousands of tokens per turn. With `ocli`, the agent calls `ocli search --query "upload files"` to discover relevant commands, then executes them directly. The context window stays clean. +### Where CLI fits: Tools, MCP, Skills, and CLI -**Bottom line**: if your agent talks to HTTP APIs, CLI is the most token-efficient and portable interface available today. +Tools, MCP, skills, and CLI are not competing approaches — they solve different problems at different layers: -### Comparison +| Layer | What | Best for | +|-------|------|----------| +| **Built-in tools** | Standard agent toolset | Critical capabilities that must always be in context (file read/write, shell, browser) | +| **MCP** | Remote tool servers | APIs that need centralized auth, enterprise SSO, shared state, persistent connections, or can't be in standard delivery | +| **Skills** | On-demand instructions | Context isolation, teaching agents _when_ and _how_ to use a tool — loaded only when needed | +| **CLI** | Runtime execution | Long action chains, automation, shell pipelines — agent already knows what to do | -| Feature | ocli | [mcp2cli](https://github.com/knowsuchagency/mcp2cli) | [openapi-cli-generator](https://github.com/danielgtaylor/openapi-cli-generator) | [CLI-Anything](https://github.com/HKUDS/CLI-Anything) | -|---------|:----:|:------:|:---------------------:|:-------------:| -| Runtime interpretation (no codegen) | ✅ | ✅ | ❌ | ❌ | -| Works without LLM | ✅ | ✅ | ✅ | ❌ | -| Zero-setup install (`npx`/`uvx`) | ✅ | ✅ | ❌ | ❌ | -| Instant API onboarding (seconds) | ✅ | ✅ | ❌ | ❌ | -| Multiple API profiles in one binary | ✅ | ✅ (bake mode) | ❌ | ❌ | -| Multiple endpoint sets per API | ✅ | ✅ (include/exclude globs) | ❌ | ❌ | -| BM25 command search | ✅ | ❌ (substring only) | ❌ | ❌ | -| Regex command search | ✅ | ❌ | ❌ | ❌ | -| Per-profile endpoint filtering | ✅ | ✅ | ❌ | ❌ | -| OpenAPI/Swagger spec (JSON + YAML) | ✅ | ✅ | ✅ | ❌ | -| MCP server support | ❌ | ✅ (HTTP/SSE/stdio) | ❌ | ❌ | -| GraphQL support | ❌ | ✅ (introspection) | ❌ | ❌ | -| Spec caching with refresh | ✅ | ✅ (1h TTL) | ❌ | ❌ | -| Add new API without recompile | ✅ | ✅ | ❌ | ❌ | -| Non-HTTP integrations (desktop apps) | ❌ | ❌ | ❌ | ✅ | -| Session management / undo-redo | ❌ | ✅ (daemon sessions) | ❌ | ✅ | -| JSON structured output | ❌ | ✅ (JSON + TOON) | ✅ | ✅ | -| Custom HTTP headers | ✅ | ✅ | ❌ | ❌ | -| Command name prefix | ✅ | ❌ | ❌ | ❌ | -| Basic / Bearer auth | ✅ | ✅ | ✅ | ❌ | -| OAuth2 / Auth0 | ❌ | ✅ (PKCE + client credentials) | ✅ | ✅ | -| Response jq/JMESPath filtering | ❌ | ✅ (jq) | ✅ (JMESPath) | ❌ | -| Syntax-highlighted output | ❌ | ✅ | ✅ | ❌ | -| Token-optimized output (TOON) | ❌ | ✅ (40-60% savings) | ❌ | ❌ | -| Auto-generated tests | ❌ | ❌ | ❌ | ✅ | -| Active project | ✅ | ✅ | ❌ (deprecated) | ✅ | +`ocli` lives at the **runtime layer**. When an agent needs to call a REST API — search for the right endpoint, check its parameters, execute the call — CLI does this with minimal context overhead and zero infrastructure. -### High level idea +MCP is the right choice when you need centralized auth, persistent connections, or shared state. CLI is the right choice when you need a lightweight, portable way to call HTTP APIs from any agent with shell access. -- The user installs the package (for example via `npx` or globally) and gets the `ocli` binary in `$PATH`. -- On first use the user onboards an API with a command like: +### Quick start ```bash +# Install +npm install -g openapi-to-cli + +# Add an API profile ocli profiles add myapi \ - --api-base-url http://127.0.0.1:2222 \ - --openapi-spec http://127.0.0.1:2222/openapi.json \ - --api-bearer-token "..." \ - --include-endpoints get:/messages,get:/channels \ - --exclude-endpoints post:/admin/secret \ + --api-base-url https://api.example.com \ + --openapi-spec https://api.example.com/openapi.json \ + --api-bearer-token "$TOKEN" \ + --include-endpoints "get:/messages,post:/messages" \ --command-prefix "myapi_" \ - --custom-headers '{"X-Tenant":"acme","X-Request-Source":"cli"}' -``` + --custom-headers '{"X-Tenant":"acme"}' -Alternatively, `ocli onboard` (with the same options, no profile name) creates a profile named `default`. +# Set as active profile +ocli use myapi -- The CLI: - - downloads and validates the OpenAPI spec; - - stores profile configuration; - - caches the spec in the filesystem; - - builds a set of commands based on paths and methods. +# Discover commands +ocli commands --query "send message" --limit 5 -After onboarding, commands can be used like: +# Check parameters +ocli myapi_messages_post --help -```bash -ocli messages_get --profile myapi --limit 10 -ocli channels_username_get --profile myapi --username alice +# Execute +ocli myapi_messages_post --text "Hello world" ``` -or using the default profile: +Or use `npx` without global install: ```bash -ocli use myapi -ocli messages --limit 10 +npx openapi-to-cli onboard \ + --api-base-url https://api.example.com \ + --openapi-spec https://api.example.com/openapi.json ``` ### Command search -When the API surface is too large for `--help`, use command filtering with `commands`: - ```bash # BM25 natural language search -ocli commands --query "upload files" -ocli commands -q "list messages" --limit 5 +ocli commands --query "upload files" --limit 5 # Regex pattern matching -ocli commands --regex "admin.*get" -ocli commands -r "messages" -n 3 -``` - -The BM25 engine (ported from [picoclaw](https://github.com/sipeed/picoclaw)) ranks commands by relevance across name, method, path, description, and parameter names. This enables agents to discover the right endpoint without loading all command schemas into context. The legacy `ocli search` command is kept as a deprecated alias and internally forwards to `ocli commands` with the same flags. - -### Benchmark: three strategies for AI agent ↔ API interaction - -Tested against [Swagger Petstore](https://petstore3.swagger.io/) ([OpenAPI spec](https://petstore3.swagger.io/api/v3/openapi.json)). Scaling projections use the [GitHub API](https://api.apis.guru/v2/specs/github.com/api.github.com/1.1.4/openapi.json) (845 endpoints). +ocli commands --regex "users.*post" --limit 10 -Three strategies compared: - -| # | Strategy | How it works | Tools in context | -|---|----------|-------------|-----------------| -| 1 | **MCP Naive** | All endpoints as MCP tools | N tools (one per endpoint) | -| 2 | **MCP+Search** | 2 tools: `search_tools` + `call_api` | 2 tools | -| 3 | **CLI (ocli)** | 1 tool: `execute_command` | 1 tool | - -Run the benchmark yourself: - -```bash -npx ts-node benchmarks/benchmark.ts -``` - -Results (19 endpoints, 15 natural-language queries): - -``` - TOOL DEFINITION OVERHEAD (sent with every API request) - - MCP Naive ██████████████████████████████ 2 945 tok (19 tools) - MCP+Search ████ 346 tok (2 tools) - CLI (ocli) █ 138 tok (1 tool) - - SEARCH RESULT SIZE (3 matching endpoints) - - MCP+Search ██████████████████████████████ 995 tok (full JSON schemas) - CLI (ocli) ██ 67 tok (name + method + path) - - SCALING: OVERHEAD PER TURN vs ENDPOINT COUNT - - Endpoints MCP Naive MCP+Search CLI (ocli) Naive/CLI - 19 2 945 tok 346 tok 138 tok 21x ← Petstore - 100 15 415 tok 346 tok 138 tok 112x - 845 130 106 tok 346 tok 138 tok 943x ← GitHub API - - VERDICT - - Overhead/turn Search result Accuracy Server? - MCP Naive 2 945 tok N/A 100% Yes - MCP+Search 346 tok 995 tok/query 93% Yes - CLI (ocli) 138 tok 67 tok/query 93% No - - Monthly cost (845 endpoints, 100 tasks/day, Claude Sonnet $3/M input): - MCP Naive $1 172/month - MCP+Search $ 92/month - CLI (ocli) $ 4/month -``` - -Key insights: -- **MCP Naive** is simple but scales terribly (130K tokens at 845 endpoints). -- **MCP+Search** fixes the overhead but search results carry full JSON schemas — 15x larger than CLI text output. -- **CLI** returns compact text, needs no MCP server, and works with any agent that has shell access. -- Both search approaches share the same BM25 accuracy (93% top-3). The 7% miss is recoverable — the agent retries with a different query. - -### Installation and usage via npm and npx - -To use `ocli` locally without installing it globally you can rely on `npx`: - -```bash -npx openapi-to-cli onboard \ - --api-base-url http://127.0.0.1:2222 \ - --openapi-spec http://127.0.0.1:2222/openapi.json +# List all commands +ocli commands ``` -The command above will - -- download the `openapi-to-cli` package from npm if it is not cached yet -- run the `ocli` binary from the package -- create the `default` profile and cache the OpenAPI spec under `.ocli/specs/default.json` - -After onboarding you can continue to use the generated commands with the `ocli` binary that `npx` runs for you: - -```bash -npx openapi-to-cli use myapi -npx openapi-to-cli messages_get --limit 10 -``` +The BM25 engine ranks commands by relevance across name, method, path, description, and parameter names. Tested on APIs with 845+ endpoints (GitHub API). -If you prefer a global installation you can also install the package once +### Using with AI agents -```bash -npm install -g openapi-to-cli -``` +#### OpenClaw skill -and then call the binary directly +Install the [ocli-api](https://clawhub.ai/skills/ocli-api) skill from [ClawHub](https://clawhub.ai): ```bash -ocli onboard --api-base-url http://127.0.0.1:2222 --openapi-spec http://127.0.0.1:2222/openapi.json -ocli messages_get --limit 10 -``` - -### Profiles and configuration files - -- A profile describes a single API connection. -- Profiles are stored in an INI file (one section per profile, no special "current" key in the INI): - - global: `~/.ocli/profiles.ini` - - project-local: `./.ocli/profiles.ini` (has higher priority than global) -- The profile to use when the user does not pass `--profile` is stored in `.ocli/current` (one line: profile name). If the file is missing or empty, the profile named `default` is used. The profile named `default` is a normal profile like any other; it is just used when no profile is specified. - -Example `profiles.ini` structure: - -```ini -[default] -api_base_url = http://127.0.0.1:1111 -api_basic_auth = -api_bearer_token = MY_TOKEN -openapi_spec_source = http://127.0.0.1:1111/openapi.json -openapi_spec_cache = /home/user/.ocli/specs/default.json -include_endpoints = get:/messages,get:/channels -exclude_endpoints = - -[myapi] -api_base_url = http://127.0.0.1:2222 -api_basic_auth = -api_bearer_token = MY_TOKEN -openapi_spec_source = http://127.0.0.1:2222/openapi.json -openapi_spec_cache = /home/user/.ocli/specs/myapi.json -include_endpoints = get:/messages,get:/channels -exclude_endpoints = +clawhub install ocli-api ``` -The local file `./.ocli/profiles.ini`, if present, fully overrides the global one when resolving profiles. - -### OpenAPI/Swagger caching - -- Config and cache directory: - - globally: `~/.ocli/` - - locally: `./.ocli/` relative to the directory where `ocli` is executed. - -- Inside `.ocli` the CLI creates: - - `profiles.ini` - profile configuration (one section per profile); - - `current` - one line with the profile name to use when `--profile` is not passed (optional; if missing, profile `default` is used); - - `specs/` - directory with cached specs: - - `specs/.json` - OpenAPI spec content for the profile. - -- During onboarding: - - the CLI loads the spec from `--openapi-spec`; - - writes it to `specs/.json`; - - stores the cache path in `openapi_spec_cache` in the corresponding profile section. - -- When running commands: - - by default the spec is read from `openapi_spec_cache`; - - later we can add a flag to force spec refresh (for example `--refresh-spec`) that will overwrite the cache. - -### Mapping OpenAPI operations to CLI commands +Or manually copy [`skills/ocli-api/SKILL.md`](skills/ocli-api/SKILL.md) to `~/.openclaw/skills/ocli-api/SKILL.md`. -- For each OpenAPI operation (method + path) the CLI exposes one subcommand. -- Command name is derived from the path: - - `/messages` → `messages` - - `/channels/{username}` → `channels_username` -- If the same path segment is used by multiple methods (GET, POST, etc.), a method suffix is added: - - `/messages` GET → `messages_get` - - `/messages` POST → `messages_post` +#### Claude Code skill -Invocation format: +Copy the example skill to your project: ```bash -ocli [--profile ] [options...] +cp examples/skill-ocli-api.md .claude/skills/api.md ``` -where: - -- `tool-name` is the name derived from the path (with method suffix when needed); -- `options` is the set of flags representing operation parameters: - - query and path parameters → `--param-name`; - - JSON body fields → also `--field-name`. - -Option types and required flags are determined from the OpenAPI schema. - -### CLI commands and help - -The `ocli` binary provides the following core commands: - -- `ocli onboard` - add a new profile named `default` (alias for `ocli profiles add default`). Options: - - `--api-base-url ` - API base URL; - - `--openapi-spec ` - OpenAPI source (URL or file path); - - `--api-basic-auth ` - optional; - - `--api-bearer-token ` - optional; - - `--include-endpoints ` - comma-separated `method:path`; - - `--exclude-endpoints ` - comma-separated `method:path`; - - `--command-prefix ` - prefix for command names (e.g. `api_` -> `api_messages`, `api_users`); - - `--custom-headers ` - custom HTTP headers as JSON string (e.g. `'{"X-Tenant":"acme","X-Request-Source":"cli"}'`). Legacy comma-separated `key:value` format is also supported for simple values without commas. - -- `ocli profiles add ` - add a new profile with the given name and cache the OpenAPI spec. Same options as `onboard` (profile name is the positional argument). - -- `ocli profiles list` - list all profiles; -- `ocli profiles show ` - show profile details; -- `ocli profiles remove ` - remove a profile; -- `ocli use ` - set the profile to use when `--profile` is not passed (writes profile name to `.ocli/current`). -- `ocli commands` - list available commands generated from the current profile and its OpenAPI spec, optionally filter them with `--query` (BM25) or `--regex`. -- `ocli search` - deprecated alias for `ocli commands` with `--query/--regex`, kept for backward compatibility. -- `ocli --version` - print the CLI version baked at build time (derived from the latest git tag when available). +#### Agent workflow -Help: +1. `ocli commands --query "upload file"` — discover the right command +2. `ocli files_content_post --help` — check parameters +3. `ocli files_content_post --file ./data.csv` — execute -- `ocli -h|--help` - global help and command overview; -- `ocli onboard -h|--help` - onboarding help; -- `ocli profiles -h|--help` - profile management help; -- `ocli -h|--help` - description of a particular operation, list of options and their types (generated from OpenAPI). +### Benchmark -### Architecture +Four strategies compared on [Swagger Petstore](https://petstore3.swagger.io/) (19 endpoints), with scaling projections to [GitHub API](https://api.apis.guru/v2/specs/github.com/api.github.com/1.1.4/openapi.json) (845 endpoints). All search strategies use the same BM25 engine. ``` -src/ -├── cli.ts # Entry point, command routing, HTTP requests -├── config.ts # .ocli directory resolution (local > global) -├── openapi-loader.ts # OpenAPI spec download and caching -├── openapi-to-commands.ts # OpenAPI → CLI command generation -├── command-search.ts # BM25 + regex search over commands -├── bm25.ts # BM25 ranking engine (ported from picoclaw) -├── profile-store.ts # Profile persistence in INI format -└── version.ts # Version constant (generated at build) -``` - -The project mirrors parts of the `openapi-to-mcp` architecture but implements a CLI instead of an MCP server: + TOOL DEFINITION OVERHEAD (sent with every API request) -- `config` - reads profile configuration and cache paths (INI files, global and local `.ocli` lookup). -- `profile-store` - works with `profiles.ini` (read, write, select profile, current profile). -- `openapi-loader` - loads and caches the OpenAPI spec (URL or file) into `.ocli/specs/`. -- `openapi-to-commands` - parses OpenAPI, applies include/exclude filters, generates command names and option schemas. -- `command-search` - BM25 and regex search over generated commands for discovery on large API surfaces. -- `bm25` - generic BM25 ranking engine with Robertson IDF smoothing and min-heap top-K extraction. -- `cli` - entry point, argument parser, command registration, help output. + MCP Naive █████████████████████████ 2,945 tok (19 tools) + MCP+Search Full ███ 355 tok (2 tools) + MCP+Search Compact ████ 437 tok (3 tools) + CLI (ocli) █ 158 tok (1 tool) -### Using with AI agents + TOTAL TOKENS PER TASK (realistic multi-turn agent flow) -#### OpenClaw skill + MCP Naive █████████████████████████ 3,015 tok (1 turn) + MCP+Search Full ██████████████████ 2,185 tok (2 turns) + MCP+Search Compact █████████████████ 2,066 tok (3 turns) + CLI (ocli) ████████ 925 tok (3 turns) -Install the [ocli-api](https://clawhub.ai/skills/ocli-api) skill from [ClawHub](https://clawhub.ai): + SCALING: OVERHEAD PER TURN vs ENDPOINT COUNT -```bash -clawhub install ocli-api + Endpoints MCP Naive MCP+S Compact CLI (ocli) + 19 2,945 tok 437 tok 158 tok ← Petstore + 845 130,106 tok 437 tok 158 tok ← GitHub API ``` -Or manually copy [`skills/ocli-api/SKILL.md`](skills/ocli-api/SKILL.md) to `~/.openclaw/skills/ocli-api/SKILL.md`. - -#### Claude Code skill - -Copy the example skill to your project: +Run the benchmark yourself: `npx ts-node benchmarks/benchmark.ts` -```bash -cp examples/skill-ocli-api.md .claude/skills/api.md -``` +Note: MCP+Search Compact (search → get_schema → call) is the fairest comparison to CLI (search → --help → execute) — same number of turns, same BM25 engine. The difference is tool definition overhead (437 vs 158 tok/turn) and schema format (JSON vs text). -#### Agent workflow +### Comparison -1. `ocli commands --query "upload file"` — discover the right command -2. `ocli files_content_post --help` — check parameters -3. `ocli files_content_post --file ./data.csv` — execute +| Feature | ocli | [mcp2cli](https://github.com/knowsuchagency/mcp2cli) | [openapi-cli-generator](https://github.com/danielgtaylor/openapi-cli-generator) | [CLI-Anything](https://github.com/HKUDS/CLI-Anything) | +|---------|:----:|:------:|:---------------------:|:-------------:| +| Runtime interpretation (no codegen) | ✅ | ✅ | ❌ | ❌ | +| Works without LLM | ✅ | ✅ | ✅ | ❌ | +| Zero-setup install (`npx`/`uvx`) | ✅ | ✅ | ❌ | ❌ | +| Multiple API profiles | ✅ | ✅ (bake mode) | ❌ | ❌ | +| BM25 command search | ✅ | ❌ (substring only) | ❌ | ❌ | +| Regex command search | ✅ | ❌ | ❌ | ❌ | +| Per-profile endpoint filtering | ✅ | ✅ | ❌ | ❌ | +| OpenAPI/Swagger (JSON + YAML) | ✅ | ✅ | ✅ | ❌ | +| MCP server support | ❌ | ✅ (HTTP/SSE/stdio) | ❌ | ❌ | +| GraphQL support | ❌ | ✅ (introspection) | ❌ | ❌ | +| Spec caching | ✅ | ✅ (1h TTL) | ❌ | ❌ | +| Custom HTTP headers | ✅ | ✅ | ❌ | ❌ | +| Command name prefix | ✅ | ❌ | ❌ | ❌ | +| Basic / Bearer auth | ✅ | ✅ | ✅ | ❌ | +| OAuth2 | ❌ | ✅ (PKCE) | ✅ | ✅ | +| Response filtering (jq/JMESPath) | ❌ | ✅ (jq) | ✅ (JMESPath) | ❌ | +| Token-optimized output (TOON) | ❌ | ✅ | ❌ | ❌ | +| JSON structured output | ❌ | ✅ | ✅ | ✅ | +| Active project | ✅ | ✅ | ❌ (deprecated) | ✅ | ### Similar projects -- [mcp2cli](https://github.com/knowsuchagency/mcp2cli) - Python CLI that converts MCP servers, OpenAPI specs, and GraphQL endpoints into CLI commands at runtime. Supports OAuth, TOON output format, and daemon sessions. -- [openapi-cli-generator](https://github.com/danielgtaylor/openapi-cli-generator) - generates a CLI from an OpenAPI 3 specification using code generation. -- [anything-llm-cli](https://github.com/Mintplex-Labs/anything-llm/tree/master/clients/anything-cli) - CLI for interacting with AnythingLLM, can consume HTTP APIs and tools. -- [openapi-commander](https://github.com/bcoughlan/openapi-commander) - Node.js command-line tool generator based on OpenAPI definitions. -- [OpenAPI Generator](https://openapi-generator.tech/docs/usage) - general-purpose OpenAPI code generator that can also generate CLI clients. -- [openapi2cli](https://pypi.org/project/openapi2cli/) - Python tool that builds CLI interfaces for OpenAPI 3 APIs. +- [mcp2cli](https://github.com/knowsuchagency/mcp2cli) — Python CLI that converts MCP servers, OpenAPI specs, and GraphQL endpoints into CLI commands at runtime. Supports OAuth, TOON output format, and daemon sessions. +- [openapi-cli-generator](https://github.com/danielgtaylor/openapi-cli-generator) — generates a CLI from an OpenAPI 3 specification using code generation. +- [anything-llm-cli](https://github.com/Mintplex-Labs/anything-llm/tree/master/clients/anything-cli) — CLI for interacting with AnythingLLM, can consume HTTP APIs and tools. +- [openapi-commander](https://github.com/bcoughlan/openapi-commander) — Node.js command-line tool generator based on OpenAPI definitions. +- [OpenAPI Generator](https://openapi-generator.tech/docs/usage) — general-purpose OpenAPI code generator that can also generate CLI clients. +- [openapi2cli](https://pypi.org/project/openapi2cli/) — Python tool that builds CLI interfaces for OpenAPI 3 APIs. ### License