openclaw - 💡(How to fix) Fix Skill: ocli-api — call any REST API via CLI, no MCP server needed [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#48999Fetched 2026-04-08 00:49:56
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
1
Participants
Timeline (top)
commented ×1

Fix Action

Solution

openapi-to-cli (ocli) turns any OpenAPI/Swagger spec into CLI commands at runtime. The agent needs only 1 tool (execute_command) and discovers endpoints via BM25 search:

Agent: ocli commands --query "create pull request" --limit 3
→  repos_owner_repo_pulls_post   post    /repos/{owner}/{repo}/pulls  Create a pull request

Agent: ocli repos_owner_repo_pulls_post --help
→  Options: --owner (required) --repo (required) --title --head --base --body

Agent: ocli repos_owner_repo_pulls_post --owner octocat --repo hello --title "Fix bug" --head feature --base main
→  { "number": 42, "html_url": "..." }

Benchmark results (honest, all strategies use same BM25 engine):

StrategyOverhead/turnTurnsSearch resultServer?
MCP Naive (19 ep)2,945 tok1N/AYes
MCP+Search Full355 tok21,305 tok/queryYes
MCP+Search Compact437 tok361 tok/queryYes
CLI (ocli)158 tok367 tok/queryNo

At 845 endpoints, MCP Naive costs $1,172/month vs CLI at $11/month (100 tasks/day, Sonnet $3/M).

Code Example

Agent: ocli commands --query "create pull request" --limit 3
→  repos_owner_repo_pulls_post   post    /repos/{owner}/{repo}/pulls  Create a pull request

Agent: ocli repos_owner_repo_pulls_post --help
Options: --owner (required) --repo (required) --title --head --base --body

Agent: ocli repos_owner_repo_pulls_post --owner octocat --repo hello --title "Fix bug" --head feature --base main
{ "number": 42, "html_url": "..." }

---

---
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
metadata: {"openclaw":{"emoji":"🔌","requires":{"bins":["ocli"]}}}
homepage: https://github.com/EvilFreelancer/openapi-to-cli
---

---

# From ClawHub (once published)
clawhub install ocli-api

# Prerequisite
npm install -g openapi-to-cli

# Onboard your first API
ocli profiles add myapi \
  --api-base-url https://api.example.com \
  --openapi-spec https://api.example.com/openapi.json \
  --api-bearer-token "$TOKEN"
RAW_BUFFERClick to expand / collapse

Problem

Connecting AI agents to REST APIs today means either:

  1. MCP Naive — register every endpoint as a tool. At 100+ endpoints, that's 15K+ tokens of JSON schemas injected every turn. At GitHub API scale (845 endpoints) it's 130K tokens/turn.
  2. MCP+Search — better, but still requires a running MCP server, transport layer, and search results carry full JSON schemas back to context.

REDDIT: https://www.reddit.com/r/LocalLLaMA/comments/1rsnp63/turn_10000_api_endpoints_into_one_cli_tool/

Both approaches require a persistent server process and MCP-aware client. This is the "MCP madness" — every new API means another server to run, another transport to manage, another set of tool schemas eating your context window.

Solution

openapi-to-cli (ocli) turns any OpenAPI/Swagger spec into CLI commands at runtime. The agent needs only 1 tool (execute_command) and discovers endpoints via BM25 search:

Agent: ocli commands --query "create pull request" --limit 3
→  repos_owner_repo_pulls_post   post    /repos/{owner}/{repo}/pulls  Create a pull request

Agent: ocli repos_owner_repo_pulls_post --help
→  Options: --owner (required) --repo (required) --title --head --base --body

Agent: ocli repos_owner_repo_pulls_post --owner octocat --repo hello --title "Fix bug" --head feature --base main
→  { "number": 42, "html_url": "..." }

Benchmark results (honest, all strategies use same BM25 engine):

StrategyOverhead/turnTurnsSearch resultServer?
MCP Naive (19 ep)2,945 tok1N/AYes
MCP+Search Full355 tok21,305 tok/queryYes
MCP+Search Compact437 tok361 tok/queryYes
CLI (ocli)158 tok367 tok/queryNo

At 845 endpoints, MCP Naive costs $1,172/month vs CLI at $11/month (100 tasks/day, Sonnet $3/M).

Proposed skill

---
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
metadata: {"openclaw":{"emoji":"🔌","requires":{"bins":["ocli"]}}}
homepage: https://github.com/EvilFreelancer/openapi-to-cli
---

Full SKILL.md: github.com/EvilFreelancer/openapi-to-cli/tree/feat/openclaw-skill-and-comparison/skills/ocli-api

What the skill teaches the agent

  1. Searchocli commands --query "..." --limit 5 (BM25 ranked)
  2. Inspectocli <command> --help (text parameters, not JSON schemas)
  3. Executeocli <command> --flag value (plain HTTP, JSON response)

Installation

# From ClawHub (once published)
clawhub install ocli-api

# Prerequisite
npm install -g openapi-to-cli

# Onboard your first API
ocli profiles add myapi \
  --api-base-url https://api.example.com \
  --openapi-spec https://api.example.com/openapi.json \
  --api-bearer-token "$TOKEN"

Or manually — copy SKILL.md to ~/.openclaw/skills/ocli-api/SKILL.md.

Why this belongs in openclaw skills

  • Zero infrastructurenpm install -g openapi-to-cli, no server process
  • Universal — works with any OpenAPI/Swagger spec (Bitrix24, GitHub, Box, Petstore, internal APIs)
  • Token-efficient — 158 tok overhead vs 2,945+ for MCP approaches
  • Composable — pipes, chains, shell scripts natively
  • Multiple APIs — profiles with per-API auth, endpoint filtering, command prefixes
  • Replaces MCP for REST APIs — agent doesn't need MCP-aware client, just shell access

extent analysis

Fix Plan

To address the "MCP madness" and efficiently connect AI agents to REST APIs, we will utilize the openapi-to-cli tool. Here are the steps:

  • Install openapi-to-cli globally using npm:
npm install -g openapi-to-cli
  • Onboard your first API by adding a profile:
ocli profiles add myapi \
  --api-base-url https://api.example.com \
  --openapi-spec https://api.example.com/openapi.json \
  --api-bearer-token "$TOKEN"
  • Use the ocli command to search for endpoints:
ocli commands --query "create pull request" --limit 3
  • Inspect the command parameters:
ocli repos_owner_repo_pulls_post --help
  • Execute the command with the required parameters:
ocli repos_owner_repo_pulls_post --owner octocat --repo hello --title "Fix bug" --head feature --base main

Verification

To verify that the fix worked, you can check the following:

  • The ocli command returns the expected results for searching, inspecting, and executing API endpoints.
  • The API requests are successfully sent and responded to without requiring an MCP server or client.
  • The token overhead is significantly reduced compared to MCP approaches.

Extra Tips

  • Make sure to replace the https://api.example.com and https://api.example.com/openapi.json URLs with your actual API base URL and OpenAPI specification URL.
  • You can add multiple API profiles using the ocli profiles add command.
  • The ocli command can be used in shell scripts and pipes for more complex workflows.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Skill: ocli-api — call any REST API via CLI, no MCP server needed [1 comments, 2 participants]