The MCP vs direct API question has numbers behind it now. A benchmark of one three-operation task service on Node.js 22 compared direct HTTP calls, a local CLI and an MCP server. Latency barely separates MCP from direct calls. Prompt tokens and security boundaries do.
When MCP’s integration math works
MCP’s pitch is arithmetic. With M AI apps and N external systems, custom connectors cost M times N. A shared protocol cuts that to M plus N, because each host ships one client and each system ships one server.
That holds when many hosts talk to many systems. A team building an assistant inside its own web app has one host, its backend. The backend already runs the prompt loop and talks to Postgres, billing and internal services. Direct tools need N adapters. MCP needs a client plus N servers, with transports, tokens and schema versions to maintain.
MCP pays off when the integration crosses an ownership or runtime boundary. One case is exposing a product to third-party AI hosts. The other is using several hosts on one machine and configuring an authenticated integration once.

What the benchmark measured
All three adapters hit the same local HTTP service. The MCP vs direct API test recorded latency, startup time, glue code and prompt tokens, counted with OpenAI’s gpt-4.1-mini.
- Direct fetch(): 14 lines of glue, about 0.42 ms median per call, 133 prompt tokens for three tools.
- Local CLI: 16 lines of glue, 84.7 ms per call (p95 109.72 ms), 52 prompt tokens because the model sees one shell tool.
- MCP over stdio, three tools: 38 lines of glue, 54.1 ms cold start, near direct-call latency afterward, 133 tokens.
- MCP over stdio, 15 tools: 901 prompt tokens per turn, a 6.8x jump.
The stdio server stays alive for the session, so the 54.1 ms is paid once. Launching with npx -y is slower: earlier tests saw 317 to 341 ms warm and 518 ms on a cold cache.

Where the CLI’s startup cost bites
A CLI forks a new process on every call, roughly 200 times slower than an in-process fetch. In a chat where a model spends 2 to 10 seconds per turn, 84.7 ms is under 2 percent. In a loop of 50 calls it adds 4.23 seconds, against about 21 ms for direct or warm MCP calls. Python CLIs with heavy imports can cost 300 to 600 ms per call.
Remote MCP over HTTP adds a network hop to every call. A public server tested from Italy took 209 to 289 ms to list tools and 487 to 522 ms for one search.
The context window tax
Tool definitions are resent on every turn. Over 20 turns, the CLI costs 1,040 schema tokens, a three-tool setup 2,660, and a 15-tool MCP server 18,020.
Real servers are bigger. In Claude Code, four of them took 56,054 tokens before any user message:
- Railway: 71 tools, 37,264 tokens
- Borumi video editor: 49 tools, 13,394 tokens
- Polar: 5 tools, 3,264 tokens
- Claude Docs: 8 tools, 2,132 tokens
Prompt caching cuts the price but not the space those tokens occupy. Long menus also make tool selection less accurate, and tool lists that change mid-session break the cached prefix. Claude Code now defers MCP schemas behind a search tool. On that setup it loaded 631 tokens upfront and left 55.4k to be fetched on demand, at the price of one extra model turn.
Credentials, errors and debugging
Direct calls give the cleanest multi-tenant boundary. The server takes user and workspace IDs from the session, so a prompt injection cannot ask for another customer’s account.
A CLI runs under the user’s OS account and often reads environment variables or dotfiles. A shell tool plus injected text can tell the model to print those secrets. MCP isolates credentials per server, and remote servers use OAuth 2.1 with per-user tokens. Tool annotations such as readOnlyHint are advisory only, so server-side checks are still needed.
Direct code is easiest to unit test and trace. A CLI is next, since a failing command can be pasted into a terminal. MCP is harder: on stdio, one stray console.log corrupts the JSON-RPC stream, so logs must go to stderr. MCP also has three version axes (protocol revision, SDK and server schemas), so pinning package versions and diffing tools/list on upgrades is sensible.
Mixing the three
The benchmark’s author suggests hybrids. One is deferred tool discovery through a gateway. Another is coarse workflow tools instead of one tool per endpoint, or Code Mode, where the model writes a short script. In one test, Code Mode cut a link check across 8 Markdown files from 35 seconds to 15. The third is one core service with thin adapters: direct calls for the web app, a –json CLI for local agents and a focused MCP server for outside hosts.
Which to pick for a new project
In the MCP vs direct API choice, if you own the host, call the API directly and expose only 3 to 5 tools per workflow state. If agents have a shell and each command stands alone, ship a CLI with –json output. Choose MCP for portability across hosts, isolated credentials, protocol-level approvals or long stateful sessions, and keep its tool list short. Anyone adding MCP to a single-host app should expect 38 lines of glue where 14 would do.
Source: flaviocopes.com