Your agent can reach GitHub, a database or Sentry in two ways: through an MCP server or through the tool's command-line interface. The right choice depends on where the agent runs, what each option costs in context, and how tightly you need to control what it can do.
The short answer
What each one is
| Option | What it is | Where it works | Context cost |
|---|---|---|---|
| CLI | A program the agent runs in a terminal, like gh pr list | Agents that run commands in your environment: Claude Code, Codex, Cursor | Nothing until it runs, then its output |
| MCP server | A server that exposes typed tools, handles sign-in and returns structured results | Local on your computer or remote, in most AI apps | Tool names or definitions, plus every result |
| Skill | Instructions and optional scripts the agent loads when a task matches | Claude, ChatGPT, Codex and other tools that support skills | A short description until used |
The case for the CLI
- No tool menu. An MCP server describes its tools to the model. A CLI adds nothing until the agent runs it. Claude Code's docs recommend preferring CLIs like
gh,aws,gcloudandsentry-cliwhen available, since they are "still more context-efficient than MCP servers." - Composable output. A CLI's output can be piped through
grep,jqor into a file, so the agent reads only the part it needs. - Fewer tools, better choices. Anthropic's API docs say Claude's accuracy at picking the right tool degrades past 30 to 50 available tools.
- Definitions add up. The same docs put a typical five-server setup (GitHub, Slack, Sentry, Grafana, Splunk) at about 55,000 tokens of tool definitions.
What changed for MCP
Definitions now load on demand. In Claude Code, tool search is on by default. Only tool names and server instructions load at the start of a session, and a tool's full definition loads when Claude needs it. Anthropic reports this typically cuts definition overhead by more than 85%. It needs Claude Sonnet 4.5, Haiku 4.5, Opus 4.5 or a later model.
Apps offer the same control. In claude.ai, set Tool access to On demand once you have 10 or more connectors. OpenAI's Codex docs recommend disabling MCP servers you aren't using, since each one adds context.
Output is often the bigger cost. A tool that returns a whole web page or log fills context fast, whether it's an MCP server or a CLI. Claude Code warns when a single MCP result passes 10,000 tokens and caps it at 25,000 by default. Ask for filtered, paginated or summarized output either way.
Code can replace definitions. Anthropic describes agents calling MCP tools through code instead of loading every definition. One example dropped from 150,000 tokens to 2,000.
When MCP is the right tool
| Situation | Why MCP wins | Example |
|---|---|---|
| The agent can't run your CLIs | Claude on the web and ChatGPT run code in a sandbox, not with your signed-in tools | Connectors for Gmail, Drive or Slack |
| You need a logged-in browser | The agent works in your own session on sites that block automated access | chrome-devtools-mcp with --autoConnect |
| The CLI is missing or limited | The server handles sign-in and gives the agent clean, structured tools | Check the service's CLI first |
| You need narrow, enforced permissions | The server only exposes the actions you allow | A read-only database server |
| It's an internal tool | You decide exactly what the agent can see and do | Your company's admin API |
| The server does real work | It searches or combines across systems instead of wrapping one API | Error triage with code context |
Why permissions matter here: Claude Code's command rules match text patterns. Its docs show that a rule blocking git push doesn't match the same push written as git -C . push. A server that has no write tool can't be talked into writing.
Decide in five questions
- Can the agent run your signed-in CLIs? No: use a connector or MCP server.
- Is there a mature CLI for this service? Yes: use it, and add a skill if you repeat the task.
- Does the task need your logged-in browser? Yes: use a browser MCP server.
- Do you need to limit it to specific actions? Yes: use an MCP server with read-only mode or tool filters.
- Will the agent use it on most turns? If not, keep it deferred or turned off until you need it.
Lock down and audit
Lock down what you keep:
- Databases: give the agent its own read-only database user, even if the server has safeguards.
- GitHub MCP: start it with
--read-only, and expose only what you need with--toolsetsor--tools. - Supabase MCP: scope it to one project with
project_refand addread_only=true. - Claude connectors: set each tool to Always allow, Needs approval or Blocked in Customize > Connectors.
- Browser servers: a logged-in browser exposes everything in it. chrome-devtools-mcp also collects usage statistics unless you pass
--no-usage-statistics. - Local servers run with your computer's permissions. Install only ones you trust.
Audit your setup in 10 minutes:
- In Claude Code, run
/contextto see what uses space. - Run
/mcpand list servers you haven't used recently. - Disable any server a mature CLI already covers.
- Turn repeated CLI tasks into a skill.
- Restrict what's left, then run
/contextagain.
A skill that replaces a GitHub MCP server with gh can be this short:
---
name: github-triage
description: Review open issues and pull requests in this repository with the gh CLI. Use when asked what needs attention.
---
Use the `gh` CLI for GitHub work in this repository.
- List open issues: `gh issue list --state open --limit 20 --json number,title,labels`
- Check pull requests: `gh pr status`
- Ask me before commenting, labeling, closing or merging anything.
Reply with a table: number, title, status, suggested next step.
Go deeper: Claude Code MCP docs · Code execution with MCP · The AI Tool Map · Claude, End to End