If your agent has a shell, give it a command line

MCP vs CLI for AI agents comes down to one question: does the agent have a shell? If it does, as in Claude Code, Codex or Cursor, a well-built command line is usually the better interface. It loads only what the agent needs, it composes with everything else in the shell, and you can run every command yourself. If the agent has no shell, as in a chat app, MCP is the way in. We built Time Momentum's agent access as a command line, tm, and decided against an MCP server. This guide explains why, and where that choice would be wrong.

As of 10 Oct 2026

What MCP is

The Model Context Protocol is, in its own words, “an open-source standard for connecting AI applications to external systems” (modelcontextprotocol.io). The project compares it to a USB-C port: one plug for many devices.

The current specification, version 2026-07-28, defines hosts (the AI application), clients (the connectors inside it) and servers (the services that provide data and tools), talking JSON-RPC. A server can offer resources, prompts and tools. Tools are what agents use most: the client asks the server for its list with tools/list, and each tool comes with a name, a description and a JSON Schema for its input.

CLI design for AI agents: what makes a command line agent-friendly

A command line is not automatically good for agents. It needs a few properties that humans rarely ask for:

  • It describes itself as data: --help and a full command catalog as JSON, so the agent never has to guess flags.
  • Output is a contract: with --json, exactly one JSON document on stdout, errors as JSON on stderr.
  • Exit codes carry meaning: fix the call, ask the human, wait, retry. One number tells the agent what to do next.
  • It never waits for input it cannot give: without a terminal, nothing prompts. Destructive steps need an explicit flag such as --yes.
  • It can show instead of act: --dry-run prints the exact request without sending it.
  • Secrets stay out of the output, also with --verbose and --dry-run, because whatever the agent sees ends up in its context.
  • It is easy to install anywhere an agent runs, ideally without a dependency tree.

MCP vs CLI for AI agents at a glance

QuestionMCP serverAgent-friendly CLI
Context used before the first callpartlyOften every definitionOnly on request
Results combine without the model–Via the modelPipes, jq, scripts
You can repeat what the agent didpartlyInspectorSame command
Version can be pinnedpartlyServer decides
Works in agents with a shellpartlyIf the client supports it
Works in chat apps without a shell–
Standard discovery and sign-intools/list, OAuth–Own convention

As of: 10 Oct 2026

Context: definitions up front or on demand

Anthropic's engineering team described the problem in November 2025: “Most MCP clients load all tool definitions upfront directly into context”, and those descriptions increase response time and cost (Code execution with MCP). Their recommendation is to let the model read tool definitions on demand.

To be fair, clients are catching up. Claude Code now defers MCP tools by default: at session start only tool names and server instructions load, and the full definition comes when Claude searches for the tool (MCP tool search). Other clients may still load everything.

A CLI gets on-demand loading for free, because nothing is in context until the agent runs a command. We measured how much is there to load in tm 0.3.0: the complete catalog (tm schema --json) is 377,203 characters, the overview of all command groups (tm --json) 32,110, the invoices group 104,009. A single command has a median of 934 characters across 157 commands. Method: npx -y @time-momentum/cli@0.3.0 schema --json | wc -c and the same for the other calls, on 10 Oct 2026.

The catalog is not small. That is the point: the agent decides what to load, usually one group or one command.

Composability: pipes, jq and scripts

With MCP, “every intermediate result must pass through the model”, as the same Anthropic article puts it. A list of 500 invoices that the agent only needs to count still lands in its context.

In a shell, the agent filters before it reads. tm payments outstanding --json | jq '[.data[].summary.outstanding_micros] | add / 1000000' returns one number: the outstanding total in euros. tm invoices list --all --json | jq '[.data[] | select(.status == "draft")] | length' counts drafts across all pages. The same lines work in a cron job or a shell script, without any agent.

Authentication: OAuth or API key

In MCP, authorization is optional. Remote servers over HTTP should follow the specification's OAuth 2.1 flow; local servers over stdio take their credentials from the environment. For a chat app where every user signs in with their own account, OAuth is the more comfortable option.

A CLI usually works with an API key. That is simple, but it needs care: the key must never show up in what the agent reads. tm keeps it in a local file with mode 600 or an environment variable, exchanges a write key for a token valid for one hour and never prints the key, not even with --verbose or --dry-run. A token from that exchange cannot create new keys or delete the account.

Testability: dry run and the same command for you

Every call an agent makes through a CLI is a line you can copy, read and run yourself. --dry-run goes one step further and shows method, URL and body without sending anything. That makes the agent's work reviewable before it happens, which matters most for invoices.

MCP has tooling for this too, such as the MCP Inspector for developers. But a tool call is not something you type into your own terminal to see what happens.

Versioning: pin it or let it move

A CLI is a package with a version. You can pin it (npx -y @time-momentum/cli@0.3.0), roll back (tm update --to <version>) and know that a script that worked yesterday works today. When the API changes in a way an old version would get wrong, the server rejects that version with a clear error and the update command.

MCP versions the protocol by date and lets servers announce changes to their tool list at runtime. A remote server decides for itself which tools you get today. That is convenient as long as nothing breaks.

Reach: every agent with a shell

Claude Code, Codex, Cursor and most coding agents can run shell commands. A CLI works in all of them without the client having to support anything else, in sandboxes and CI as well.

Where MCP is the better choice

  • Clients without a shell. claude.ai, Claude Desktop and the Claude mobile apps reach external tools through connectors, which are MCP servers (Claude docs). A CLI cannot help there.
  • Standard discovery. Every MCP server answers tools/list the same way, and the official MCP Registry lists servers. Every CLI documents itself in its own way.
  • Sign-in per user. OAuth lets each person connect their own account without handling a key.
  • Non-technical users. Adding a connector in a chat app is easier than installing a command line.

How Time Momentum does it

Our users' agents already work in a shell, on client projects. So Time Momentum has no MCP server. It has tm, a command line that runs the whole product: effort, clients, orders, projects, invoices and e-invoices, payments, timesheets and profitability.

tm has no runtime dependencies. Every operation of the REST API that is meant for the command line has exactly one command, 143 operations in version 0.3.0, and a test enforces that with every API change. tm skill returns the usage guide that matches the installed version. In Claude Code, tm skill --install adds a short skill that points to it, and Time Momentum is also available as a Claude Code plugin.

Issuing or cancelling an invoice and deleting need an explicit --yes. Without a terminal, tm stops otherwise.

More on this topic

  • For AI agents

    What your agent can do in Time Momentum through tm, the security model and how to set it up.

    For AI agents
  • Business software for AI agents

    How to tell whether software lets your agent work safely with clients, invoices and payments.

    Read guide

Let your agent run the billing from the shell

  • 30 days of Pro
  • No credit card
  • Then continue on Free

Frequently asked questions

Is a CLI or an MCP server better for AI agents?

For agents with a shell, such as Claude Code, Codex or Cursor, a well-built CLI is usually better: it loads only what the agent asks for, results can be filtered with pipes before the model reads them, and you can repeat every call yourself. For chat apps without a shell, MCP is the only option.

Do MCP tool definitions use up the context window?

In many clients, yes: Anthropic wrote in November 2025 that most MCP clients load all tool definitions up front. Claude Code now defers them by default and loads only tool names at the start.

What makes a CLI agent-friendly?

A machine-readable command catalog, exactly one JSON document per call, errors as JSON, meaningful exit codes, no interactive prompts without a terminal, an explicit confirmation flag for destructive steps, a dry run and no secrets in the output.

Does Time Momentum have an MCP server?

No. Agents use the command line tm, which covers every API operation meant for it. Claude Code also gets a skill and a plugin.