beckon
Beckon blog

MCP vs CLI for Coding Agents: Context Cost, Security and When to Use Each

ยท Beau Johnson

In shortIf a tool has a good CLI (git, gh, npm, docker), start there: your agent already has a shell and only reads help text when it needs it. Use MCP when there's no CLI, the service is remote and needs a proper sign-in, the agent has no shell, or you want to set permissions by tool name.

There are two ways to give a coding agent hands: wrap the app as an MCP server, or let the agent run a command line tool it already knows. In this video I explain how a tool call actually works, what MCP is under the hood, why agents are so good with a shell, what each route costs you in context (we measured it ourselves), and how you fence each one. It's for developers who use agents like Claude Code, Codex or Cursor and are trying to decide which tools to plug in.

What I cover in this video

  • 0:00 GitHub's MCP server hands your agent 46 tools, about 11,000 tokens before you type a word
  • 0:45 What a tool call actually is, in four steps
  • 2:16 MCP under the hood: hosts, clients, servers, tools/list and tools/call
  • 3:46 The CLI route and why agents are so good with a shell
  • 5:17 The context cost, measured
  • 6:49 Security: what each one can touch and how you fence it
  • 8:20 My table for when each one wins
  • 9:06 How I run it in Beckon

What a tool call actually is

Your model can't click anything or run anything. All it can do is write text. A tool call is just the model writing a structured request instead of an answer:

  1. The app you're using sends the model a list of tools. Each one has a name, a description and a schema for its inputs.
  2. The model decides it needs one and writes the request: tool name plus arguments.
  3. The app, not the model, actually runs it.
  4. The result comes back to the model as text, and it keeps going.

That app in the middle is called the host. Claude Code, Codex and Cursor are all hosts. The part most people miss: every tool in that list costs tokens, because the names, descriptions and schemas are all text the model reads. So the MCP vs CLI argument is really about how a tool gets into that list and what it costs to keep it there.

MCP under the hood

The Model Context Protocol came out of Anthropic in November 2024, and in December 2025 it was donated to the Agentic AI Foundation under the Linux Foundation, so it's not one company's thing anymore.

There are three parts. The host is your app. Inside it there's one client per server it talks to. The server is a program that wraps something like GitHub, a browser or a database. They all talk JSON-RPC. A server can offer:

  • Tools: functions the model can call
  • Resources: data the app can pull in, each with its own URI
  • Prompts: templates a user picks, kind of like a slash command

The host finds tools by sending tools/list, and the server answers with name, description and input schema for each. When the model picks one, the host sends tools/call. Messages travel over standard IO (the host starts the server as a local process) or Streamable HTTP (the server usually lives elsewhere and every message is a web request).

One thing to watch: the July 28, 2026 spec (changelog) dropped the old handshake and made MCP stateless. Every request carries its own version and capabilities, which matters a lot if you host a server for many people. A lot of servers haven't caught up, though. All three we tested still used the old handshake.

The CLI route and the context cost

Your coding agent already has a shell tool (in Claude Code it's literally called Bash), so it can run anything with a command line: git, gh, npm, docker. Models have seen tons of shell commands, man pages and READMEs, and when the agent needs a flag it doesn't know, it runs --help and reads it. Anthropic's Claude Code docs say if a system has a CLI, that's usually the easiest way in. With gh signed in, Claude will open pull requests without any explanation from you.

The shell also gives you pipes. The agent can grab a list of pull requests, filter it with jq and save it to a file in one line, and none of that middle data has to come back through the model. Even Microsoft ships both Playwright MCP and Playwright CLI, and their README says coding agents are leaning toward the CLI because it skips loading big tool schemas into context.

Here's what we measured (same machine, no keys, OpenAI's open source o200k tokenizer, October 31, 2026; other tokenizers give different totals):

  • GitHub MCP server v2.0.3, default toolsets: 46 tools, 11,131 tokens
  • GitHub MCP server, every toolset on: 91 tools, 23,156 tokens
  • Playwright MCP: 25 tools, 3,917 tokens
  • The three gh help pages for opening a pull request: 2,012 tokens

