XNews

CLI token efficiency for AI agents

A detailed analysis argues that CLI is still better than MCP for AI agents in many scenarios, despite MCP improvements like deferred tools. CLI excels for familiar commands, local runs, and token savings, while MCP suits multi-user environments, auditable systems, and tools unknown to the model. The choice depends on context.

Key insights

CLI advantages: model familiarity, token efficiency, local simplicity

CLI commands like gh or kubectl are already learned by the model during training, requiring no schema injection – cost only tens of tokens. Local execution is straightforward, pipeline composition via pipes works well, and CI/CD integration is natural. Token overhead for CLI-specific schema is near zero when the model knows the command.

MCP advantages: structured schema, auditability, tool discovery

MCP provides standardized JSON schema for tool parameters, enabling machine-validated calls. It supports authentication protocols like OAuth, making it suitable for multi-user environments. Auditing is easier with standardized trace headers. The tools/list interface allows agents to discover available tools dynamically, a key advantage for platforms with evolving tool sets.

Deferred tools narrow the MCP-CLI gap but do not surpass it

With deferred tools (defer_loading: true), MCP can reduce tool definition overhead in initial context by about 85% by only providing tool names and brief descriptions, loading schema on demand. This reduces MCP's token disadvantage but does not beat CLI's near-zero schema cost for well-known tools.

Model tool calling improvements benefit both, but MCP gains more

As models get better at constructing commands (CLI) and handling structured schemas (MCP), both improve. However, MCP benefits more because CLI's main advantage was the model's prior knowledge; as schema learning improves, the gap narrows. For unfamiliar tools, MCP's structured interface becomes increasingly valuable.

Scenario-based recommendations for CLI vs MCP

CLI is better when: model already knows the tool, local execution, pipeline tasks, token conservation, debugging, CI/CD with fixed commands. MCP is better when: no terminal access (browser/mobile), multi-user auth, unknown tools, audit/regulatory compliance, dynamic tool discovery. For complex cross-service orchestration (e.g., test → Jira → Slack), MCP's chain offers advantages.

Source posts