OO

onlycli/onlycli

Developer tools
50 stars 8 forks Quality 49 Trend 13MIT

Turn any OpenAPI spec into a native CLI binary. No MCP, no bloat, no runtime dependencies, ONLY CLI.

Overview

Every endpoint in the GitHub REST API (1,107 operations) becomes a typed CLI command with flags, help text, and shell completion. Or download a pre-built binary from Releases. That's it. Every operation in the spec is now a CLI command. Pre-generated CLIs from live public specs: Detailed write-ups: vs Stainless · vs Restish · vs curl/HTTPie A GitHub MCP server loads into every prompt. Three services consume on idle. At scale, that is in pure schema overhead. 1. Generate a binary once from the spec 2. Agent calls ./cli --help to discover commands () 3. Agent runs ./cli repos get --owner x --repo y and reads stdout Stable command names, predictable flags, structured JSON output. No MCP server, no schema injection, no connection management. See the full cost analysis.

README

OnlyCLI

Turn any OpenAPI spec into a complete CLI. One command. One binary. 35x fewer tokens than MCP.

Every endpoint in the GitHub REST API (1,107 operations) becomes a typed CLI command with flags, help text, and shell completion.

Install

go install github.com/onlycli/onlycli/cmd/onlycli@latest

Or download a pre-built binary from Releases.

Quick Start

# 1. Generate -- point at any OpenAPI 3.x spec (local file or URL)
onlycli generate \
  --spec https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml \
  --name petstore --out ./petstore-cli

# 2. Build
cd petstore-cli && go mod tidy && go build -o petstore .

# 3. Use
./petstore pet find-pets-by-status --status available --format table
./petstore --help

That’s it. Every operation in the spec is now a CLI command.

What You Get

Every generated CLI ships with:

Capability How
Every endpoint as a command Grouped by tag, named by operationId
All parameters as --flags Path, query, header, and request body fields
7 output formats --format json|yaml|table|csv|pretty|jsonl|raw
Field projection --transform "#.name" via GJSON
Go template output --template '{{.login}}'
Auto-pagination --page-limit N auto-detects Link, cursor, offset, page-number
Streaming --stream for SSE and NDJSON responses
File input --data @payload.json or --data @- for stdin
OAuth2 authentication Device flow (interactive) + client credentials (CI)
Multi-profile config config set staging.token xxx && --profile staging
Retry with backoff --max-retries 3 for transient 429/5xx errors
Dry-run mode --dry-run prints the request without sending
HTTP/2 + gzip Modern transport, automatic content decompression
Shell completion completion bash|zsh|fish|powershell with enum hints
Cross-platform Linux, macOS, Windows; amd64, arm64

Examples

Pre-generated CLIs from live public specs:

Example Source Spec Groups Commands
petstore Swagger Petstore 3 19
github GitHub REST API 43 1,107

Regenerate them yourself:

make generate-example

Comparison

OnlyCLI curl Restish MCP tools
Typed commands per endpoint Yes No Yes Varies
Single distributable binary Yes Yes Yes No
Output formatting (table/yaml/csv) Yes No No No
Multi-scheme pagination Yes No No No
Streaming (SSE/NDJSON) Yes Manual No Varies
Works offline, no server process Yes Yes Yes No
Token cost for AI agents Low Low Low High

Detailed write-ups: vs Stainless · vs Restish · vs curl/HTTPie

For AI Agents: 35x Cheaper Than MCP

A GitHub MCP server loads 55,000 tokens into every prompt. Three services consume 72% of your context window on idle. At scale, that is $51,000/month in pure schema overhead.

OnlyCLI takes the opposite approach:

  1. Generate a binary once from the spec
  2. Agent calls ./cli --help to discover commands (~200 tokens)
  3. Agent runs ./cli repos get --owner x --repo y and reads stdout

Stable command names, predictable flags, structured JSON output. No MCP server, no schema injection, no connection management. See the full cost analysis.

Development

git clone https://github.com/onlycli/onlycli.git && cd onlycli
make test          # unit + integration tests
make lint          # golangci-lint
make check         # fmt + vet + lint + test
make build         # build to bin/onlycli

See CONTRIBUTING.md for the full guide and ARCHITECTURE.md for codebase structure.

License

MIT

View the full README on GitHub

Install

This server does not publish a one-line install command.

Open the repository installation guide New to MCP? Start with the mcpskill.org guide →