So the CLI route is more than five times smaller, and the agent only reads those pages when it needs them. In a host that loads tools up front, the whole tool list sits in context every turn. Anthropic wrote about a setup with five servers and 58 tools taking about 55,000 tokens before the conversation starts, and they've seen tool definitions eat 134,000 tokens before they fixed it.

To be fair, hosts are fixing this. Claude Code's tool search is on by default and loads only tool names first, pulling in full definitions when needed. Anthropic reports an 85% token cut with its Tool Search Tool. And the CLI isn't free either: Playwright CLI's skill file has a tiny always-loaded part (about 50 tokens), but reading the whole thing is almost 4,000 tokens, about the same as the MCP list. With the CLI you still pay, you just pay when you need it.

Security: what each one can touch

The MCP spec says it straight: tools are arbitrary code execution, the host should ask before running one, and tool descriptions should be treated as untrusted unless you trust the server. But MCP gives you clean fences because every tool has a name. In Claude Code you can auto approve just GitHub's get tools while everything else still needs a check. GitHub's server also has a read-only mode, and you can turn on only the toolsets you need, which means fewer tools and fewer tokens.

The CLI runs as you. If gh is logged in, the agent can do anything your login can. Claude Code's docs say rules that try to limit command arguments are fragile, because there are too many ways to write the same command. So you fence a shell with a sandbox, and Anthropic's take is you need both walls: a filesystem wall so it can only change files in your project, and a network wall so it can only reach servers you approve. Without the network wall, a hijacked agent could send your SSH keys anywhere. In their own use, sandboxing cut permission prompts by 84%. If you want more on this, see 5 Trending GitHub Repos to Make Coding Agents Safer to Run.

When each one wins, and how I run it

The CLI wins when the tool already has a good command line (git, gh, docker, npm), when you're on your own machine, when you want to chain steps with pipes, and when you care about every token in context.

MCP wins when there's no CLI (like a lot of web apps), when the service is remote and needs a proper sign-in, when your agent has no shell (like a chat app), when you want permissions by tool name, and when the agent needs to stay in one long live loop with the tool, like poking around a browser for a long time or tests that fix themselves. That's pretty much what Microsoft says Playwright MCP is still good for.

My rule: if it has a good CLI, start there. If it doesn't, or you need to fence it tighter, use MCP.

Most of my setups use both. In Beckon there's a connector catalog where you browse MCP connectors like GitHub, Playwright, Supabase, Gmail and Blender and switch each one on per workspace. Before you turn one on, you can preview the tools it gives your agents, and your API keys stay in the macOS keychain. My video workspace gets one set of connectors and my coding workspace gets another, which keeps each tool list short.

Key takeaways

  • A tool call is the model writing a structured request. The host runs it, and every tool's name, description and schema costs tokens.
  • In our measurement, GitHub's MCP server listed 46 tools at 11,131 tokens, while the gh help pages for opening a PR were 2,012 tokens, read only when needed.
  • Hosts are closing the gap with tool search, and CLI skill files cost tokens too when read in full.
  • Fence MCP by tool name (allowlists, read-only mode, fewer toolsets). Fence the CLI with a sandbox that has both a filesystem wall and a network wall.
  • Start with a good CLI when there is one. Reach for MCP when there isn't, or when you need tighter fences.

FAQ

Is MCP or CLI better for coding agents?

If the tool has a good CLI like git, gh, npm or docker, start there, since your agent already has a shell and only reads help text when needed. Use MCP when there's no CLI, the service is remote and needs a proper sign-in, the agent has no shell, or you want permissions by tool name.

How many tokens does the GitHub MCP server use?

In our measurement with OpenAI's o200k tokenizer, GitHub's MCP server v2.0.3 listed 46 tools at 11,131 tokens with default toolsets, and 91 tools at 23,156 tokens with every toolset on. Other tokenizers give different totals.

Does Claude Code load every MCP tool into context?

Not by default anymore. Claude Code's tool search is on by default and loads only tool names up front, pulling in full definitions when the model needs them. Anthropic reports an 85% token cut with its Tool Search Tool.

How do you secure a coding agent's shell access?

