# MCP vs API: What's the Difference and When to Use Which

> MCP vs REST API vs function calling: a comparison table, one service built both ways with tested code, the token cost of tool definitions, and when to skip MCP.
> Author: Roman Belov · Published: 2026-11-08 · Source: https://futurecraft.pro/blog/mcp-vs-api/

An API is an interface one program uses to call another. MCP (Model Context Protocol) is an open protocol an AI application uses to find out which tools a server has and to call them. In the MCP vs API comparison, what matters is who decides to make the request: a developer wrote the API call, while the model picks the MCP tool. MCP doesn't replace APIs. An MCP server usually sits in front of the same REST API and describes it to the model.

That gives a short rule. If code makes the call, use an API. If a model inside one application of yours makes the call, an API plus function calling is enough. If the same tools are needed in Claude Code, Codex, ChatGPT and your own agent, write an MCP server on top of the API.

This article draws the lines between REST, function calling and MCP. One service is built both ways and run, with responses, errors and definition sizes measured. Specification links point to revision 2026-07-28, and the data is as of November 29, 2026.

## What is an API and what is MCP

An API (most often HTTP REST) answers the question of how to reach a service: address, method, parameters, response format. It doesn't care who is calling or why. The client can be a browser, cron, a neighboring microservice or an AI agent.

