MCP vs CLI: I measured what each one actually costs an agent
Everyone quotes a 32x gap. I ran GitHub's own MCP server and the gh CLI on the same tasks to see where the tokens really go.
Every few days someone on my timeline posts that MCP burns thirty times more tokens than a CLI. It usually comes with a screenshot and a strong opinion. I wanted to know if that was true for the tools I actually use, so I ran the test myself.
I kept the setup boring on purpose. GitHub's official MCP server on one side, GitHub's own gh CLI on the other, the same public repositories and the same questions. Then I counted every token a model would have to read.
The short answer: the big multiplier is real for one specific kind of workload, and most of it comes from choices you can change. The details turned out more useful than the headline.
Where the 32x comes from
The number traces back to a benchmark by Scalekit. They ran 75 sessions with Claude Sonnet 4 on five read-only GitHub tasks, comparing a bash tool that composed gh commands against GitHub's hosted MCP server with 43 tools. On the simplest task, the CLI run used a median of 1,365 tokens and the MCP run used 44,026.1
That's a careful piece of work, and its authors are upfront about its limits. The sample is small, all seven MCP failures were connection timeouts to the hosted server, and their conclusion is that they still use MCP for products with many users.1 The other number people quote, "55K tokens before the conversation starts," comes from an Anthropic example with 58 tools across five different servers.2
Both numbers are honest. Neither tells you what a single call costs, or which part of the gap you can actually fix. That's what I tested.
The setup
Both paths end at the same GitHub API. What differs is what the model has to read along the way.
tools/list on the running server with --read-only. The bash tool cost is from Anthropic's docs.7- MCP:
github-mcp-serverv2.1.0, GitHub's official build with its checksum verified, run locally over stdio with--read-onlyand the default toolsets. A small Python client spoke JSON-RPC to it directly, so nothing else touched the payloads. - CLI:
gh2.89.0, with output captured from a pipe. That's how an agent sees it, with no colors and tab-separated columns. - Repos:
cli/cliandastral-sh/uv, two active projects with very different issue styles. From each I picked one open issue with four comments and one merged PR that changed 5 to 15 files. - What I counted: the text a model reads. For MCP that's the tool definitions, the call and the result, including embedded resources. The spec has servers repeat structured results as text, so I counted that once.10 For the CLI it's the command and its output.
- Tokenizer: OpenAI's
o200k_basethrough tiktoken. Claude counts tokens differently, so read the absolute numbers as approximate and the ratios as the result. - Fairness rule: wherever MCP had a parameter to return less, I ran it both ways. Same for gh's
--jsonoutput.
Cost one: the tools you carry around
Before an agent does anything, the client sends every tool definition with the request. Then it sends them again with the next request, and the one after that. This is the part with no real CLI equivalent. A shell tool definition adds 325 tokens on current Claude models,7 and the model already knows gh from training. If it forgets a flag, reading the help page costs a few hundred tokens once.
tools/list on the running server, except *, which is estimated from the tool schemas GitHub publishes for the same release.6,433 tokens is far below the figures that still circulate. Another recent measurement landed in the same ballpark, 26 tools at roughly 4,000 tokens using a characters-divided-by-four estimate.11 GitHub has clearly worked on this. The server now has toolsets, a --tools allowlist and a read-only switch, and read-only alone took my default set from 45 tools to 27.6
The definitions also vary a lot in size. The largest tool in the full set, projects_write, is about 1,570 tokens on its own. That one tool costs more than four bash tool definitions.
Cost two: what each call sends back
Next I ran six everyday tasks both ways. The chart uses a log scale because the results span three orders of magnitude, so equal distances mean equal ratios. The column on the right is the plain answer to "how many times more does MCP cost here" when both sides use their defaults.
--json with full issue bodies, the like-for-like match for MCP's default.The row I didn't expect was the one where nothing happened. When both sides fetch the same data, the protocol stops mattering. The full diff of a PR came back at 8,634 tokens through MCP and 8,617 through gh. Reading README.md was 1,637 against 1,601. Listing 20 issues with their bodies was actually cheaper through MCP, 31,847 tokens against 33,538 for gh's JSON.
So the big gaps in the chart come from somewhere else. I found three places.
Defaults
MCP's list_issues returns every issue body unless you say otherwise. gh issue list returns a compact table. On cli/cli that's a 33.7x gap, and almost all of it is one field.
Pass the fields parameter and MCP drops to 1,252 tokens for the whole call, close to gh's table. GitHub even says so in the tool description, which tells the model that leaving out the body is the biggest saving. Anthropic made the same point about tool design last year. In their Slack example, a concise response mode cut a result from 206 tokens to 72.5 If a tool's default answer is the heavy one, the model pays for it every time it forgets to ask for less.
Missing knobs
Asking which files a PR changed cost 9,391 tokens through MCP on cli/cli, because get_files always includes each file's patch. There's no option to leave it out. gh pr diff --name-only answers the same question in 112.
Code search shows the same pattern. Every MCP hit carries an object_url, a commit SHA and character offsets for each match, which a model rarely needs. gh prints one line per hit, so ten results cost 508 tokens instead of 2,673.
Richer objects
Reading one issue with its comments took 2,816 tokens through MCP and 1,657 through gh. MCP returns reaction counts, author association, avatar URLs and linked PR fields. Some of that is useful, and most of it just comes along for the ride.
< and > as < and >, and that this bloats MCP output.9 It does happen, 304 times in one response. Re-encoding the same response without the escaping saved 2.2% on cli/cli and 1.4% on uv. It's real, but too small to argue about.What I got wrong the first time
My first run made MCP look much better or much worse than it is in three places. Each one was a bug in my test, and each one produced a clean, believable number.
The server returns file contents as an embedded resource, a separate block from the text,10 and my counter only read text blocks.
Piped into a script, gh issue view --comments prints only the comments. The issue body needs a second call, and an agent would make it too.
Names against names plus patches is two different questions. I kept it, because that's what MCP gives an agent, and added a full diff task as the fair match.
If you run a benchmark like this, check your counter against the raw payloads before you trust any ratio.
A whole session
Single calls hide the main effect. Agents make several requests, and each one carries the definitions plus the whole history so far. So I modelled one small triage job: list the open issues, read two of them, read a related PR's diff, then write an answer. That's five requests to the model.
On cli/cli, MCP with default responses read about 6.4 times more tokens than gh over the session. Setting fields on one call brought that down to 2.3x. Most of what's left is the 6,433 tokens of definitions sent five times, about 32,000 tokens, nearly half the MCP total. On uv the same two ratios were 5.3x and 3x.
That's the shape Scalekit measured: small read-only tasks, several turns and a big toolset.1 The fixed cost dominates, so the multiplier looks huge. When the payloads themselves are large, like full diffs, the definitions become a smaller share and the gap shrinks.
Prompt caching changes the bill but not the context window. Cached tool definitions are billed at a tenth of the normal input price or less, and the cache covers the tools block.8 They still take up the same room in context, and that room is what pushes out the things you wanted the model to read.
So when is MCP worth it?
Tokens are one column of the decision. These are the others I'd weigh.
- Auth for many users. A hosted agent acting for many people can use each person's own OAuth grant through MCP, without giving the model a shell or a long-lived token. Scalekit lands in the same place: CLI for one developer on their own machine, MCP for products with many users.1
- Blast radius. A shell can run anything. The MCP server enforces
--read-onlyitself, so a confused agent can't merge or delete even if it tries.6 Getting the same guarantee from a CLI takes a sandbox and an allowlist. - No terminal. Chat apps and many hosted agents have no shell at all. There MCP is the only option on the table.
- Structured results. Tools can declare an output schema, so code can validate what comes back.10
The token cost also has fixes that don't mean dropping the protocol:
- Load fewer tools.
--toolsets,--toolsand--read-onlycut definitions at the source.6 - Ask for less. Use
fieldson list tools and keepperPagesmall. In my test that one parameter took a list from 31,847 tokens to 1,252. - Load tools when needed. Anthropic's tool search tool cut definition tokens by 85% in their tests and raised Opus 4's accuracy on their MCP evals from 49% to 74%.2
- Let the model write code. Anthropic and Cloudflare both describe agents writing code against MCP servers so intermediate results never pass through the model. Anthropic's example went from 150,000 tokens to 2,000.34 It needs a sandbox, which has its own cost.
What I'd pick
| Situation | Pick | Why |
|---|---|---|
| Coding agent on your own machine, using tools the model knows (git, gh, kubectl) | CLI | No fixed cost, and pipes like head or jq trim output |
| Hosted agent acting for many users | MCP | Per-user auth, server-side permissions, no shell needed |
| Agent needs two tools from a big server | MCP with --tools | Pay for two definitions, not fifty |
| Large toolbox, unpredictable tasks | MCP with tool search or code execution | Definitions load only when needed |
| Long sessions with many small calls | Either, but measure | Definitions times requests becomes the biggest line |
Limits of this test
- I counted tokens, not outcomes. No model ran in the loop, so wrong flags, retries and failed calls aren't in these numbers. Scalekit's runs are the better source for that.1
- The tokenizer is
o200k_base, not Claude's. - Two repositories, read-only tasks, one day. Issue bodies change daily, so your numbers will differ.
- I ran the server locally over stdio. GitHub's hosted server has its own toolset and its own latency.
- The session model assumes a 1,500-token system prompt and no caching.
Try it yourself
You don't need an MCP library to measure a server. It speaks JSON-RPC over stdin and stdout, one message per line. This is the core of my client.
import json, subprocess p = subprocess.Popen(["github-mcp-server", "stdio", "--read-only"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) n = 0 def rpc(method, params): global n; n += 1 p.stdin.write(json.dumps({"jsonrpc": "2.0", "id": n, "method": method, "params": params}) + "\n") p.stdin.flush() while True: msg = json.loads(p.stdout.readline()) if msg.get("id") == n: return msg["result"] rpc("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "bench", "version": "0"}}) p.stdin.write('{"jsonrpc":"2.0","method":"notifications/initialized"}\n') tools = rpc("tools/list", {})["tools"] # count these with your tokenizer
From there, call tools/call for each task, run the matching gh command, and count both. Remember the embedded resource blocks.
The headline was wrong in the way most headlines are. The gap is real, but most of it lives in defaults and in how many tools you load, and you control both. If you've measured a different server, I'd like to see your numbers.
References
- R. Madabhushi (Scalekit), "MCP is up to 32× more expensive than CLI. Here's why we still use it." (Mar 2026). scalekit.com/blog/mcp-vs-cli-use
- Anthropic, "Advanced tool use" (Nov 2025). anthropic.com/engineering/advanced-tool-use
- Anthropic, "Code execution with MCP: building more efficient agents" (Nov 2025). anthropic.com/engineering/code-execution-with-mcp
- K. Varda and S. Pai (Cloudflare), "Code Mode: the better way to use MCP" (Sep 2025). blog.cloudflare.com/code-mode
- Anthropic, "Writing effective tools for agents, with agents" (Sep 2025). anthropic.com/engineering/writing-tools-for-agents
- GitHub, github-mcp-server README, v2.1.0. github.com/github/github-mcp-server
- Anthropic docs, "Bash tool". platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool
- Anthropic docs, "Prompt caching". platform.claude.com/docs/en/build-with-claude/prompt-caching
- Go standard library, encoding/json documentation. pkg.go.dev/encoding/json
- Model Context Protocol specification (2025-06-18), "Tools". modelcontextprotocol.io/specification/2025-06-18/server/tools
- Okane Land, "MCP servers: the context-token cost, measured per server" (Aug 2026). okaneland.com/study/the-mcp-context-tax