Terminal showing CLI-first AI agent architecture versus MCP protocol diagram
Tutorials

Why We Chose CLI Over MCP for Production AI Agents

By Agents Squads · · 10 min

TL;DR — MCP won the standards war with 97M downloads, but CLI-first architecture is simpler, faster, and more debuggable for 80% of AI agent use cases. Use CLI where good tools exist, reserve MCP for stateful services and complex APIs.

The Contrarian Take

MCP (Model Context Protocol) won the standards war. 97 million downloads. AWS, Google, Microsoft backing. Linux Foundation governance.

We still don’t use it for most of our agents.

This isn’t about MCP being bad—it’s excellent for certain use cases. But after building dozens of production AI agents, we’ve found that CLI-first architectures are simpler, faster, and more debuggable for 80% of real-world scenarios.

What’s CLI-First?

Instead of building MCP servers to expose tools, you give your AI agent direct access to shell commands. With MCP, a database query flows through the agent, an MCP client, an MCP server, a database driver, and finally reaches the database. With CLI-first, the agent runs psql directly. No protocol layer. No server management.

Why This Works Better (For Us)

Zero Infrastructure

MCP servers need to start up, stay running, be monitored, and be updated. CLI tools are already installed. git, psql, curl, jq — they just work. Our agents deploy with zero additional infrastructure.

Instant Debuggability

When something fails with MCP, you’re asking: is it the client? The protocol? The server? The tool? When a CLI command fails, you copy the exact command, run it yourself, and see the exact error:

psql -h localhost -d mydb -c "SELECT * FROM users"

Our debug time dropped 70% after switching to CLI-first.

Our Data — Debug time dropped 70% after switching from MCP to CLI-first. When a command fails, you copy it, run it yourself, and see the exact error. No protocol layer to investigate.

Composability and Portability

Shell commands compose naturally — pipes, redirects, jq for JSON processing. MCP tools are isolated; composing them requires custom orchestration. And CLI tools work everywhere: macOS, Linux, Docker containers, CI/CD pipelines. MCP servers need specific runtimes and configurations per environment.

Full Transparency

Your agent’s actions are auditable commands that anyone can read and reproduce. Non-technical stakeholders can look at shell history and understand exactly what the agent did. Try auditing MCP tool calls the same way.

When MCP Makes Sense

CLI-first isn’t always right. Use MCP when:

Complex State Management

If your tool needs to maintain connections, sessions, or caches, MCP servers handle this well.

# MCP server can maintain database connection pool
# CLI would reconnect on every query

Rich Type Systems

MCP provides structured inputs/outputs. If you need complex parameter validation, MCP’s schema definitions help.

Third-Party Integrations

Some services only offer MCP servers. Using the existing server beats building CLI wrappers.

Team Standardization

Large organizations benefit from MCP’s standardization. Everyone builds servers the same way.

Our Architecture

Here’s how we structure CLI-first agents:

# Agent Definition (agents/code-reviewer.md)

## Role
Review code changes and suggest improvements.

## Tools Available
- git (version control operations)
- gh (GitHub CLI)
- rg (ripgrep for code search)
- jq (JSON processing)

## Workflow
1. Run `git diff` to see changes
2. Use `rg` to find related code
3. Analyze patterns and suggest improvements
4. Use `gh pr comment` to post review

## Constraints
- Read-only operations unless explicitly approved
- No force pushes
- No credential access

The agent is just a prompt file. The tools are standard CLI utilities. No servers, no protocols.

Real Performance Comparison

We benchmarked identical tasks with both approaches:

TaskCLI-FirstMCP Server
Query database45ms180ms
Git operations30ms150ms
File search20ms90ms
API call100ms200ms

Why the difference?

For agents that run hundreds of tool calls, this adds up.

The Numbers — CLI-first is 2-4x faster per operation: database queries at 45ms vs 180ms, git operations at 30ms vs 150ms, file search at 20ms vs 90ms. For agents making hundreds of tool calls, this compounds significantly.

The Hybrid Approach

We’re not MCP-free. Our actual setup:

Tool TypeApproach
Shell utilitiesCLI direct
DatabasesCLI (psql, mysql)
Git/GitHubCLI (git, gh)
Complex APIsMCP server
Stateful servicesMCP server

Rule of thumb: If a good CLI exists, use it. Build MCP servers only for what CLIs can’t do.

Key Takeaway — We’re not anti-MCP. We use it for complex APIs and stateful services. But shell utilities, databases, and git all go through CLI direct. Match the tool to the task.

Migration Path

If you’re using MCP and want to simplify:

Start by auditing every MCP server you’re running. For each one, ask: is there a CLI equivalent? Does this need persistent state? How often is it called?

Then replace the low-hanging fruit — stateless tools that have direct CLI equivalents. Git MCP becomes git, GitHub MCP becomes gh, filesystem MCP becomes standard shell commands. Measure the difference in latency, debug time, and operational overhead.

Some MCP servers will earn their keep. Keep those. Remove the rest.

Common Objections

”But MCP is the standard!”

Standards matter for interoperability. If you’re building tools for others to consume, MCP makes sense. If you’re building agents for your own use, simplicity wins.

”CLI isn’t secure!”

Neither is MCP by default. Both need sandboxing and permission controls. We use the same security model regardless of approach.

”What about complex operations?”

Write shell scripts. They’re version-controlled, testable, and your AI can read and understand them.

#!/bin/bash
# deploy.sh - Deploy to production
set -e
npm test
npm run build
aws s3 sync dist/ s3://my-bucket
aws cloudfront create-invalidation --distribution-id XXX

”My AI can’t write good shell commands”

Modern LLMs are excellent at shell commands. Claude, GPT-4, and others have seen millions of examples. They often write better shell than junior developers.

The Bottom Line

MCP is good technology solving real problems. But it’s not always the right choice.

For most AI agent use cases:

Start simple. Add complexity only when you’ve proven you need it.


Building AI agents? Check our CLI architecture guide or contact us to discuss your approach.

Related Reading

Back to Tutorials