← All tutorials
APIs vs MCP

APIs vs MCP — connecting AI to the world

An API is how one piece of software talks to another. MCP (the Model Context Protocol) is a standard way for AI models and agents to discover and use tools and data. They're not rivals — MCP is a layer built on top of APIs, designed for the way models work.

agent→ MCP (one protocol)→ tool / API / data
The analogy. MCP is often called "USB-C for AI." Before USB-C, every device needed its own cable; after, one port fits everything. MCP is one standard "port" so any AI app can plug into any tool — instead of bespoke wiring for every pair.

Baseline  The API — software talking to software

Traditional API REST · GraphQL · RPC

Solves A contract for two programs to exchange data and actions over the network — request an endpoint, get a structured response. It's the universal, decades-proven way systems integrate, and it's what actually holds the data and does the work.

Limits (for AI) Each API is bespoke: your code must know its endpoints, auth, and response shapes ahead of time, and you hand-write an integration per API, per app. A model can't "look up" how to call it at runtime — someone must wire and describe every tool for every assistant. N tools × M apps = a lot of glue.

Choose Always, underneath everything — deterministic backend-to-backend integration where your code controls both ends.

The standard  What MCP is

Model Context Protocol open protocol · introduced by Anthropic, 2024

Solves The integration explosion between AI apps and tools. MCP defines one open protocol so any compliant AI app (the host) can connect to any server that exposes tools, data and prompts — with runtime discovery, so the model can list what's available and call it by name using self-describing JSON schemas. Write a tool server once; every MCP-aware assistant can use it.

Limits It's young and evolving; running/instally third-party servers has real security and trust implications (they can execute code and touch data); and it adds a protocol layer you don't need if only your own code calls your own API. It doesn't replace APIs — servers still call them underneath.

Choose When you want models/agents to use many tools in a uniform, swappable way — or to publish a tool that other people's AI apps can consume.

MCP vs function-calling. Plain tool/function-calling defines tools inside one app's code. MCP moves them outside into reusable servers behind a standard protocol — so the same "GitHub" or "Postgres" server works in Claude Desktop, your IDE, and your custom agent without rewriting the integration.

Why it exists  The M×N integration problem

Connect M AI apps to N tools directly and you need up to M×N custom integrations. A shared protocol collapses that to M+N: each app speaks MCP once, each tool exposes an MCP server once.

M times N versus M plus N integrations On the left, three apps each wire directly to three tools, creating nine tangled integrations. On the right, three apps connect to a single MCP layer, which connects to three tools — six clean connections. Without MCP · up to M×N With MCP · M+N app A app B app C tool 1 tool 2 tool 3 app A app B app C MCP tool 1 tool 2 tool 3

It's the same reason USB, drivers, or LSP (one protocol between many editors and many languages) won: standardize the interface once, and every new participant plugs into all the others for free.

Mechanics  How MCP works

MCP has three roles and a small set of primitives.

🖥️ Host

The AI app the user interacts with (Claude Desktop, an IDE, your agent). It embeds one or more clients.

🔌 Client

Lives in the host; holds a 1:1 connection to a server and relays the protocol.

🧩 Server

A separate program exposing capabilities — usually wrapping a real API, database or filesystem.

A server offers three primitives, and the client can discover them at runtime:

PrimitiveWhat it isWho drives it
ToolsActions the model can invoke (with typed inputs) — "search issues", "send email".Model-controlled
ResourcesRead-only data/context the host can load — files, records, docs.App-controlled
PromptsReusable prompt templates/workflows a user can invoke.User-controlled

Messages use JSON-RPC 2.0 over a transport: stdio for local servers, or HTTP (Server-Sent Events / streamable HTTP) for remote ones — with sessions and server-to-client notifications when things change.

Hands-on  The same tool, both ways

A weather lookup, exposed as a hand-wired API client versus a reusable MCP server. Switch tabs; hit Copy.