MCP, in the [project's own definition](https://modelcontextprotocol.io/docs/2026-07-28/getting-started/intro), is "an open-source standard for connecting AI applications to external systems". It standardizes a narrow stretch: how a host (Claude Code, Codex, your own agent) gets the list of tools, data and prompt templates and uses them. The specification calls tools [model-controlled](https://modelcontextprotocol.io/specification/2026-07-28/server/tools): the model finds and calls them on its own, though the same page recommends keeping a human able to deny the call.

Transports, primitives and client setup aren't covered here. They're in [MCP servers explained](https://futurecraft.pro/blog/mcp-servers-explained/).

## MCP vs API vs function calling: comparison table

MCP gets compared with REST, although function calling is the closer relative: there, too, the model picks the call. So the table has three columns.

| Criterion | REST API | Function calling | MCP |
|---|---|---|---|
| Who decides to call | The developer, in code | The model | The model |
| Who executes | The API client | Your application | The host sends `tools/call`, the MCP server executes |
| How capabilities are discovered | Documentation or OpenAPI, outside the protocol | The application puts schemas in the request | `tools/list` in the protocol itself |
| Schema | OpenAPI, JSON Schema | JSON Schema: `input_schema` at Anthropic, `parameters` at OpenAI | JSON Schema in `inputSchema`, 2020-12 by default |
| State | Usually stateless | The application keeps the history | No protocol session since 2026-07-28, state goes through an explicit handle in the arguments |
| Authorization | Anything: key, OAuth | Model API key plus your code's permissions | Optional; an OAuth 2.1 based profile for HTTP, credentials from the environment for stdio |
| Version | In the URL or a header | Provider's API version | Revision date in every request |
| Context cost | None until a response is passed to the model | Schemas in input tokens | The same schemas, from every connected server |
| Where it's reusable | Any client | One application | Any compatible AI client |

Sources for the MCP rows: [tools](https://modelcontextprotocol.io/specification/2026-07-28/server/tools), [authorization](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization) and the [changelog](https://modelcontextprotocol.io/specification/2026-07-28/changelog) of revision 2026-07-28. The function calling column was checked against the [Anthropic](https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works) and [OpenAI](https://developers.openai.com/api/docs/guides/function-calling) documentation. The REST column describes common practice.

The state row is often out of date in other comparisons. Before revision 2026-07-28, the client started with an `initialize` handshake, and an HTTP server could issue an `Mcp-Session-Id`. Both are [now gone](https://modelcontextprotocol.io/specification/2026-07-28/changelog): every request carries the version and client capabilities in `_meta`. In shape, a tool call is now closer to an ordinary HTTP request.

## One service as REST and as MCP

The example service returns an order status. The run was done on November 29, 2026 on macOS with Python 3.13.9, `mcp` 2.3.0 and Starlette 1.10.0. Both servers ran on 127.0.0.1.

### Shared logic and the REST version

```python
# orders.py
ORDERS = {
    "A-1001": {"status": "shipped", "eta_days": 2},
    "A-1002": {"status": "processing", "eta_days": 5},
}


def order_status(order_id: str) -> dict[str, str | int]:
    return {"order_id": order_id, **ORDERS[order_id]}
```

```python
# rest_app.py
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.routing import Route

from orders import order_status


async def get_order(request: Request) -> JSONResponse:
    try:
        return JSONResponse(order_status(request.path_params["order_id"]))
    except KeyError:
        return JSONResponse({"error": "order not found"}, status_code=404)


app = Starlette(routes=[Route("/orders/{order_id}", get_order)])
```

### The MCP version

```python
# mcp_app.py
from mcp.server import MCPServer
from mcp.server.mcpserver.exceptions import ToolError

from orders import order_status

mcp = MCPServer("orders", version="1.0.0")


@mcp.tool()
def get_order_status(order_id: str) -> dict[str, str | int]:
    """Return status and ETA in days for an order id, for example A-1001."""
    try:
        return order_status(order_id)
    except KeyError:
        raise ToolError("order not found")


if __name__ == "__main__":
    mcp.run(transport="streamable-http", port=8942)
```

The logic is the same. What's new is a name, a description for the model, and argument types the SDK turns into JSON Schema. The description is part of the interface here: the model uses it to decide whether the tool fits. Result types matter too. In a separate run on the same SDK, `structured_content` stayed empty with a `-> dict` annotation and was filled with `-> dict[str, float | str]`.

### What came back

Start the servers in two terminals. You don't need to install Starlette, uvicorn and httpx2 separately: they come in as `mcp` dependencies.

```bash
python -m uvicorn rest_app:app --host 127.0.0.1 --port 8941
python mcp_app.py
```

The REST request fits on one line. The tool call is a single POST with no handshake:

```bash
curl http://127.0.0.1:8941/orders/A-1001

curl http://127.0.0.1:8942/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'MCP-Protocol-Version: 2026-07-28' \
  -H 'Mcp-Method: tools/call' -H 'Mcp-Name: get_order_status' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
    "name":"get_order_status","arguments":{"order_id":"A-1001"},
    "_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28",
      "io.modelcontextprotocol/clientInfo":{"name":"raw","version":"0"},
      "io.modelcontextprotocol/clientCapabilities":{}}}}'
```

| Situation | REST | MCP |
|---|---|---|
| Order found | HTTP 200, 53-byte body | HTTP 200, 350-byte body |
| No such order | HTTP 404, `order not found` | HTTP 200, `isError: true`, "Error executing tool get_order_status: order not found" |
| Argument missing | No separate case, the id is in the path | HTTP 200, `isError: true`, validation error text |
| List of capabilities | `/openapi.json` returned 404, you have to add a description yourself | `tools/list`: 593 bytes with the description and schemas |

The MCP response is longer partly because the SDK includes the data twice: as text for the model and as an object in `structuredContent`. The specification recommends this for backwards compatibility. Only bodies were counted, without headers, and the ratio will be different on a large response.

The second difference matters for monitoring. A tool error arrives with HTTP 200, so a dashboard built on status codes won't see it. That's intentional: [per the specification](https://modelcontextprotocol.io/specification/2026-07-28/server/tools), execution errors are returned in the result so the model can read the text and fix its arguments. An unknown tool, for example, counts as a protocol error. In the run, SDK 2.3.0 answered it with `isError: true`, while the example in the specification uses code -32602, so a client shouldn't rely on the code alone.

The third difference is the number of requests. The stock `mcp.Client` sent four POSTs for two tool calls: `server/discover`, `tools/call`, `tools/list`, `tools/call`. The author didn't measure latency.

## Function calling vs MCP

These mechanisms cover different links of one chain.

1. The application requests `tools/list` from the MCP server.
2. The application passes the schemas to the model in the `tools` parameter.
3. The model returns a tool name and arguments.
4. The application sends them to the server through `tools/call`.
5. The result goes back to the model, and it continues the answer.

Steps 2, 3 and 5 are function calling, steps 1 and 4 are MCP. The model runs nothing itself: Anthropic's documentation calls tool use a contract in which the model emits a structured request, and your code or Anthropic's servers run the operation. Without MCP, steps 1 and 4 become your own code: the list of schemas lives in the repository, and the call goes to a function. The `tool_use` and `tool_result` loop itself is shown in the [Claude API guide](https://futurecraft.pro/blog/claude-api-developer-guide/).

### How an MCP schema becomes tools

The conversion takes a few lines, because both formats are built on JSON Schema:

```python
import asyncio

from mcp import Client

from mcp_app import mcp


async def main() -> None:
    async with Client(mcp) as c:
        tools = (await c.list_tools()).tools
        anthropic_tools = [
            {"name": t.name, "description": t.description or "", "input_schema": t.input_schema}
            for t in tools
        ]
        # OpenAI Responses API: {"type": "function", "name", "description", "parameters": t.input_schema}
        block = {"id": "toolu_demo", "name": "get_order_status", "input": {"order_id": "A-1001"}}
        out = await c.call_tool(block["name"], block["input"])
        print(anthropic_tools)
        print({"type": "tool_result", "tool_use_id": block["id"],
               "content": out.content[0].text, "is_error": out.is_error})


asyncio.run(main())
```

The `tool_use` block in the example is written by hand, and no model was called in the run: it checked the schema conversion and the call execution.

Providers also offer a ready-made path without your own client. OpenAI connects a remote server with the [`mcp` tool](https://developers.openai.com/api/docs/guides/tools-connectors-mcp) in the Responses API and by default asks for approval before sharing data. Anthropic has the [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector): as of November 29, 2026 it's in beta, supports only tool calls, requires a public HTTP server, and isn't eligible for zero data retention.

## How many tokens tool definitions cost

REST doesn't have this cost: the model never sees the API until you pass it a response. It does see tool definitions, and they count as billed input under function calling and MCP alike. MCP just makes it easy to pile up a lot of them. Where the cost comes from is covered in the articles on [tokens](https://futurecraft.pro/blog/tokens-explained/) and the [context window](https://futurecraft.pro/blog/context-window/).

| What was counted | Tools | Tokens | Source |
|---|---|---|---|
| `get_order_status` from the example | 1 | 79 | author's measurement, 11/29/2026, o200k_base |
| Playwright MCP 0.0.86, defaults | 25 | 4,640 | author's measurement, 11/29/2026, o200k_base |
| Playwright MCP 0.0.86 with six extra groups | 71 | 9,969 | same |
| Slack MCP | 11 | ~21K | Anthropic, 11/24/2025 |
| GitHub MCP | 35 | ~26K | Anthropic, 11/24/2025 |
| GitHub, Slack, Sentry, Grafana and Splunk together | 58 | ~55K | Anthropic, 11/24/2025 |

The author's measurements use OpenAI's o200k_base tokenizer on JSON with the name, description and input schema. Claude's numbers will differ, so compare the top half of the table with the bottom half only by order of magnitude. The average per tool is about 190 tokens for Playwright MCP, 740 for GitHub and 1,900 for Slack. The length of descriptions and schemas explains the spread, and you can't estimate the cost from the tool count alone.

Anthropic's figures come from a [post dated November 24, 2025](https://www.anthropic.com/engineering/advanced-tool-use). It's the vendor's internal example. The [tool search documentation](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) repeats the same ~55K, so it isn't a second independent confirmation. The [Agent SDK documentation](https://code.claude.com/docs/en/agent-sdk/tool-search) gives a different scale: 10-20K tokens for 50 tools.

### Tool search and defer_loading

Anthropic's figures from November 24, 2025 say tool search brought usage in their example down from ~77K to ~8.7K tokens before work begins; the company puts the reduction at 85%. The author made no independent measurement and found none in primary sources.

All definitions are still sent in the request, but with `defer_loading: true` they stay out of the initial context. The model searches the catalog, and the API inserts what it finds, up to five tools by default. Loaded definitions are billed as regular input. Deferred tools don't change the prefix, so the [prompt cache](https://futurecraft.pro/blog/prompt-caching/) survives. Editing definitions under normal loading invalidates all of it.

Anthropic recommends tool search from 10 tools up, or when definitions exceed 10K tokens. Below that, the Agent SDK documentation says loading everything upfront is typically faster: each search adds one more round trip. In Claude Code, deferred loading of MCP tools is [on by default](https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search), and only tool names and server instructions load at startup. How to keep the set of servers small is covered in [MCP for AI agents](https://futurecraft.pro/blog/mcp-for-ai-agents/).

## MCP on top of a REST API

The usual scenario: you already have an API and need to give it to a model. A thin wrapper calls REST and turns status codes into text for the model.

```python
# mcp_over_rest.py
import httpx2
from mcp.server import MCPServer
from mcp.server.mcpserver.exceptions import ToolError

mcp = MCPServer("orders-over-rest", version="1.0.0")
API = "http://127.0.0.1:8941"


@mcp.tool()
async def get_order_status(order_id: str) -> dict[str, str | int]:
    """Return status and ETA in days for an order id, for example A-1001."""
    async with httpx2.AsyncClient(base_url=API, timeout=5) as http:
        r = await http.get(f"/orders/{order_id}")
    if r.status_code == 404:
        raise ToolError("order not found")
    r.raise_for_status()
    return r.json()
```

In the run, the wrapper returned the same thing as the direct MCP server: data, text and error all matched. Each tool call made one GET to REST.

With REST switched off, the client got only "Error executing tool get_order_status", with no reason. In SDK 2.3.0, `ToolError` text and argument validation errors go out, and other exceptions stay on the server. Internal addresses don't leak this way, but the model doesn't learn what to do either. Convert expected failures (timeout, 429, missing permissions) to `ToolError` explicitly.

A few more decisions for a wrapper (the author's recommendations, not specification requirements):

- **One tool per task.** If an answer needs the order, the delivery and the refund, one tool with three requests inside beats three tools: fewer schemas in context and fewer model steps.
- **Short responses.** REST returns the whole object, the model needs only certain fields. Everything extra stays in the conversation history.
- **Writes separate from reads.** Mutating operations are easier to put behind confirmation when they have their own tools.
- **REST stays the source of rules.** Permissions, limits and checks live in the API, and the wrapper doesn't duplicate them. For how to describe the API itself, see [REST API design and OpenAPI](https://futurecraft.pro/blog/rest-api-design-ai/).

A full server with authorization, tests and publishing is built in the [MCP server in Python](https://futurecraft.pro/blog/build-mcp-server-python/) tutorial. It uses FastMCP 3, a standalone framework, while the code above uses the official `mcp` 2.x SDK.

## When you don't need MCP

- **One application and its own functions.** The schemas sit next to the code and share its version. Function calling does the job without a server or transport.
- **The order of steps is known in advance.** A nightly export or a webhook handler calls the API directly. Letting a model choose here adds cost and a chance of error.
- **The clients aren't AI.** MCP gives a website or a mobile app nothing.
- **There are few tools, and every request needs all of them.** Search brings no gain, and the protocol overhead remains.
- **Every request counts.** In the run, the stock client added two housekeeping requests to two calls; your own code hits the API once.
- **The server is third-party and unvetted.** The model reads its descriptions and responses. What to check before connecting is in the [MCP security guide](https://futurecraft.pro/blog/mcp-security-guide/).

## When you need MCP

- **There are several clients.** One server connects to Claude Code, Codex and your own agent instead of being rewritten for each.
- **An existing server fits.** For example, with Playwright MCP you don't have to wrap a browser yourself.
- **Different teams are involved.** The service owner changes the schema on their side, and clients get it through `tools/list`. The downside: a description can change without your review. For such cases, the beta MCP connector can pin the tool list.
- **The model loop isn't yours.** In ChatGPT and other finished applications you can't insert your code into that loop, but you can connect a server. For an agent with terminal access there's a simpler option: a CLI on top of the API.

Keep versions in mind when you switch. In the author's run, one HTTP endpoint on `mcp` 2.3.0 served both a new client (2026-07-28) and an old one on `mcp` 1.30.0 (2025-11-25). A new client in `auto` mode also connected to an old server by falling back to `initialize`. With the version pinned to 2026-07-28, the very first request to the old server failed with "Missing session ID".

## Summary: what to choose

1. A developer writes the request: API.
2. The model picks the request, there's one application and few functions: API and function calling.
3. Ten tools or more, or their definitions exceed 10K tokens: add tool search, with or without MCP.
4. Several AI clients need the tools: an MCP server on top of the API.

It's easier to start with the API, because you'll need it in any case. The wrapper from the example took under 20 lines, and you can add it when a second client shows up.
