DEV Community

Cover image for MCP vs API: one task took 5 operations direct and 9 through MCP
System Design Simple
System Design Simple

Posted on Originally published at systemdesignsimple.com

MCP vs API: one task took 5 operations direct and 9 through MCP

For MCP vs API, direct tool calls are usually simpler when you control one AI app and its API integration. MCP provides a shared discovery and invocation interface when compatible hosts need those tools. In a scripted simulation run on 2026-11-15, one task took 5 operations when the app called the API directly and 9 when the same calls went through MCP.

Who calls the API when an AI uses a tool {#who-calls}

Definition

MCP (Model Context Protocol): a JSON-RPC 2.0 protocol in which an MCP server exposes tools, each with a name, a description and a JSON Schema for its input, and an MCP client in the AI app lists them with tools/list and runs them with tools/call.

The model never makes the call. It produces a tool-call request with a tool name and arguments, for example get_open_orders with customer_id: "cust_017", and the host app executes it. This demo represents that request as JSON text. Without MCP, the app runs its own adapter code and calls the API. With MCP, the app hands the request to its MCP client, which sends tools/call to the MCP server, and the server calls the API.

The demo checks this: every request to the mock API records its caller. In all three runs the model made 0 calls. The app sent the requests in the direct runs, and the MCP server sent them in the MCP run. The MCP tools page shows the same flow: the client discovers tools, the model selects one, the client invokes it (MCP Tools, 2025-06-18).

What the demo counted {#test}

The script labs/ai-32/compare-mcp-vs-direct-api-steps-and-tokens.mjs runs one task, "get my open orders and email me a summary", against the same mock shop API three ways. The model is a scripted stub, so every run makes the same choices. It ran on one Mac with Node 22 and seed 32; the output is the same every time.

Path Model calls API calls MCP requests Simulated request/reply operations
A. Fixed workflow: app code calls the API, the model only writes the summary 1 2 0 3
C. Model picks tools, app calls the API directly 3 2 0 5
B. Model picks tools, calls go through MCP 3 2 4 9

Counts exclude transport acknowledgments. C and B are the fair comparison, with the same tool definitions, prompts and turns. The script checks that their prompts are byte-identical on every turn, so the model reads the same text either way and only the route of each call changes.

Lab terminal output: the model made 0 API calls; round trips 3 for the fixed workflow, 5 direct and 9 through MCP; model text 282, 2,157 and 2,157 estimated units; MCP adds 4 round trips and 2,628 JSON-RPC bytes
The lab's printed summary, run on one Mac with Node 22. In-process simulation; no network or latency measured. Captured 2026-11-15 in Chrome. Source: labs/ai-32/capture-output-in-chrome.mjs.

Which 4 requests MCP adds {#extra}

Definition

Round trip: one request that waits for a reply. In this demo that is a model call, an HTTP call to the API, or a JSON-RPC request between the MCP client and server.

Request Why it exists How often
initialize Agrees on the protocol version and capabilities; the spec says it MUST be the first interaction once during session initialization
notifications/initialized Tells the server the client is ready; a notification gets no reply, so it is not counted once during session initialization
tools/list Discovers the tools and their schemas once in this demo; real clients may fetch more pages or refresh after notifications/tools/list_changed
tools/call Runs one tool once per tool use (2 here)

The lifecycle rules come from the MCP lifecycle page: the client sends initialize, the server answers with its capabilities, then the client sends notifications/initialized. The JSON-RPC traffic for all of this came to 2,628 bytes in the simulation.

initialize and tools/list are setup costs. initialize runs once during session initialization, and an MCP session is not the same thing as an HTTP transport connection. This demo makes one unpaginated tools/list request after initialization, though real clients may need further pages or refreshes. Once initialized, a session can serve many tasks. Each tool use still pays one tools/call, one hop more than the direct adapter, which runs inside the app.

Why tool selection increased model text in this demo {#orchestration}

Compare A with C, both on the direct API with no MCP anywhere. Letting the model pick tools took 2 more model calls and raised the estimated model text from 282 to 2,157 units. Of the 1,875 extra units, 1,227 were tool definitions sent again on each of the 3 model calls (409 per call). The remaining 648 units are the net difference from changed prompts and outputs, including repeated system text, history and generated tool calls.

Fixed workflow (A) Model picks tools (C) Through MCP (B)
Model text, estimated units 282 2,157 2,157
Of which tool definitions 0 1,227 1,227

The units come from a simple built-in estimate, not a real tokenizer, so only the comparison between paths means anything. Routing through MCP changed the model text by 0 units; the jump came from letting the model pick tools, and this script resends both definitions on every turn. For a task that is always "fetch orders, then email", the fixed workflow used fewer estimated text units; billing was not measured. We covered why agents resend their history in why an AI agent re-sends its history.

What we saw when we ran it {#we-ran-it}

We ran node labs/ai-32/capture-output-in-chrome.mjs on our Mac on 2026-11-15 at 06:23 UTC. The script saved the screen it captured in Chrome as a 1400x808 image, once as a PNG in the lab folder and once as the WebP below.

Output of our ai-32 run: node capture-output-in-chrome.mjs

The image the capture script saved from Chrome on 2026-11-15.

Screenshot of the official page: Model Context Protocol specification 2025-06-18

The official Model Context Protocol specification page we list as a source.

That page confirms the base of our definition: MCP clients and servers talk to each other in JSON-RPC messages.

A minimal simulated MCP client {#code}

This is the client half of the demo, trimmed. It is simulation code: pipe.send passes one JSON-RPC message to a server in the same process and returns its reply.

// mcp-client.mjs (simulation code from labs/ai-32, trimmed)
class McpClient {
  constructor(pipe) { this.pipe = pipe; this.nextId = 1; }
  request(method, params) {
    const reply = this.pipe.send({ jsonrpc: '2.0', id: this.nextId++, method, params });
    if (reply.error) throw new Error(`${method}: ${reply.error.message}`);
    return reply.result;
  }
  connect() {                                   // once per session
    this.request('initialize', { protocolVersion: '2025-06-18', capabilities: {},
      clientInfo: { name: 'lab-host-app', version: '0.1.0' } });
    this.pipe.send({ jsonrpc: '2.0', method: 'notifications/initialized' }); // no id, no reply
  }
  listTools() { return this.request('tools/list', {}).tools; }        // discovery; may paginate or refresh
  callTool(name, args) { return this.request('tools/call', { name, arguments: args }); } // per tool use
}
Enter fullscreen mode Exit fullscreen mode

Run node compare-mcp-vs-direct-api-steps-and-tokens.mjs in labs/ai-32 (Node 22, no install, no network; git clone https://github.com/systemdesignsimple/labs first). The trace prints who talks to whom, step by step; look for JSON-RPC tools/call get_open_orders and the line calls made by the model: 0.

A production client checks more than the JSON-RPC error field. After initialize it compares the protocolVersion the server returned with the versions it supports, and the lifecycle page says it SHOULD disconnect if there is no match. It calls tools/list only if the server declared the tools capability. A tool that runs and fails returns a normal result with isError: true (tool errors), and the snippet returns that result without checking isError; the host must inspect the flag and preserve the failure status when forwarding the result to the model. Every request also needs a timeout. For send_email a timeout leaves the outcome unknown, because the email may already be out, so the API needs duplicate-send protection, such as an idempotency key, before the client retries.

MCP vs API: when should you use MCP? {#when}

The direct path is simpler when no other app needs the tools. MCP's extra requests pay for a shared interface: compatible hosts can reuse the server's tool interface after configuration and authorization, without new adapter code in each one. Our tool discovery article shows a client picking up new apps through tools/list alone.

Situation Call the API Run an MCP server
One AI app, one API, you own both simplest, fewest hops adds a client-server boundary; this simulation adds four requests
Several compatible AI apps need the same tools an adapter in each app one server they can all reuse
Your own non-AI apps reuse the logic a shared API client library not needed for this
The workflow is always the same steps a fixed workflow used fewer model calls and estimated text units in this simulation not needed for this

Your own apps can get that reuse from a shared API client library, without MCP. What MCP adds is that compatible AI apps you did not write can use the tools too.

Whichever route you pick, the tools page asks for a human in the loop who can deny tool calls, and confirmation prompts before sensitive operations. See would an AI agent delete my files for that side.

What this demo does not show {#limits}

This simulation did not test reuse across compatible hosts.

Our take {#our-take}

If one AI app you control talks to one API, call the API: the demo needed 5 operations instead of 9. Add an MCP server when several compatible AI apps need the same tools, and reuse an initialized MCP session across tasks where the client and transport support it. Before either, ask whether the model needs to pick tools at all, because that choice cost more text than MCP did.

This article describes general patterns with a small simulation. It does not describe any company's private systems or measure any AI product. Numbers come from one run on 2026-11-15 with a scripted model.

Top comments (1)

Collapse
 
timmyzinin profile image
Tim Zinin •

The largest model-text difference in the trace comes from resending tool schemas, while MCP routing leaves that count unchanged. Could a follow-up measure whether a lightweight tool index plus on-demand schemas lowers total model text once the extra selection turn is counted?