The CLI runs as you, so you fence it with a sandbox: a filesystem wall so it can only change files in your project and a network wall so it can only reach servers you approve. Anthropic reports sandboxing cut permission prompts by 84% in its own use.

Run your agents in Beckon

A workspace for your coding agents. Get more work done in less time.

Download BeckonSubscribe on YouTube
Full video transcript

0:00GitHub's own MCP server hands your coding agent 46 tools. In an agent that loads them all up front, that's about 11,000 tokens sitting in context before you've typed a single word. The GH help for opening a pull request, about 2,000. And your agent already knows how to use it. So, in this video, I'm breaking down the two ways to give a coding agent hands. How a tool call actually works. what MCP really is under the hood, why agents are so good with a shell, what each one costs you in context, what each one can touch, and a simple table for when each one wins. Let's jump right into it. So, right now there's two camps. One says, "Wrap every app as an MCP server." The other says, "Forget

0:45that. Just give the agent a command line tool because it already lives in a terminal." And builders are going back and forth on this every single week. But before we pick a side, what is a tool call? Your model can't click anything. It can't run anything. All it can do is write text. So a tool call is just the model writing a structured request instead of an answer. Here's how it works. And don't get lost in the sauce here. It's super simple. Step one, the app you're using sends the model a list of tools. Each one has a name, a description, and a schema for its inputs. Step two, the model decides it needs one and it writes the request. Tool name plus the arguments. Step three, the app, not the model, actually runs it. And step four, the result comes

1:31back to the model as text and it keeps going. That app in the middle has a name. It's called the host. Cloud code, codeex, cursor, those are all hosts. And here's something most people don't think about. Every tool in that list costs you tokens because the names, the descriptions, and the schemas all get sent to the model. Like I said, the model only sees text. So the list is text, too. So when people argue MCP versus CLI, what they're really arguing about is how a tool gets into that list and what it costs to keep it there. Still juggling cloud code, codecs, and cursor in five terminal windows. Beckin puts every coding agent on one canvas side by side. Press a key and just talk to them. Every idea gets its own

2:16workspace with memory that carries over. Becken. Hey, Becken. So, let's start with MCP, the model context protocol. Anthropic put it out in November of 2024, and in December of 2025, they donated it to the Agentic AI Foundation, which lives under the Linux Foundation. So, it's not one company's thing anymore. The setup has three parts. The host is your app. Inside the host, there's a client, one for each server it talks to. And on the other end, there's a server. A server is just a program that wraps something like GitHub, a browser, or your database. And they all talk in JSON RPC. A server can offer three things. Tools, which are functions the model can call, resources,

3:01which are data the app can pull in, each one with its own URI, and prompts, which are templates a user picks, kind of like a slash command. So, how does the host find the tools? It just asks. It sends tools/list and the server answers with its list of tools. Name, description, input schema. When the model picks one, the host sends tools/call and the result comes back. And it gets there two ways. Standard IO, where the host starts the server as a little process on your machine, or streamable HTTP, where the server usually lives somewhere else and every message is a web request. Now, here's something to pay attention to. The newest version of the spec from July of this year made MCP stateless. The new

3:46spec drops the old Handshake, and every request carries its own version and capabilities, which is huge if you're hosting a server for a lot of people. Just know a lot of servers haven't caught up yet. All three we tested still used the old handshake. So, that's MCP. Now the other camp, your coding agent already has a shell tool. In cloud code, it's literally called bash. And with that one tool, it can run anything on your machine that has a command line. Git, ghnpm, docker, all of it. And why is it so good at this? I mean, think about it. Shell commands, man pages, and readmes are everywhere on the internet. So these models have seen a ton of them. And when it needs a flag it doesn't know, it just runs d-help and reads it.

4:32And this isn't just me saying it. Anthropic's own Claude code docs say if a system has a CLI, that's usually the easiest way in. With GH signed in, Claude will open pull requests without any explanation from you. And for a CLI it hasn't seen before, pointing it at help is enough. For systems without a CLI, there's MCP. And the shell gives you something MCP doesn't. Pipes. The agent can grab a list of pull requests, filter it with jQ and save it to a file all in one line and none of that middle data has to come back through the model. Even Microsoft ships both for Playright. There's Playright MCP and there's Playright CLI. And their own readme says coding agents are leaning toward the CLI because it skips loading big tool

