The difference between MCP and API explained with one example: who each is built for, why agents need more than your OpenAPI spec, and when to use both.
Introduction
In Part 1, we looked at what MCP is: a host, its clients, and servers that expose tools, resources, and prompts. We walked through a simple calculator MCP server and saw what a tools/call request looks like on the wire.
If you have built backend systems for a while, one question probably came up while reading it: Why MCP? Why **not**** just use the API?** Most MCP servers call an API under the hood anyway. So why not hand the agent your API directly?
That is what this article answers. We will look at what each one is designed for, put the same calculator behind both a REST endpoint and an MCP tool, and compare them side by side. By the end, you should know whether MCP replaces your API, complements it, or neither.
Prerequisite: You should have read Part 1, or at least know what a host, client, and MCP server are. Basic familiarity with REST APIs is assumed.
What an API Is For
An API (Application Programming Interface) is a contract your service exposes so other software can use it. Most of the time it is an HTTP API: endpoints, methods, request bodies, status codes, often described in an OpenAPI document.
The key word is software. An API is designed for programs written by developers. A developer reads the docs once, decides which endpoints to call and in what order, writes the code, handles the errors, and ships it. After that, the program calls the API the same way every time. Nothing about the API has to explain itself at runtime, because a human already did the understanding at build time.
That assumption is exactly what breaks when the caller is a language model.
Same Calculator, Two Interfaces
Let's take the calculator from Part 1 and expose it both ways.
As a REST API
A typical endpoint looks like this:
POST /calculate HTTP/1.1
Content-Type: application/json
{ "operation": "divide", "a": 1250, "b": 0 }
And when something goes wrong, the API answers the way APIs always do:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{ "error": "DIVISION_BY_ZERO" }
That is a perfectly good response for a program. The developer saw DIVISION_BY_ZERO in the docs months ago and wrote an if statement for it.
As an MCP tool
The MCP server exposes the same logic as a tool. The client gets this definition at runtime from tools/list:
{
"name": "calculate",
"description": "Performs basic arithmetic on two numbers. Use it whenever an exact result is needed instead of estimating.",
"inputSchema": {
"type": "object",
"properties": {
"operation": { "type": "string", "enum": ["add", "subtract", "multiply", "divide"] },
"a": { "type": "number" },
"b": { "type": "number", "description": "Second operand. Must not be 0 when operation is divide." }
},
"required": ["operation", "a", "b"]
}
}
And the same failure comes back as a normal result the model can read:
{
"content": [
{ "type": "text", "text": "Cannot divide by zero. Ask the user for a non-zero divisor, or use a different operation." }
],
"isError": true
}
The logic underneath is identical. What changed is who the interface is written for. The REST response assumes a developer already knows what DIVISION_BY_ZERO means. The MCP result assumes nobody has read anything, so it explains itself and suggests what to do next.
The Key Differences
| API | MCP | |
|---|---|---|
| Designed for | Programs written by developers | Language models inside AI applications |
| How capabilities are found | Docs or an OpenAPI file, read at build time |
tools/list, read at runtime |
| Who decides what to call | The developer, in code | The model, per conversation |
| Unit of design | Endpoint | Tool, resource, or prompt |
| Who holds the credentials | The calling program | The MCP server; the model never sees them |
| Errors | HTTP status codes and error bodies | Results with isError: true the model can read |
| Typical size | Tens to thousands of endpoints | Best kept small |
Let's take a closer look at three of these rows.
Discovery happens at runtime. A program never asks an API "what can you do?" A developer answered that question once, while writing the code. An MCP client asks every server what it offers, and the model decides what to use in the middle of a conversation. That is why the description of a tool carries so much weight: it is the only documentation the model ever reads.
The model decides the order of calls. In an API integration, the sequence is fixed in code: create the customer, then the invoice, then send it. With MCP, the model plans that sequence itself, based on what the user asked. Your interface has to make good plans easy and bad plans hard.
Size costs tokens. Every tool definition is sent to the model as context. An API with 300 endpoints is normal. An MCP server with 300 tools fills the model's context with schemas before the user has typed anything, and some clients cap it anyway. VS Code, for example, allows at most 128 tools per request across all servers.
Why Not Just Give the Agent Your API?
You can. Take your OpenAPI file, turn each endpoint into a function definition, and pass them to the model with function calling. For a small API inside your own app, that works fine.
It starts to break as things grow:
- The spec does not fit. Large OpenAPI documents are huge. Scalar measured Zoom's Meetings API spec at about 296,000 tokens, more than a 200,000-token context window on its own.
-
Endpoints are too fine-grained. A user says "invoice Adeola for last month's usage". Through raw endpoints, the model has to find the customer, fetch usage, create a draft invoice, add line items, and finalize it, in the right order, with the right IDs. Every extra step is another chance to get it wrong. One
create_invoice_for_usagetool does the same job in one call. - The credentials have nowhere safe to live. If the agent calls your API directly, the API key sits inside the agent's loop. With MCP, the server holds the credentials and the model only ever sees tool names and results.
- Nobody else can reuse it. Your function-calling setup lives inside your app. The same integration has to be rebuilt for Claude, Cursor, VS Code, and every other host. That is the N Γ M problem from Part 1 again.
Function calling is not the enemy here. It is how the model asks for a tool in the first place. MCP just standardizes where those tool definitions come from and who runs them, so the same server works in every host.
MCP Complements Your API Rather Than Replacing It
An MCP server is usually a thin layer on top of the API you already have. Your web app, mobile app, and partners keep calling the API directly. AI hosts talk to the MCP server instead, and the MCP server calls the same API underneath.
The API stays the single source of truth for your business logic. The MCP server adds what a model needs and a program never did: self-describing tools, task-shaped operations, credentials kept out of the model's reach, and errors written to be read.
In our calculator example, the MCP server's calculate tool could simply call POST /calculate and translate the DIVISION_BY_ZERO response into a message the model can act on. Nothing in the API had to change.
When to Reach for Which
Build or keep an API when the caller is code: your web and mobile apps, partner integrations, webhooks, SDKs, data pipelines, and service-to-service calls. These callers need a stable, versioned contract and predictable behaviour. A model in the loop would only add cost and uncertainty.
Add an MCP server when your users want to work with your product through an AI application, or when you are building an agent that needs tools. Start small: a handful of task-shaped tools that cover the jobs people actually ask for, not one tool per endpoint.
Skip MCP when the integration lives inside a single app you control and nobody else will reuse it. Plain function calling against a few internal functions is simpler, and that is fine.
For most products, the honest answer is both: the API stays the foundation, and MCP becomes one more client of it, built for a new kind of caller.
Conclusion
MCP does not replace your API. It sits on top of it.
An API is written for developers who understand it once and hard-code the rest. An MCP server is written for a model that understands nothing until runtime, so it has to describe itself, keep its tool list small, hold the credentials, and return errors the model can act on.
Next up is Part 3: What changed in the new MCP version. We will look at why sampling, roots, and logging were deprecated in the 2026-07-28 spec, and what to use instead.
References
- Scalar: MCP vs API
- Scalar: MCP vs function calling
- MCP tools specification (2026-07-28)
- Model Context Protocol: official documentation and specification
ββββββββββββββ
For more articles, follow my social handles:

Top comments (0)