logoalt Hacker News

Making MCP cheaper via CLI

131 pointsby thellimistyesterday at 8:29 PM64 commentsview on HN

Comments

_pdp_yesterday at 9:56 PM

There is some important context missing from the article.

First, MCP tools are sent on every request. If you look at the notion MCP the search tool description is basically a mini tutorial. This is going right into the context window. Given that in most cases MCP tool loading is all or nothing (unless you pre-select the tools by some other means) MCP in general will bloat your context significantly. I think I counted about 20 tools in GitHub Copilot VSCode extension recently. That's a lot!

Second, MCP tools are not compossible. When I call the notion search tool I get a dump of whatever they decide to return which might be a lot. The model has no means to decide how much data to process. You normally get a JSON data dump with many token-unfriendly data-points like identifiers, urls, etc. The CLI-based approach on the other hand is scriptable. Coding assistant will typically pipe the tool in jq or tail to process the data chunk by chunk because this is how they are trained these days.

If you want to use MCP in your agent, you need to bring in the MCP model and all of its baggage which is a lot. You need to handle oauth, handle tool loading and selection, reloading, etc.

The simpler solution is to have a single MCP server handling all of the things at system level and then have a tiny CLI that can call into the tools.

In the case of mcpshim (which I posted in another comment) the CLI communicates with the sever via a very simple unix socket using simple json. In fact, it is so simple that you can create a bash client in 5 lines of code.

This method is practically universal because most AI agents these days know how to use SKILLs. So the goal is to have more CLI tools. But instead of writing CLI for every service you can simply pivot on top of their existing MCP.

This solves the context problem in a very elegant way in my opinion.

philfreoyesterday at 10:10 PM

Is this article from a while back?

> Before your agent can do anything useful, it needs to know what tools are available. MCP’s answer is to dump the entire tool catalog into the conversation as JSON Schema. Every tool, every parameter, every option.

Because this simply isn't true anymore for the best clients, like Claude Code.

Similar to how Skills were designed[1] to be searchable without dumping everything into context, MCP tools can (and does in Claude Code) work the same way.

See https://www.anthropic.com/engineering/advanced-tool-use and https://x.com/trq212/status/2011523109871108570 and https://platform.claude.com/docs/en/agents-and-tools/tool-us...

[1] https://agentskills.io/specification#progressive-disclosure

show 1 reply
footatoday at 1:33 AM

Does tool calling in general bloat context, or is there something particular about MCP?

One thing I have read recently is that when you make a tool call it forces the model to go back to the agent. The effect of this is that the agent then has to make another request with all of the prompt (include past messages), these will be "cached" tokens, but they're still expensive. So if you can amortize the tool calls by having the model either do many at once or chaining them with something like bash you'll be better off.

I suspect this might be why cursor likes writing bash scripts so much, simple shell commands are going to be very token heavy because of the frequency of interrupts.

show 1 reply
pelcgyesterday at 10:04 PM

This looks related to Awesome CLIs/TUIs and terminal trove which has lots both CLI and TUI apps.

Awesome TUIs: https://github.com/rothgar/awesome-tuis

Awesome CLIs: https://github.com/agarrharr/awesome-cli-apps

Terminal Trove: https://terminaltrove.com/

I guess this is another one shows that the CLI and Unix is coming back in 2026.

show 1 reply
aceelricyesterday at 10:51 PM

After reading Cloudflare's Code Mode MCP blog post[1] I built CMCP[2] which lets you aggregate all MCP servers behind two mcp tools, search and execute.

I do understand anthropic's Tool Search helps with mcp bloat, but it's limited only to claude.

CMCP currently supports codex and claude but PRs are welcome to add more clients.

[1]https://blog.cloudflare.com/code-mode-mcp/ [2]https://github.com/assimelha/cmcp

show 1 reply
_pdp_yesterday at 9:37 PM

Hehe... nice one. I think we are all thinking the same thing.

I've also launched https://mcpshim.dev (https://github.com/mcpshim/mcpshim).

The unix way is the best way.

show 2 replies
eggplantinytoday at 12:53 AM

I'm looking at this from a slightly different level of abstraction.

The CLI approach definitely has practical benefits for token reduction. Not stuffing the entire schema into the runtime context is a clear win. But my main interest lies less in "token cost" and more in "how we structure the semantic space."

