PlugWiki

MCP vs CLI for AI agents

When an AI agent should use an MCP server and when a plain command-line tool does the job better, with the trade-offs on context, sign-in and safety.

Anthropic's Claude Code guide says that if a system has a CLI, that is usually the easiest way in. MCP is the open standard that lets AI apps such as Claude and ChatGPT connect to external systems, including from chat apps where there is no terminal.

The cost of MCP is context: most clients load every tool definition up front, though Claude Code defers them until needed. The cost of a CLI is that it works only where the agent can run commands.

Our advice: if your agent has a terminal and the service has a good CLI (git, GitHub's gh, a cloud CLI), use the CLI. Use an MCP server when there is no CLI, when you work in a chat app with no terminal, or when you want each person to sign in with their own account. To see how MCP tools work, read MCP tools explained; for MCP against skills, see MCP vs skills.

Good for

  • Claude Code, Codex and Cursor users wiring up tools
  • Teams deciding whether to build an MCP server or ship a CLI
  • People who use Claude or ChatGPT in the browser and want them to reach their apps

Side by side

Our advice: use a CLI in a terminal agent when one exists. Use MCP for chat apps, for services with no CLI, and when each user should sign in as themselves.

OptionMCP serverCLI tool
Where it runsLocal process or remote URLWhere the agent has a shell
Chat apps such as Claude and ChatGPTConnect through MCP serversNot applicable
Sign-inOAuth per user for hosted serversYour existing CLI login (for example gh)
Context costMost clients load all tool definitions up front; Claude Code defers themAgent reads --help when it needs to
InputsJSON SchemaFlags, described by --help
Output limit in Claude CodeWarns above 10,000 tokens, cuts at 25,000Not applicable

Which to pick

Our advice: default to the CLI when your agent runs in a terminal and a mature CLI exists, since the agent can use your existing login. Use an MCP server when there is no CLI, when you work in a chat app like Claude or ChatGPT, or when each person should sign in as themselves.

You can use both: keep the CLIs your team already trusts, and add MCP servers only for the services that lack one.

Best for

  • CLI: git, GitHub, cloud and database tools in Claude Code or Codex
  • MCP: Notion, Linear, Slack and other services with no good CLI
  • MCP: the Claude app and ChatGPT, which connect through MCP
  • MCP: teams where each person must sign in as themselves

Skip it if

  • MCP: you connect many servers you rarely use, since most clients load every tool definition into each session
  • CLI: your agent runs in a chat app with no shell

Related plugs

6

Questions

Is MCP better than a CLI for AI agents?

Not always. Anthropic's Claude Code guide says a CLI is usually the easiest way in when a system has one. MCP is the standard that chat apps such as Claude and ChatGPT use to connect to external systems.

Why do people say MCP wastes tokens?

Because most MCP clients load every tool definition into the model's context up front, and every result passes back through the model. In one example in Anthropic's November 2025 post on code execution with MCP, having the agent call tools from code cut usage from 150,000 tokens to 2,000. Claude Code now loads only tool names at the start and fetches full definitions when needed.

When should I use an MCP server instead of a CLI?

Our advice: use MCP when the service has no CLI, when you work in the Claude app or ChatGPT, or when a hosted server lets each person sign in with their own account. MCP tools also describe their inputs in a fixed format (JSON Schema) the agent reads before it calls them. See MCP tools explained.

When is a CLI the better choice?

Our advice: use a CLI when your agent runs in a terminal and the CLI is well known, like git or gh. Anthropic's Claude Code guide says that with gh installed and signed in, Claude opens pull requests and reads review comments without explanation, and that for a CLI it has not seen before, pointing it at --help is enough.

Is a CLI safer than an MCP server?

Neither is safer by default. The MCP security guide says local MCP servers may have direct access to your system and calls for sandboxing and consent requirements. Claude Code documents permission rules and a sandbox you can use to limit what the agent can run or reach. Our advice: give any token only the access it needs.

Can I use MCP servers and CLI tools together?

Yes. In Claude Code the agent runs CLIs through its shell and calls MCP servers you add. Turn off servers you are not using in the /mcp menu so they stop adding to every session. For MCP compared with skills, see MCP vs skills.

How do I add an MCP server to Claude Code?

Run claude mcp add --transport http <name> <url> for a hosted server, for example claude mcp add --transport http notion https://mcp.notion.com/mcp. For a local one, put the start command after --. See the Claude Code client page for config files and scopes.

Is there a limit on how much an MCP tool can return?

In Claude Code, yes. It warns when a tool returns more than 10,000 tokens and cuts output at 25,000 tokens by default; set MAX_MCP_OUTPUT_TOKENS to change the cap.

Sources

Docs, issue trackers and discussions this page is built from.

Show all 8
  1. Claude Code best practices · code.claude.com
  2. MCP introduction · modelcontextprotocol.io
  3. Anthropic: Code execution with MCP · anthropic.com
  4. Claude Code MCP · code.claude.com
  5. MCP specification: tools · modelcontextprotocol.io
  6. Codex MCP · learn.chatgpt.com
  7. Connect and manage custom apps for Gemini Apps · support.google.com
  8. MCP security best practices · modelcontextprotocol.io

Updated Nov 3, 2026.