Your API has hundreds of endpoints.
Now they're all CLI commands.

Point OnlyCLI at any OpenAPI spec. Get a native binary with every operation as a typed command -- flags, help text, pagination, and shell completion included.

go install github.com/onlycli/onlycli/cmd/onlycli@latest
terminal
$ onlycli generate --spec api.github.com.yaml --name github --auth bearer --out ./gh
Generated CLI project at ./gh
  Groups: 43
  Commands: 1107
  Auth: bearer (env: GITHUB_TOKEN)

$ cd gh && go build -o gh . && ./gh repos get --owner golang --repo go
{"id":23096959,"name":"go","full_name":"golang/go","stargazers_count":128000,...}

$ ./gh issues list-for-repo --owner golang --repo go --state open --format table
ID       TITLE                          STATE   CREATED
71234    proposal: spec: add ...        open    2025-12-01
71198    cmd/go: module cache ...       open    2025-11-30
1,107 commands from the GitHub API spec
35x fewer tokens than MCP for AI agents
1 command to generate them all
0 runtime dependencies

Start in 30 seconds

1

Install

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

Generate

$ onlycli generate \
    --spec your-api.yaml \
    --name myapi --out ./cli
3

Build & use

$ cd cli && go build -o myapi .
$ ./myapi --help
$ ./myapi users list --format table

Every operation in your spec becomes a command. Every parameter becomes a flag. That's it.

What OnlyCLI is

OnlyCLI is an OpenAPI CLI generator for teams that want a native command-line interface instead of hand-written wrappers, brittle curl scripts, or an always-on MCP server. It turns OpenAPI 3.x specs into Go binaries that developers, CI jobs, and AI agents can discover with --help and call directly.

For developers

Generate a real CLI from an API spec with typed commands, shell completion, auth handling, and readable help text. Keep the generated project in git and ship one binary per API.

For CI and automation

Use stable commands and structured stdout in pipelines, cron jobs, and scripts. No runtime service, no Node.js dependency, and no custom wrappers for every endpoint.

For AI agents

Let agents inspect command trees on demand, execute a narrow operation, and read JSON, YAML, table, or CSV output without reloading a giant tool schema into every prompt.

Why OnlyCLI?

Complete coverage, zero effort

  • Every endpoint becomes a CLI command
  • Params, query strings, bodies mapped to typed --flags
  • Help text auto-generated from spec descriptions

One binary, ship anywhere

  • Compiled Go binary, zero runtime deps
  • No interpreter, VM, or node_modules
  • Copy to a server, container, or laptop

AI agents use it natively

  • Agents call --help to discover commands
  • Execute and read structured stdout directly
  • No MCP server, no schema injection, no token waste

Everything you need, built in

Not just commands and flags. Generated CLIs ship with the features you'd build yourself -- so you don't have to.

7 output formats

--format json|yaml|table|csv|pretty|jsonl|raw -- tables, JSON, or diff-friendly YAML.

GJSON transforms

--transform "#.full_name" -- project fields inline without reaching for jq.

Auto-pagination

--page-limit 10 auto-detects Link header, cursor, offset, and page-number schemes. One flag, complete results.

File & stdin input

--data @payload.json or --data @- for stdin. Readable commands, repeatable CI.

OAuth2 built in

Device flow for login, client credentials for CI. Tokens saved per profile.

Multi-profile config

--profile staging -- switch dev, staging, and prod without re-exporting secrets.

Retry with backoff

--max-retries 3 -- exponential backoff for 429s and 5xx. Respects Retry-After.

Dry-run mode

--dry-run -- prints method, URL, headers, body without sending.

Smart shell completion

Bash, zsh, fish, PowerShell. Enums surface as completion candidates.

Go template output

--template '{{.login}}' -- custom formatting beyond field projection.

Nested body flags

--name.first John -- builds nested JSON, no heredocs needed.

HTTP/2 + compression

Multiplexed requests, auto gzip decompression out of the box.

Real-world: GitHub REST API

The full GitHub API spec has 1,107 operations across 43 groups. OnlyCLI generates a complete CLI in under 5 seconds.

# Generate from the official GitHub spec
$ onlycli generate \
    --spec https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.yaml \
    --name github --auth bearer --out ./github-cli

# Build and authenticate
$ cd github-cli && go build -o gh .
$ export GITHUB_TOKEN=ghp_xxx

# List repos as a table
$ ./gh repos list-for-user --username octocat --format table

# Create an issue with flags
$ ./gh issues create --owner myorg --repo myrepo --title "Bug" --body "Details here"

# Search with field projection
$ ./gh search repos --q "language:go stars:>1000" --sort stars --transform "#.full_name"

# Paginate automatically
$ ./gh repos list-for-user --username octocat --page-limit 5 --format csv

How it compares

OnlyCLI curl Restish MCP tools
Typed commands per endpoint Yes No Yes Varies
Single binary, no runtime Yes Yes Yes No
Table / YAML / CSV output Yes No No No
Auto-pagination (Link, cursor, offset) Yes No No No
GJSON field transforms Yes No No No
Works offline, no server Yes Yes Yes No
35x fewer tokens than MCP ~200 tok Low Low 55K+ tok
Streaming (SSE / NDJSON) Yes Manual No Varies

Need the proof behind the comparison table? Read the CLI vs MCP token-cost benchmark and the architecture breakdown in why native CLI beats MCP for LLM agent tool use.

Built for AI agents -- 35x cheaper than MCP

A GitHub MCP server loads 55,000 tokens into every prompt. Three services eat 72% of your context window on idle. OnlyCLI generates a binary that agents call like any command -- --help costs ~200 tokens. See the full cost breakdown.

# Agent discovers available commands
$ ./gh --help
$ ./gh repos --help

# Agent calls a specific operation
$ ./gh repos get --owner golang --repo go --format json

# Agent reads structured JSON from stdout
{"id":23096959,"name":"go","full_name":"golang/go",...}

Stable names. Predictable flags. Structured output. The agent learns the surface once, not on every turn. For a deeper look, read why native CLI beats MCP and compare that approach with runtime API clients like Restish.

OnlyCLI FAQ

Short answers for search engines, AI tools, and developers evaluating whether OnlyCLI fits their API workflow.

What is OnlyCLI?

OnlyCLI converts an OpenAPI 3.x document into a native Go CLI with subcommands for operations, flags for parameters, generated help text, and structured output for scripts and agents.

How is it different from MCP?

OnlyCLI gives you a local binary that can be versioned, cached, and called directly. That removes the runtime server layer and avoids injecting large MCP tool manifests into every model prompt.

What features come built in?

Generated CLIs can include auth, auto-pagination, streaming, retries, dry-run support, shell completion, JSON/YAML/table/CSV output, and GJSON or template-based result shaping.

Who is it for?

OnlyCLI works well for platform teams, internal APIs, public developer tools, CI automation, and AI agents that need stable commands with predictable flags and machine-readable stdout.

Open source, MIT licensed

License: MIT GitHub stars

Contributions welcome -- bug reports, new features, and docs improvements all help.