MCP is fundamentally a tool-level protocol. Existing paradigms like Skills already mitigate context bloat and selection overhead pretty well via tool discovery and progressive disclosure. So framing this purely as "MCP vs CLI" feels more like shifting the execution surface rather than a fundamental architectural shift.

The direction I'm exploring is a bit different. Instead of treating tools as the primary unit, what if we normalize the semantic primitives above them (e.g., "search," "read," "create")? Services would then just provide a projection of those semantics. This lets you compress the semantic space itself, expose it lazily, and only pull in the concrete tool/CLI/MCP adapters right at execution time.

You can arguably approximate this with Skills, but the current mental model is still heavily anchored to "tool descriptions"—it doesn't treat normalized semantics as first-class citizens. So while the CLI approach is an interesting optimization, I'm still on the fence about whether it's a real structural paradigm shift beyond just saving tokens.

Ultimately, shouldn't the core question be less about "how do we expose fewer tools," and more about "how do we layer and compress the semantic space the agent has to navigate?"

show 2 replies
red_hareyesterday at 9:16 PM

True for coding agents running SotA models where you're the human-in-the-loop approving, less true for your deployed agents running on cheap models that you don't see what's being executed.

But yeah, a concrete example is playwright-mcp vs playwright-cli: https://testcollab.com/blog/playwright-cli

show 2 replies
winwangtoday at 1:37 AM

Awesome stuff. I have a 'root' cli that i namespace stuff into so to remove the need to pass around paths, e.g: `./cli <cmd> ...`

2001zhaozhaoyesterday at 11:59 PM

I feel like the permanent fix is for the AI labs to figure out better attention methods that increase context length without extra inference cost, plus deeper discounts (like -99%) for people being able to add system prompts to their accounts that are cached permanently.

This way you build all your MCPs into the system prompt, save the prompt to the AI provider, then use it without overpaying API costs.

The current "tools-on-demand" workarounds should be great for infrequent tools but the future will probably bring agents with dozens of tools that need them in context to flexibly many of them in the same context window. So we just need to make the context windows longer and make this capability cheaper to use.

peterldownstoday at 1:30 AM

I was just looking for a linear CLI earlier today. Awesome that the CLI converter uses that as an example. Nice!

cmdtabyesterday at 10:03 PM

Not just cheaper in terms of token usage but accuracy as well.

Even the smallest models are RL trained to use shell commands perfectly. Gemini 3 flash performs better with a cli with 20 commands vs 20+ tools in my testing.

cli also works well in terms of maintaining KV cache (changing tools mid say to improve model performance suffers from kv cache vs cli —help command only showing manual for specific command in append only fashion)

Writing your tools as unix like cli also has a nice benefit of model being able to pipe multiple commands together. In the case of browser, i wrote mini-browser which frontier models use much better than explicit tools to control browser because they can compose a giant command sequence to one shot task.

https://github.com/runablehq/mini-browser

bdavbdavyesterday at 8:55 PM

I’m not sure how this works. A lot of that tool description is important to the Agent understanding what it can and can’t do with the specific MCP provider. You’d have to make up for that with a much longer overarching description. Especially for internal only tools that the LLM has no intrinsic context for.

show 1 reply
arjieyesterday at 10:37 PM

These days you can rewrite everything yourself for very cheap. So this is `mcporter` rewritten. I prefer to use Rust personally for rewrites. Opus 4.6 can churn it out pretty quickly if that's what you want. To be honest, almost all software that I want to try these days I don't even install. Instead I'd rather read the README and produce a personal version. This allows encoding idiosyncrasies and specifics that another author will not accept.

orliesaurusyesterday at 10:11 PM

I like this approach ... BUT the big win for me is audit logs. CLIs naturally leave a trail you can replay.

ALSO... the permission boundary is clearer. You can whitelist commands, flags, working dir... it becomes manageable.

HOWEVER... packaging still matters. A “small” CLI that pulls in a giant runtime kills the benefit.

I want the discipline of small protocol plus big cache. Cheap models can summarize what they did and avoid full context in every step...

mijoharasyesterday at 9:15 PM

This sounds similar to MCPorter[0], can anyone point out the differences?

[0] https://github.com/steipete/mcporter

show 1 reply
cheriotyesterday at 11:38 PM

Is there any redeeming quality of MCP vs a skill with CLI tool? Right now it looks like the latter is a clear winner.

Maybe MCP can help segregate auto-approve vs ask more cleanly, but I don't actually see that being done.

show 1 reply
andybakyesterday at 9:21 PM

