把任何OpenAPI规范都变成原生CLI二进制。没有MCP,没有臃肿,没有运行时依赖,只有CLI。
概览
GitHub REST API 中的每个端点(1,107 个操作)都变成一个带有标志、帮助文本和 shell 补全的类型化 CLI 命令。 或者从Releases下载预构建的二进制文件。 就这些。规范中的每个操作现在都是一个CLI命令。 来自实时公开规范的预生成CLI: 详细介绍:与Stainless · vs Restish · vs curl/HTTPie 每个提示都会加载一台GitHub MCP服务器。空闲时有三个服务占用。大规模使用时,这纯粹是模式开销。 1. 从 spec 生成一次二进制 2.代理调用 ./cli --help to discovers 命令 () 3.代理运行 ./cli repo get --owner x --repo y 并读取 stdout 稳定的命令名称,可预测的标志,结构化的JSON输出。没有MCP服务器,没有模式注入,没有连接管理。详见完整成本分析。
概述(AI 翻译)
将任何OpenAPI规范都变成完整的CLI。一个命令。一个二进制。令牌数量比MCP少35倍。
GitHub REST API 中的每个端点(1,107 个操作)都变成一个带有标志、帮助文本和 shell 补全的类型化 CLI 命令。
安装
或者从Releases下载预构建的二进制文件。
快速启动
就这些。规范中的每个操作现在都是一个CLI命令。
你得到了什么
每个生成的 CLI 都包含:
| 能力 | 如何 |
|---|---|
| 每个端点作为命令 | 按标签分组,由操作Id命名 |
所有参数都为--flags |
路径、查询、头部和请求正体字段 |
| 7 种输出格式 | --format json|yaml|table|csv|pretty|jsonl|raw |
| 场投影 | --transform "#.name" 通过 GJSON |
| 围棋模板输出 | --template '{{.login}}' |
| 自动分页 | --page-limit N 自动检测链接、光标、偏移、页码 |
| 流式传输 | --stream 用于 SSE 和 NDJSON 响应 |
| 文件输入 | --data @payload.json 或 --data @- 用于标准 |
| OAuth2 认证 | 设备流程(交互式)+ 客户端凭证(CI) |
| 多配置文件配置 | config set staging.token xxx && --profile staging |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 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:
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →