MCP Servers & Security

MCP or CLI? When a Command-Line Tool Beats an MCP Server (GitHub, Git, Files)

23 December 2026 · Updated 28 November 2026 · 11 min read · by Yang Kai

The argument repeats in every MCP thread: why run a server when the agent already knows the CLI? Here is a five-test decision framework, verdicts for the common cases, and the hybrid setup most builders land on.

MCP vs CLI decision framework

Contents
  1. The verdict table first
  2. Test 1: Does the job hold state between steps?
  3. Test 2: Where does auth live?
  4. Test 3: Is the output already structured?
  5. Test 4: Can the agent discover it without help?
  6. Test 5: What does it cost in context?
  7. The case-by-case verdicts
  8. The hybrid pattern most builders land on
  9. The decision drill: three scenarios in under a minute
  10. The verdict

The argument shows up in nearly every MCP discussion on Reddit and X, usually aimed at the same target: “The GitHub MCP server adds nothing — Claude already knows the gh CLI.” It is a good argument. It is also, applied everywhere, a wrong one.

This article turns the argument into a decision you can make per tool instead of per ideology. Five tests — state, auth, structured output, discoverability and context cost — then verdicts for the cases builders actually argue about: GitHub, git, files, databases and browsers. The pattern most experienced users land on is a hybrid, and the last section shows what that looks like in a real config.

The research basis is the tools’ own documentation: GitHub’s CLI and MCP server docs, the database servers covered in our MCP for databases guide, and Microsoft’s Playwright MCP repository. Where the community argument is quoted, it is labelled as such.

The verdict table first

Job Winner Why, in one line
GitHub issues, PRs, reviews CLI (gh) usually The agent knows it cold; output is already structured; zero context tax
Local git Built-in shell No server can beat direct access to the repo on disk
Reading and editing files Built-in tools Purpose-built, permissioned, and already in context
Production databases MCP Guardrails — read-only modes, allowlists, audited queries — are the product
Browser automation MCP (Playwright) A live browser is state a CLI call cannot hold between steps
Hosted SaaS with no CLI MCP by default The server is the only programmatic door
One-off shell-friendly tasks CLI Installing a server for a weekly task is overhead without payoff

Now the reasoning, so you can overrule the table when your case differs.

Test 1: Does the job hold state between steps?

A CLI call is born, runs and dies. That is fine for gh pr list. It fails when the work is a session: a browser with pages open and a login alive, a database transaction, a debugger paused at a breakpoint.

Rule: if step two needs what step one left behind, you want a server (or a long-lived process the agent drives). If every step is independent, the CLI’s statelessness is a feature — no daemon to babysit, no stale connection. This single test decides the browser case on its own, as the verdicts below show.

Test 2: Where does auth live?

With a CLI, credentials sit in the tool’s own store — gh auth login writes a token the agent never sees. The agent inherits access by running the tool, and the token stays out of the transcript.

With an MCP server, auth is configured per server: an environment variable, an OAuth flow, or a scoped key in your config. Hosted servers with OAuth (GitHub’s remote server, Stripe’s, Notion’s) have closed much of the gap, but a local server launched with your full database password in its environment is a different risk shape from a CLI holding a scoped token. The MCP auth explainer walks through the models; the MCP security checklist covers scoping either way.

Rule: prefer the route where the credential is narrowest and least visible to the model. Often that is the CLI. For a shared team setup, a hosted MCP server with OAuth and per-user identity can win instead — CLI tokens are usually your identity with no per-agent audit trail.

Test 3: Is the output already structured?

Agents do not read screens; they parse text. CLIs built for humans print tables meant for eyes, and the agent burns tokens and makes errors scraping them — unless the CLI offers a machine mode. The good ones do: gh has --json with field selection, git has porcelain formats, kubectl and the cloud CLIs have JSON output throughout.

An MCP tool returns structured results by design, with the schema declared up front. That is the server’s strongest general claim — and it is weakest exactly where a mature CLI already speaks JSON.

Rule: if the CLI has a real --json mode, the structured-output argument for a server mostly evaporates. If output is human-only tables and ANSI colour, the server (or a wrapper script) earns its place.

Test 4: Can the agent discover it without help?

Models arrive pre-trained on the popular CLIs. gh, git, docker, npm — the agent knows the flags, the idioms and the error messages before your session starts. An MCP server, by contrast, explains itself: tool descriptions are written for the model, which is why a niche internal tool with no public documentation often works better as a server than as a private CLI the model has never seen.

Rule: famous CLI beats unknown server; unknown anything beats famous CLI only when its self-description is good. This is also why the MCP registry guide matters — provenance and description quality are the discovery layer.

Test 5: What does it cost in context?

A CLI costs zero definitions. The agent’s shell tool is already loaded, and the command is just text in the transcript. A server charges the context tax covered in the MCP context tax guide: every tool definition, every session, in every client — softened by tool search in Claude Code, charged in full elsewhere.

Rule: a server must repay its rent with state, guardrails or structure the CLI cannot give. “It is slightly nicer” does not clear the bar at 90 tools.

The case-by-case verdicts