Why are they using JSON in the context? I thought we'd figured out that the extra syntax was a waste of tokens?

speedgooseyesterday at 9:09 PM

MCP has some schemas though. CLI is a bit of a mess.

But MCP today isn’t ideal. I think we need to have some catalogs where the agents can fetch more information about MCP services instead of filling the context with not relevant noise.

show 2 replies
OsrsNeedsf2Pyesterday at 11:37 PM

So much incorrect and misinformation in these comments. As someone who is building an agent[0] with MCP tools, neither the MCP tool description nor the response is the problem. Both of those are easily solved by not bloating them.

The real killer is the input tokens on each step. If you have 100k tokens in the conversation, and the LLM calls an MCP tool, the output and the existing conversation is sent back. So now you've input 200k tokens to the LLM.

Now imagine 10 tool calls per user message - or 50. You're sending 1-5M input tokens, not because the MCP definitions or tool responses are large, but because at each step, you have to send the whole conversation again.

"what about caching" - Only 90% savings, also cache misses are surprisingly common (we see as low as 40% cache hit rate)

"MCP definitions are still large" - not compared to any normal conversation. Also these get cached

We've seen the biggest savings by batching/parallelizing tool calls. I suspect the future of LLM tool usage will have a different architecture, but CLI doesn't solve the problems either.

[0] https://ziva.sh, it's an agent specialized for Godot[1]

[1] https://godotengine.org

show 2 replies
dmixtoday at 12:22 AM

So it's more of a RAG via CLI than MCP.

slopinthebagyesterday at 9:58 PM

I've seen folks say that the future of using computers will be with an LLM that generates code on the fly to accomplish tasks. I think this is a bit ridiculous, but I do think that operating computers through natural language instructions is superior for a lot of cases and that seems to be where we are headed.

I can see a future where software is built with a CLI interface underneath the (optional) GUI, letting an LLM hook directly into the underlying "business" logic to drive the application. Since LLM's are basically text machines, we just need somebody to invent a text-driven interface for them to use...oh wait!

Imagine booking a flight - the LLM connects to whatever booking software, pulls a list of commands, issues commands to the software, and then displays the output to the user in some fashion. It's basically just one big language translation task, something an LLM is best at, but you still have the guardrails of the CLI tool itself instead of having the LLM generate arbitrary code.

Another benefit is that the CLI output is introspectable. You can trace everything the LLM is doing if you want, as well as validate its commands if necessary (I want to check before it uses my credit card). You don't get this if it's generating a python script to hit some API.

Even before LLM's developers have been writing GUI applications as basically a CLI + GUI for testability, separation of concerns etc. Hopefully that will become more common.

Also this article was obviously AI generated. I'm not going to share my feelings about that.

show 1 reply
hiccuphippoyesterday at 9:23 PM

Can LLMs compress those documents into smaller files that still retain the full context?

show 1 reply
jbellisyesterday at 9:53 PM

You just reinvented Skills

show 2 replies
vascoyesterday at 9:35 PM

A lot of providers already have native CLI tools with usually better auth support and longer sessions than MCP as well as more data in their training set on how to use those cli tools for many things. So why convert mcp->cli tool instead of using the existing cli tools in the first place? Using the atlassian MCP is dog shit for example, but using acli is great. Same for github, aws, etc.

crooked-vyesterday at 8:52 PM

Cheaper, but is it more effective?

I know I saw something about the Next.js devs experimenting with just dumping an entire index of doc files into AGENTS.md and it being used significantly more by Claude than any skills/tool call stuff.

show 1 reply
kissgyorgyyesterday at 11:28 PM

A very good example of this is playwright-cli vs Playwright MCP: https://github.com/microsoft/playwright-cli

The biggest difference is state, but that's also kind of easy from CLI, the tool just have to store it on disk, not in process memory.

econyesterday at 9:23 PM

I had deepseek explain MCP to me. Then I asked what was the point of persistent connections and it said it was pretty much hipster bullshit and that some url to post to is really enough for an llm to interact with things.

show 1 reply
MarcLoretoday at 2:00 AM

[dead]

aplomb1026today at 12:31 AM

[dead]

wangzhongwangtoday at 12:07 AM

[dead]

wangzhongwangyesterday at 10:35 PM

[dead]

dangyesterday at 9:20 PM

The article's link to clihub.sh is broken. Looks like https://clihub.org/ is the correct link? I've added that to the toptext as well.

Edit: took out because I think that was something different.

show 1 reply