MCP or CLI?
Originally written for the Codefac blog. Check out Codefac.
Why even an MCP or CLI?
When building a product that is not centered around an AI agent — but instead augments an agent to help your user with something — a question arises: why not meet users in the interface they already use? Claude Code, Codex, ChatGPT, Claude.ai.
This not only increases the chance of a smoother onboarding experience for end users, but you can also save on inference cost of the same LLMs.
Now, what should you choose between MCP and CLI? I think: MCP when you don’t need shell access.
Server-side control
With an MCP server we can add new tools on the fly, and this new functionality becomes instantly available to the user. In the case of a CLI, the user has to update the CLI version.
This might also cause drift, where some users are on a previous version of the CLI while others are on the latest — and your agent instructions have to handle all of them.
See also: Context management and MCP.
Non-coding agent users
When considering a CLI, the first thing that comes to mind for a dev is that it’s as easy to set up as an MCP. But a user using interfaces such as ChatGPT or Claude.ai does not have the option to install a CLI. They can use a Streamable HTTP MCP server, which has been standardised everywhere.
See also: MCP or CLI: how to choose the right interface for your AI tools.
Cost: closer than it feels
The common argument for a CLI is that it doesn’t load tool schemas into the agent’s context at session start, unlike MCP. But prompt caching is prefix-based: MCP tool schemas sit at the top of the prompt, get cached after the first turn, and cost near-zero afterwards (cached input is ~10% the price of fresh input). The same applies to CLI outputs — anything appended mid-session becomes part of the cacheable prefix for the next turn. Neither approach “misses out” on caching.
The real cost differences are smaller and structural:
- Floor size: MCP puts every tool’s full schema in context all session; a CLI + skill loads only a short skill description, with the SKILL.md body read on demand (~one-time, also cacheable). With 50+ tools this gap is real, otherwise marginal.
- Output volume: MCP tools tend to return chatty payloads on every call; a CLI can return terse output and compose with pipes and grep. This is the bigger lever — and it’s a design choice either way.
A well-designed MCP (few composable tools, strict schemas, pagination, returning IDs over payloads) closes most of this gap. If you’re going to invest that design effort anyway, cost shouldn’t be the deciding factor — decide on the points above instead.
See also: Prompt caching.