5:17schemas into context. So let's talk about that cost because this is where it gets real. We measured it ourselves. Same machine, no keys, and we counted with OpenAI's open- source tokenizer. GitHub's MCP server with its default tool sets lists 46 tools. That's 11,131 tokens. Turn on every tool set and it's 91 tools and over 23,000 tokens. Playright's MCP server is lighter. 25 tools and about 4,000 tokens. Now, the CLI side, GHLP, GHPR help, and GHPR create help. All three together are about 2,000 tokens. So, the CLI route is more than five times smaller. And here's

6:02the big difference. The agent only reads those when it actually needs them. But in a host that loads tools up front, that whole tool list sits in context every turn, and it adds up fast. Anthropic wrote about a setup with five servers, 58 tools, about 55,000 tokens before the conversation even starts. And they've seen tool definitions eat 134,000 tokens before they fixed it. But here's the catch, and I want to be fair about it. The hosts are fixing this. Claude Code now has tool search on by default. It only loads the tool names up front, and it pulls in the full definition when the model actually needs it. Anthropic says that kind of search cut token use by 85%. And the CLI isn't free either. Playright CLI comes with a

6:49skill file. The always loaded part is tiny, about 50 tokens. But if the agent reads the whole thing, that's almost 4,000 tokens, pretty much the same as the MCP list. So with the CLI, you still pay for tokens. You just pay when you actually need them. So what can each one touch? This is the part people skip. With MCP, the spec says it straight. Tools are arbitrary code execution. The host should ask you before it runs one. And the descriptions a server gives you should be treated as untrusted unless you trust the server. Come on now. That's the official spec telling you to be careful. But MCP does give you clean fences. Every tool has a name. So in Cloud Code, you can auto approve just

7:34GitHub's get tools and everything else still has to get checked first. GitHub server also has a readonly mode and you can turn on only the tool sets you need, which means fewer tools it can mess with and fewer tokens, too. The CLI is different. The agent runs as you. If your GH is logged in, the agent can do anything your login can do. And Cloud Code's own docs say rules that try to limit command arguments are fragile. There's too many ways to write the same command. So, how do you fence a shell? You turn on a sandbox. Anthropic's take is you need both walls. A file system wall so it can only change files in your project and a network wall so it can only reach the servers you approve. Without the network wall, a hijacked agent could send your SSH keys anywhere.

8:20And in their own use, they said sandboxing cut permission prompts by 84%. So with MCP, you fence it by tool name. With the CLI, you fence it with a sandbox. Pretty simple. So when does each one win? Here's my table. The CLI wins when the tool already has a good command line like Git, GH, Docker, or npm. When you're working on your own machine, when you want to chain steps together with pipes, and when you care about every token in your context. MCP wins when there's no CLI at all, like a lot of web apps. When the service is remote and needs a proper signin. When your agent doesn't have a shell, like a chat app. When you want permissions by tool name. And when the agent needs to

9:06stay in one live loop with the tool, like an agent poking around inside a browser for a long time, or tests that fix themselves. That's pretty much what Microsoft says Playright MCP is still good for. So, my rule is simple. If it has a good CLI, start there. If it doesn't, or you need to fence it tighter, use MCP. And honestly, most of my setups use both. And here's how that looks for me. In Becken, there's a connector catalog. You browse MCP connectors, things like GitHub, Playright, Superbase, Gmail, and Blender. And you switch each one on per workspace. And before you turn one on, you can preview the tools it gives your agents. Your API keys stay in the Mac OS keychain. So, my video workspace gets

9:52one set of connectors and my coding workspace gets another. That way, each workspace only has the connectors I switched on for it, which like I said helps keep that tool list short. So, which side are you on? Are you a CLI person or are you running MCP for everything? Let me know down below. And if this cleared up MCP versus CLI for you, a like really helps this get to more builders. Have a blessed day.