Give Your Agent a CLI (Not Just MCP or an API)
A CLI is Google Maps for agents — why thin API wrappers fail, what “good” looks like, and what to do when you already invested in MCP and REST
← AI Agents · OpenClaw MCP · Stripe Link CLI · Bunny list script · Agentic setup · Knowledge base · Loops
Source & credit
Distilled from Tom Crawshaw (@tomcrawshaw01) covering nine rules from Matt Van Horn (@mvanhorn) — x.com/i/status/2082450077709381777 / X Article (“He hit number one on GitHub Trending without ever learning to read code…”).
Rule six (the clip you pulled): give your agent a CLI, not an MCP server or an API. Related posts on this site treat MCP and APIs as real tools in the stack — this page is the analysis of when a CLI should sit in front of them.
The baseball-score problem
Ask an agent for a baseball score with no purpose-built tool and you watch it thrash: Google → team site → ESPN → hunt for the right button — burning tokens the whole way. Browsing the open web is a last resort, not a product surface.
Matt’s line (as Tom frames it):
A CLI is Google Maps for agents.
Maps doesn’t make you invent roads. A good CLI doesn’t make the agent invent navigation through your product’s HTML, docs, or 40 REST endpoints. It exposes jobs the agent actually runs: one command, clear flags, predictable stdout, exit codes that mean something.
What “CLI Printing Press” is pointing at
Matt built CLI Printing Press with Trevin to produce agent-oriented CLIs at scale. Example path: ESPN has no official API → an agent sniffed the site, found undocumented endpoints, mapped patterns → shipped a CLI agents can call. They launched around ~50 CLIs; the catalog grew past 350.
Important caveat in the same rule:
Having a CLI does not mean having a good one. Most companies wrap their API endpoints and call it finished, and that is not the same as designing for an agent.
So the debate is not “binary file on disk vs HTTP.” It’s whether the interface is agent-native: task-shaped, documented for models, sticky memory, low token waste.
CLI vs API vs MCP (honest comparison)
| Raw API | MCP server | Agent CLI | |
|---|---|---|---|
| Shape | Many endpoints, auth schemes, pagination | Tools/resources exposed into the model’s tool list | Commands + flags + stdin/stdout |
| How agents use it | Often invents wrong payloads; needs SDK knowledge | Structured tools — great when tools are few and clear | Shell they already know: cmd sub --json |
| Token cost | High if they read OpenAPI + trial-and-error | Tool schemas can bloat context if you dump 80 tools | Help text + one command = compact if designed well |
| Composability | Custom glue every time | Great inside one client that speaks MCP | Pipes, scripts, CI, any agent with a terminal |
| Portability | Language/SDK-specific | MCP-aware hosts only (Claude Code, Cursor, OpenClaw, …) | Anywhere a process can run |
| Failure mode | Silent wrong calls, half-paginated data | Too many tools; agents pick the wrong one | Thin “API mirror” CLI that still confuses agents |
| Best role | System of record / backend | Wire tools into an IDE/agent host | Default agent-facing product surface |
Practical take for our team: don’t throw away APIs or MCP. Treat them as layers:
Agent → CLI (task verbs) → optional MCP (expose CLI/tools to host) → API / DB / CDN Matt’s rule is aimed at teams that stop at “we have an API” or “we shipped an MCP” and never build the map layer agents actually drive.
What a good agent CLI requires
1. Task verbs, not endpoint names
Prefer scores today --team LAD over
GET /v3/sports/baseball/events?….
Name commands after outcomes humans and agents say out loud.
2. Stable machine output
--json (or always-JSON mode), stable field names, exit code 0/1,
errors on stderr, success payload on stdout. Agents parse; humans can still read.
3. Discoverability
--help, subcommand help, examples in help text.
Models read help better than scattered Notion docs.
4. Auth that scripts can hold
Env vars / keychain / config file — not “click OAuth in a browser every session” unless you also ship a non-interactive path for agents.
5. Notes the tool keeps (Rule seven)
When ESPN CLI discovered World Cup endpoints the hard way, it wrote itself a note. Second run is fast because the tool remembered. Most MCP/API sessions throw that away. Persist discoveries in a local cache or skill file.
6. Blast-radius flags
Read-only by default; --dry-run; destructive actions require explicit flags.
Same spirit as gates in knowledge base / multiplayer agents.
7. Small surface
Ten excellent commands beat eighty thin wrappers. If help text doesn’t fit in one screen, agents thrash the same way they thrash bad MCP tool lists.
8. Install path agents can do
One-liner install, version pin, works in CI and on Mac Mini agent hosts (OpenClaw-style — not only a desktop GUI.
If you already have an API
- Keep the API as the source of truth (billing, data, CDN, CRM).
- Don’t hand the OpenAPI dump to the agent as the product. List the 5–15 jobs agents actually run (list files, create draft, score lead, post standup).
- Wrap those jobs in a CLI with task names,
--json, env auth. - Document with examples in
--helpand a shortSKILL.md/ AGENTS note: “for X always run Y.” - Add self-notes where discovery is expensive (endpoint maps, id caches).
Example already on this site: Bunny Storage is an API; agents shouldn’t invent curl every time.
We shipped list-bunny-storage.cjs —
env auth, flags, markdown out. That’s a small agent CLI over an API.
If you already have MCP
MCP is not “wrong.” It’s a host protocol (Claude Code, Cursor, Codex, OpenClaw MCP). The failure mode is exposing raw CRUD as 50 tools with vague descriptions.
- Inventory tools. Delete or hide anything the agent never uses cleanly.
- Prefer “CLI behind MCP” when possible: MCP tool = “run this command with args” or a thin adapter that calls the same code path as the CLI. One brain, two doors.
- Task-shaped tools. One tool “get_baseball_score(team)” beats “http_request(url, method, body)”.
- Keep schemas short. Long parameter trees recreate the OpenAPI problem inside MCP.
- Use MCP where the host needs it (IDE sidebar, multiplayer room tools); use CLI where the agent has a shell and you want pipes, cron, and portability.
Our RankingSolution / DataForSEO path via MCP is still valid as a
brain connection — but if agents keep misfiring, the fix is often a
seo gaps --domain x --json CLI (or fewer sharper MCP tools), not more endpoints.
Migration playbook (API + MCP → agent CLI)
Week 1 — Observe
Log which API routes / MCP tools agents actually call (and fail).
Rank by frequency × pain.
Week 2 — Carve 3–5 verbs
e.g. list, get, create-draft, publish-dry-run, status
Implement as CLI only; tests: --help, --json, exit codes.
Week 3 — Point agents at CLI
AGENTS.md / skills: “use `gfa files list` not raw Bunny API”
Optional: MCP tool that shells to the same binary.
Week 4 — Memory
Cache expensive discovery (IDs, path maps, “where World Cup lives”).
Rulings: wrong flags → one line in playbooks (knowledge base).
Ongoing
New endpoint? Only ship CLI surface if a verb needs it.
Review tool/CLI count monthly; delete dead weight. Examples in our world
| Surface | Layer | Agent-friendly angle |
|---|---|---|
| Bunny list script | CLI over Storage API | Env key + path + pull zone → markdown links; no browser UI |
| Stripe Link CLI | CLI + human gate | Agent can shop with single-use creds; human approves |
| OpenClaw MCP | MCP host bridge | Great for messaging tools — still better if each tool is a clear verb |
| Headless Empire OS | Markdown + scripts | Agents already live in terminal + files; CLI fits the OS |
| GFAVIP / internal APIs | API today | Candidate: gfavip member get --id, deal list --json |
Related rules (same interview, short)
- Rule 7: let the tool leave notes for itself (cache discoveries).
- Rule 8: ask a research agent which tool to use before committing (official CLI vs agent-first community CLI).
- Rule 4 / loops: goals are loops — a CLI should support unattended goal runs, not only interactive demos. See Loops.
Full nine-rule arc is in Tom’s article; this page deep-dives rule six for teams living on APIs and MCP.
Bottom line for Mike’s stack
- Yes, prioritize agent CLIs for high-frequency jobs (files, SEO, deploy, content package, member lookup).
- Keep APIs as the backend; stop treating OpenAPI as the agent UX.
- Keep MCP where hosts need it — but make tools task-shaped or wrap the CLI.
- Thin API→CLI wrappers are not enough; design verbs, JSON, help, memory, and gates.
- Ship one CLI this week for the noisiest agent failure you already see in logs.
Related on this site
Hermes / multiplayer
Profiles and shared rooms still need good tools underneath.
Hermes → Multiplayer →Grok Build vs Cursor
Terminal-first agents vs IDE review — hybrid without abandoning the CLI harness.
Read →References
- Tom Crawshaw — nine rules from Matt Van Horn · X Article
- Matt Van Horn — @mvanhorn · Last 30 Days / CLI Printing Press (as discussed in the interview)
- Clip / discussion entry — x.com/i/status/2082598237807288344
Comments
Approved comments appear below. Log in once with GFAVIP — it applies across the whole site. GFAVIP login
View comments archive