GitHub: CLI usually, server for hosted flows

The community argument is mostly right. gh covers issues, pull requests, reviews, releases and Actions; it speaks JSON; its auth is a scoped token the model never handles; and the model already knows it. For a solo builder in a terminal agent, the server’s 90-plus tools repay their rent rarely.

The server earns its place in two situations: hosted/remote setups where no shell or no gh install exists (web agents, sandboxed runners), and fine-grained toolset control, where you want an agent that can read issues but has no tool that could merge. If you do run it, trim toolsets — see the audit method in the context tax guide.

Git and files: the built-ins already won

No MCP server should sit between an agent and the repository it is standing in. Local git through the shell is complete, scriptable and free of context cost; the reference filesystem server exists for clients without file tools and for hard directory allowlists in locked-down setups — a real use, covered in the best MCP servers by job list, but not a reason to add it to a coding agent that already reads and edits files natively.

Databases: MCP, and it is not close

Here the argument flips. The CLI route to a production database is a connection string and a prayer: the agent composes raw SQL, and nothing stands between a bad query and your tables. The maintained database servers sell exactly the missing layer — read-only modes enforced by the server, query allowlists, connection profiles that physically cannot reach production. Postgres MCP Pro’s restricted mode and DBHub’s per-source readonly setting exist because the CLI pattern failed people. Guardrails are the product; the protocol is packaging.

Browsers: MCP, because state is the job

A browser is the purest stateful tool in the stack: cookies, tabs, a DOM that changes as you act. Playwright’s CLI exists and scripts one-shot checks well, but exploratory work — log in, navigate, inspect what rendered, react — is a session, and sessions are what servers hold. Microsoft’s Playwright MCP drives the browser through the accessibility tree rather than screenshots, which keeps the structured-output test green too. Our browser automation with Playwright MCP guide covers the setup; the MCP for browsers and clients piece compares the client-side options.

The hybrid pattern most builders land on

Run the decision per job and a shape emerges:

Watch out: the worst outcome is both — a server installed and the CLI used, with the agent coin-flipping between them. Pick one route per job and, if it matters, write the preference into your project instructions so the choice survives the session.

The decision drill: three scenarios in under a minute

Run the five tests quickly on the requests that actually start these arguments:

“Should I add a Kubernetes MCP server?” State: a cluster is live state, but kubectl reads it fresh on every call, so the CLI’s statelessness costs nothing. Auth: your kubeconfig stays in the CLI’s world. Output: JSON throughout. Discovery: the model knows kubectl deeply. Verdict: CLI, unless you need the server’s guardrails — some cluster servers sell read-only scoping and audit logs, which is a Test 2 win, not a convenience win.

“Should I add a server for my SaaS billing?” If the vendor runs a hosted MCP server with OAuth — Stripe is the reference case in the servers by job list — the server wins on auth and structure: per-user identity, scoped keys, typed results, and no CLI exists with comparable coverage. Verdict: MCP.

“Should I add a server for my notes app?” One user, local files, an agent with native file tools. The server would re-expose what the built-ins already do and charge context for it. Verdict: neither — the correct answer is sometimes no new tool at all, just the file tools and a folder convention.

Notice what the drill never asks: which option is newer, or which one a launch post recommends. The tests are boring on purpose. Boring tests survive contact with the next tool that goes viral.

FAQ

Is the GitHub MCP server useless, then? No. It is the right tool for hosted agents without a shell, and for locked-down toolsets. For a local coding agent with gh installed and authenticated, the CLI wins on cost, structure and auth — which is the setup the Reddit argument assumes.

Does using CLIs make my agent less safe? It changes the risk rather than removing it. A shell-capable agent can run destructive commands; permission rules and sandboxing are the control, covered in our Claude Code permissions coverage. A server’s advantage is a narrower tool surface — when the server is actually scoped, not running with your full credentials.

What about tools with no CLI and no MCP server? A small wrapper script the agent calls, or a minimal server of your own — build your first MCP server is a short project. Reach for that only when the job recurs; one-off tasks belong in the shell.

How do I stop the agent picking the wrong route? State the route in the project file: “Use gh for GitHub work; the database MCP server is read-only and is the only path to production data.” Agents follow explicit local rules far more reliably than defaults.

Can I mix both for the same service? You can, and people do for GitHub — CLI locally, server in CI. Just make the split by environment, not by mood, so behaviour is predictable in each place.

The verdict

Neither protocol wins; jobs do. Stateless, famous, JSON-speaking tools belong to the CLI. Stateful tools and anything that needs guardrails belong to a server. Run the five tests, write the winners into your config and project instructions, and delete the servers that were only ever a nicer icon for a command the agent already knew.

If your config has grown past the point where you can say which route each job takes, start with the MCP context tax pruning method — the audit will surface every duplicate this article warns about.

By Yang Kai — meetBlogging covers MCP, AI coding tools and the business of building with them, from desk research against official docs and named community sources.

Category: MCP Servers & Security · Tags: #mcp #ai-coding #ai-agents

Next step: this article is part of MCP guides, which covers the full topic from first setup to advanced use.

Related guides