
Your agent needs to open a GitHub issue, read a Slack thread and update a CRM record. You can have your code call each provider's API, let the agent shell out to a CLI, or hand it an MCP server to discover and call. Most of the MCP vs API vs CLI debate argues for one side. Sentry's "MCP or CLI? Yes." (November 10, 2026) argues for both, and Anthropic's April 2026 post sets out where each one fits.
Here's the rule up front. If it's just you on your own machine, use a CLI. If your code calls one service with keys you hold, call the API. If an agent acts for many people across many apps and chooses the calls itself, use MCP, and make it one connection your backend can share.
The three options in one paragraph each
Direct API. Your code calls the provider's API with keys or tokens you hold. Nothing is discovered: you decide which endpoint to hit and you write the request. If a model is involved at all, you've wrapped that call as a tool yourself.
CLI. The agent runs a command-line program, such as gh or sentry, the way you would in a terminal. The program acts as whoever is logged in on that machine. The agent also inherits the shell's reach: files, pipes and every other binary on the path.
MCP. The Model Context Protocol is "an open-source standard for connecting AI applications to external systems". An MCP server publishes tools, and the agent's client discovers and calls them. Local servers run over stdio and read credentials from the environment; remote servers over HTTP can use OAuth, so each person signs in as themselves.
If MCP sounds like function calling with extra steps, it isn't a rival to it. It's a shared way to publish tools, so one server works in every client that speaks the protocol.
Where function calling fits
Function calling is how a model asks for any tool, so it sits under all three options rather than beside them. The model returns a structured call; client tools then run in your application, and server tools run on Anthropic's infrastructure. MCP standardizes where tool definitions come from and who executes them, and Anthropic's MCP connector even lets the Messages API reach a remote MCP server without a separate MCP client. A hand-written API tool, a CLI the agent runs and an MCP tool all reach the model the same way. They differ in everything around the call.
How they compare
No column wins every row. Read the credentials rows first: they decide more builds than the token counts do, and they're the rows the debate posts tend to skip.
| Direct API | CLI | MCP | |
|---|---|---|---|
| Who holds credentials | Your code, in a store you build | Whoever is logged in on the machine | The server: the environment for stdio, OAuth per person for remote |
| Per-user auth | You build consent, storage and refresh | One login per machine | In the spec for HTTP servers |
| Context cost | The schemas you write; no public measure | Near MCP in Checkly's July 2026 test | Near the CLI when the client defers tool loading |
| Discoverability | None: you wire each call | Has to be introduced to the agent, per Sentry | Discoverable without instruction, per Sentry |
| Safety controls and audit | Whatever you build | The shell's permissions | Per-tool approval in the client, in Parallel's account; audit depends on the server |
| Portability across clients | Rewired per framework | Any agent with a shell | One remote server across compatible clients |
| Effort to build | High, per service | Low: install and log in | Low to use; building a good server is real work |
| Best at | One agent talking to one service | Quick, permissive work in local environments | Production agents in the cloud |
The effort row flatters the CLI a little. Install and log in is cheap for one person; it stops being cheap the day a second person needs their own login on the same worker.
The context-cost argument, with dates
Context cost is the CLI camp's strongest argument, and its numbers are older than they look. Every tool definition an agent loads takes up context before the agent does any work, so a pile of servers can eat the budget before you type a word.
In November 2025, Anthropic measured a five-server setup with 58 tools at about 55K tokens of definitions before the conversation started, and it had seen setups reach 134K. Its fix was tool search: the agent loads a search tool and fetches definitions only when it needs them. In its example with 50+ tools, that took the total before work begins from about 77K tokens to about 8.7K. Anthropic's April 2026 post puts the cut at "85%+" of tool-definition tokens in its authors' testing.
A newer test found the two close. Checkly ran the same Playwright task three times in Claude Code and published the results on July 30, 2026: MCP sessions used 48k to 50k tokens, CLI sessions 45k to 48k. That's one task, counted as whole sessions rather than definitions alone. Checkly doesn't say which model ran or how tokens were counted. Its author concludes "there's no big difference in using CLIs or MCPs these days", puts that down to harnesses that now defer MCP tool loading, and warns that token advice goes stale within months.
Clients do differ here. As of November 2026, Claude Code's docs say tool search is on by default. Sentry's David Cramer notes that harnesses implement the spec differently, especially tool search. So the 2025 and 2026 figures don't cancel each other out: they measure different things, on clients that load tools differently.
Results cost tokens too. Claude Code warns when an MCP tool returns more than 10,000 tokens, and it limits output to 25,000 by default, which you can change with MAX_MCP_OUTPUT_TOKENS. Text results over 50,000 characters are saved to a file instead. A tool that returns a whole log file is expensive whether it arrives over MCP or a pipe.
If you installed a handful of servers and watched the context meter fill before your first prompt, that was real. It was also, mostly, a client setting.
Context cost is now a property of your client more than of the protocol, so check whether yours defers loading before you rip out a server.
Per-user auth is where CLIs break
A CLI acts as whoever is logged in on the machine it runs on. Ask the question a CLI can't answer well in a multi-user product: whose GitHub is this agent pushing to? On your laptop, yours. On a shared worker serving every customer, also yours, which is the problem.
MCP over HTTP puts per-person auth into the protocol. Under the 2025-11-25 authorization spec, a remote MCP server acts as an OAuth 2.1 resource server: it checks tokens, and a separate authorization server issues them. The parts that matter for an agent:
- Discovery. A request without a token gets a 401 whose
WWW-Authenticateheader points to the server's metadata, and servers must publish that metadata as RFC 9728 describes. The client learns where to sign the person in without being configured for it. - Audience binding. Clients send the RFC 8707
resourceparameter, which names the server a token is for, and servers must check that a token was issued for them. A token stolen from one server is useless at another. - PKCE. Clients use PKCE with
S256when they can, a one-time secret that makes an intercepted authorization code worthless, and tokens never go in the URL's query string. - No passthrough. A server that calls upstream APIs must not forward the token the client gave it. Your server holds each person's own grant for the upstream app.
Authorization is optional, and stdio servers skip it and read credentials from the environment, the same as a CLI. So a local MCP server has the CLI's one-login shape. The per-person part needs a remote server.
Parallel, which sells both an MCP server and a CLI, frames the difference as built-in OAuth and per-tool approval versus the shell's all-or-nothing permissions. The article is undated and it's one vendor's view, but the auth half of it is in the spec.
A direct API leaves all of this to you: the consent flow, an encrypted token store keyed by user, refresh, revocation and reconnects. It's doable, and it's also a second product you didn't plan to ship. If more than one person's account is involved, the CLI is out, and the question becomes whether you build the token store or use a server that has one.
Where CLI wins, and where a direct API is enough
The CLI wins for local, permissive work, and you shouldn't talk yourself out of it. Piping gh issue list --json number,title into jq is one line, and no model has to think about it. Anthropic's April post calls CLIs "best suited to quick, permissive integrations in local environments", and notes they struggle to reach web, mobile or cloud-hosted platforms. In Parallel's words, CLIs compose through the shell, while MCP calls compose through the model one at a time.
Sentry's case for its CLI is the filesystem. An agent can page through and grep large raw data, such as session replays, instead of pulling all of it into context. Every Sentry CLI data command also takes --json, so scripts and CI jobs can act on the output (Sentry, October 2, 2026).
If you're the only user and it runs on your laptop, use the CLI and don't apologize.
A direct API is enough for one agent and one service. Anthropic says it "works fine for one agent talking to one service", but warns that each agent and service pair becomes a bespoke integration as you add more. It's also the right call when no model decides anything. The cron job that posts yesterday's signups to Slack never needed to reason; give it an API key and a schedule.
Three scenarios
Solo developer in Claude Code
Use the CLI for local tools: git, gh, test runners, anything that touches files on disk. Anthropic's guidance draws the same line, with CLIs for local work and MCP for reaching hosted platforms. Add a remote MCP server for the SaaS apps you'd otherwise script logins for, like your issue tracker, docs or calendar (setup in Claude). Claude Code's default tool search means adding servers costs less context than older posts suggest. One habit helps: mention each CLI in your project instructions, because, as Sentry puts it, an agent has to be introduced to a CLI while MCP tools are discoverable without instruction.
A SaaS agent acting for each customer
Use a remote MCP server with per-user OAuth, or one governed connection that does that for you. Every call has to land on the right customer's account, so the spec's audience-bound tokens and its no-passthrough rule do real work here. Then come the questions your customers will ask: what is this agent allowed to do in our account, and what did it do last Tuesday? Per-customer policies and an audit trail answer them; a shell history doesn't.
Internal automation
Use a direct API or a CLI in scripts, and add an agent only at the step where something has to choose the call. Anthropic's one-agent, one-service case covers most of this. CLIs with --json output, like Sentry's, slot straight into CI.
Triage is a good place for an agent; the nightly export isn't.
The option the debate skips: one connection for agent and backend
"Both" is a respectable answer, and Sentry gives it. Its November 10, 2026 post says "you can have both", and sentry mcp runs the MCP server in stdio mode with the CLI's credentials, so one developer's login serves both. The author calls that shared auth an experiment around current limitations, a one-off rather than a long-term fix. An earlier Sentry post, from October 2, 2026, says its MCP server, CLI and other surfaces "aren't competing options".
A multi-user product can't borrow that trick, because there's no single local login to share. There, "both" tends to mean an MCP server for the agent and separate integration code for the backend that calls the same apps: two credential stores, two places to revoke a customer and two logs to reconcile.
It's how you end up disconnecting a customer in one place while the other keeps posting to their Slack.
One governed connection can be the MCP endpoint for your agent and the REST API for your code. Arc0 publishes this blog, so read what follows as our worked example and our pick, and check each claim against the docs it links. Arc0 MCP is one endpoint bound to one authenticated person; changing the URL can't select another user. Interactive clients sign in with OAuth, and other clients use a self-bound API key in x-api-key. It works in Claude, ChatGPT, Cursor, Claude Code, Codex, VS Code and any remote-MCP client, and with frameworks such as the OpenAI Agents SDK and LangGraph (client setup).
- A short tool list in every client. The agent gets meta tools such as
search_actionsandexecute_action, and searches a short authorized list instead of loading every tool; tool versions are pinned per project. That's tool search done on the server, so it doesn't depend on your harness. Arc0 publishes no token figure for it, so measure it in your own client. - Every call graded and checked. Each action is graded read, write or destructive. Policies set Allow, Ask or Deny per agent and per customer, with app rules like
stripe:write~ask. Approvals hold the exact request for a human, and the agent can't approve its own. The audit log is on every plan. - Credentials stay server-side. Calls run server-side, and credentials never reach the agent or the model. Writes carry idempotency keys and receipts, and clients never retry a write automatically.
- The same connection for your backend. The REST API and an authenticated proxy,
POST /v1/execute, serve your code on the connection the agent uses, with@arc0/sdkfor TypeScript andarc0-sdkfor Python. - Vendor MCP servers under the same rules. The catalog has 1,484 apps, and official vendor MCP servers are proxied behind Arc0 auth, with every call still going through your policies and audit log.
On the agent side, adding Arc0 to Claude Code is one command from the client setup docs:
claude mcp add --transport http --scope user arc0 https://api.arc0.ai/mcpThen run /mcp in Claude Code, select Arc0 and finish the sign-in in your browser. That sign-in binds the endpoint to you; a client without OAuth sends a self-bound key in x-api-key instead.
The backend side is the TypeScript SDK example as published: search for an action, then run it with the version discovery returned and an idempotency key.
import { Arc0 } from '@arc0/sdk';
import { randomUUID } from 'node:crypto';
const arc0 = new Arc0({
baseUrl: process.env.ARC0_API_URL!,
apiKey: process.env.ARC0_API_KEY!,
});
const shortlist = await arc0.search({ query: 'public repository' });
const tool = shortlist.tools.find((tool) => tool.action === 'github.get_public_repository');
if (!tool) throw new Error('Enable the public GitHub tool first');
const definition = await arc0.search({ action: tool.action, version: tool.version });
// Inspect definition.tools[0].inputSchema before constructing arguments.
const receipt = await arc0.execute({
action: tool.action,
actionVersion: tool.version,
arguments: { owner: 'octocat', repo: 'Hello-World' },
idempotencyKey: randomUUID(),
});The key decides whose account that call touches, and that example, a public read, doesn't name anyone. A backend acting for many customers uses an Embedded key that isn't bound to one user, and passes each customer's project-scoped endUserId: the SDK docs add it as one more constructor option, and the REST API docs require it on user-specific endpoints. The agent's MCP connection works the other way. It's bound to one person, MCP turns away unbound management keys, and a self-bound key that names a different user is rejected.
There are still two Arc0 keys, one per caller. What you stop duplicating is the hard part: the provider credentials sit in one vault, behind one set of policies and one audit log.
It isn't a replacement for local CLIs: keep git and jq in the shell, where they're better. And for one service on your own key, a direct call is simpler. Arc0 earns its place once there are many users, many apps, or an agent deciding which call to make.
The decision rule
Three lines cover most builds:
- Local, and just you: use a CLI.
- One service, your code deciding the call: use the direct API.
- Many users or many apps, with the agent choosing: use MCP, ideally one governed connection that also serves your backend.
You'll probably end up using all three. That isn't indecision; it's three different jobs.
If you're building, sign up and try the third line on Arc0. It's free for your first 100 active connected users: end users with at least one successful action in production that month (pricing). Start with the quickstart and make one read through the SDK. If you just want your own Claude or Cursor to reach your apps, Arc0 for individuals gives you a free personal MCP URL with a 7-day audit log.