weather tool
# Traditional API: your app hard-codes the endpoint, auth, and parsing.
# The model can't discover this — you wire & describe it per assistant.
import requests

def get_forecast(city: str) -> str:
    r = requests.get(
        "https://api.weather.example/v1/forecast",
        params={"city": city},
        headers={"Authorization": "Bearer $WEATHER_KEY"},
    )
    r.raise_for_status()
    return r.json()["summary"]        # shape is specific to THIS API

print(get_forecast("Paris"))
Notice the shift. The API version is invoked by your code, in one app. The MCP version is described once and invoked by the model, in any host — and it still calls a REST API inside. MCP standardizes the exposure, not the implementation.

API vs MCP — side by side

AspectTraditional APIMCP
PurposeSoftware ↔ softwareAI/agents ↔ tools & data (standardized)
Who invokes itYour application codeThe model/agent, at runtime
DiscoveryRead docs; hard-code endpointsDynamic — client lists tools + JSON schemas
Integration effortCustom per API, per app (M×N)Server once; any client reuses (M+N)
InterfaceBespoke endpoints & shapesUniform: tools · resources · prompts
CouplingTight, versioned per integrationSwappable servers behind one protocol
TransportUsually stateless HTTPJSON-RPC over stdio or HTTP/SSE, with sessions
Best atDeterministic app integrationLetting agents use many tools uniformly
They compose, not compete. An MCP server is almost always a thin adapter over one or more REST/GraphQL APIs. MCP doesn't replace your API — it makes it consumable by any AI host without custom glue.

When to use which

If you…Use…
Integrate two backends you control, deterministicallyAPI (REST/GraphQL/RPC)
Need raw performance / fine-grained controlAPI directly
Want an agent to use many tools, discovered at runtimeMCP
Want one tool integration reusable across hosts (Desktop, IDE, your agent)MCP
Are publishing a tool for other people's AI apps to useMCP server (wrapping your API)
Only your own code calls your own serviceAPI — MCP would be overhead
Rule of thumb. Build the capability as an API (it's the source of truth), then put an MCP server in front when you want AI hosts to use it without bespoke integration. APIs are the plumbing; MCP is the standard socket AI plugs into.

Cheat sheet

QuestionShort answer
Is MCP a replacement for APIs?No — it's a standard layer on top of them, aimed at AI.
What problem does MCP solve?The M×N glue explosion between AI apps and tools → M+N.
Who calls an MCP tool?The model/agent, after discovering it at runtime.
MCP's three primitives?Tools (actions), Resources (data), Prompts (templates).
MCP vs function-calling?Function-calling is per-app; MCP externalizes tools into reusable servers.
Main caution?Third-party servers run code & touch data — trust & auth matter.

Knowledge check

Six questions on APIs and MCP. Pick an answer for each, then check your score.

1. What is MCP, in one line?

2. What core problem does MCP address?

3. Who invokes an MCP tool at runtime?

4. Which are MCP's three primitives?

5. How does MCP relate to your existing REST API?

6. You only integrate two backends you fully control, deterministically. Best choice?

Next steps

🧰 Agent Development Kits

Frameworks that use tools — many support MCP servers as a tool source (Strands, ADK, LangGraph).

📡 IoT × Agents

A real agent — Bedrock AgentCore's Gateway turns APIs/Lambdas into MCP tools.

🤖 LLM apps tutorial

Tool-calling in an agent — the in-app version MCP standardizes.

🔀 REST vs GraphQL vs gRPC

API styles compared — the paradigms an MCP server wraps underneath.

🔗 n8n automation

No-code integration — the visual way to wire apps & APIs together (vs. code-first MCP).

🛡️ Web · API · AI Security

Secure agent tools — least privilege, scoped creds, and defending against prompt injection.

🧩 Build MCP from scratch

The hands-on how — build an MCP server and a client/task, step by step.

📓 All tutorials

The hub — LLM apps, embeddings, retrieval, agent kits, AWS & IoT.