OpenAPI to CLI (ocli)

Turns any OpenAPI or Swagger API into CLI commands at runtime, with BM25 endpoint search and no codegen

  • 267 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • Makes real HTTP requests to APIs, including POST, PUT and DELETE
  • Stores tokens and credentials in profiles
All reasons and checks

evilfreelancer/openapi-to-cli

Install

Works in

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/openapi-to-cli-ocli

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Makes real HTTP requests to APIs, including POST, PUT and DELETE
  • Stores tokens and credentials in profiles

This is third-party code. Review the repository files before installing.

What it does

ocli reads an OpenAPI or Swagger spec and turns endpoints into CLI commands at runtime. An agent finds the right command with a natural-language or regex query, checks parameters with --help and calls the API. Profiles store the base URL, Bearer or Basic auth and custom headers, and the spec is cached locally. The author positions it as a lightweight MCP alternative: the README benchmark shows about 158 tokens of overhead per turn.

Who it is for. Developers who want to give an agent REST API access without writing an MCP server.

Good fit when

  • An internal or cloud API has an OpenAPI spec but no MCP server
  • The API is large, with hundreds of endpoints, and MCP tool definitions eat context
  • You need to call the API from shell scripts and command chains
  • You work with several APIs through different profiles

Not a fit when

  • You need OAuth2: ocli does not support it
  • You need centralized auth or shared state: MCP is a better fit
  • The API is GraphQL rather than OpenAPI

Example request

Connect our API from https://api.example.com/openapi.json via ocli and find the command for creating an order

Limitations

No OAuth2, no jq response filtering, no structured JSON output, no MCP or GraphQL support. Unknown flags are rejected, except for request bodies the spec does not describe.

How to disable. Remove the package with npm uninstall -g openapi-to-cli, the .ocli profile folder and the skill file from .claude/skills.

FAQ

How do I connect ocli to Claude Code?

Copy the example skill with cp examples/skill-ocli-api.md .claude/skills/api.md.

Is the spec downloaded on every call?

No, it is cached in .ocli/specs/<profile>.json. Re-run ocli profiles add with the same profile name to refresh it.

Discussion

No questions or reviews yet.

CLI tools

A CLI that turns any MCP server, OpenAPI spec or GraphQL endpoint into commands at runtime, with no codegen

CLIBroad access2.4KRepository stars

Ten design principles for CLIs that agents use, and a skill that guides an agent building or reviewing such tools

SkillMinimal access2.3KRepository stars

Orchestrator plugin for OpenCode and Codex CLI: multiple agents, hooks, built-in MCPs, ultrawork mode and hash-anchored edits

PluginBroad access70.5KRepository stars

A skill registry with a CLI and API: the agent describes a task and gets a recommendation with a trust score and install command

CLIExtended access366Repository stars

OpenRig

openrig

A CLI for persistent teams of Claude Code and Codex agents: the team is described in YAML and started with one command, with roles and monitoring

CLIBroad access8.3KRepository stars

An Open WebUI proxy that exposes any MCP server as an HTTP API with an OpenAPI schema

CLIBroad access4.4KRepository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialRepository starsMain difference
OpenAPI to CLI (ocli) (this entry)no267
CLI Printing Pressno4,870a generator of Go CLIs and MCP servers for any API
Kubbyes1,831claude Code plugin for Kubb
Orval skill for agentsyes6,566the official Orval skill

README in short

openapi-to-cli is a TypeScript CLI that turns an API from an OpenAPI or Swagger spec into commands without code generation. The README explains where a CLI fits better than MCP or skills and includes a token usage benchmark. It covers profiles, auth, strict flag validation, external $ref support and complex parameter serialization. Ready-made skills for OpenClaw and Claude Code and a comparison with similar tools are included.

README badge

Original SKILL.md

---
name: ocli-api
description: Turn any OpenAPI/Swagger API into CLI commands and call them. Search endpoints with BM25, check parameters, execute — no MCP server needed.
version: 1.0.0
user-invocable: true
disable-model-invocation: false
metadata: {"openclaw":{"emoji":"🔌","requires":{"bins":["ocli"],"env":[]}}}
homepage: https://github.com/EvilFreelancer/openapi-to-cli
---

# ocli — OpenAPI to CLI

Call any HTTP API described by an OpenAPI/Swagger spec as CLI commands.
No MCP server, no code generation, no JSON schemas in context.

## When to use

- You need to call a REST API (internal, cloud, SaaS)
- You have an OpenAPI or Swagger spec (URL or local file)
- You want minimal token overhead (1 tool, ~158 tokens/turn)

## Setup (one-time)

```bash
npm install -g openapi-to-cli

ocli profiles add <name> \
  --api-base-url <BASE_URL> \
  --openapi-spec <SPEC_URL_OR_PATH> \
  --api-bearer-token "$TOKEN"

ocli use <name>
```

## Workflow

1. **Search** for the right command:
   ```bash
   ocli commands --query "your task description" --limit 5
   ```
2. **Check parameters** of the chosen command:
   ```bash
   ocli <command> --help
   ```
3. **Execute** the command:
   ```bash
   ocli <command> --param1 value1 --param2 value2
   ```
4. **Parse** the JSON response and act on the result.

Report a problem

Foxx AIOpenAPI to CLI (ocli)
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.