MCP vs API: the difference, explained
MCP vs API isn't really a contest. An API (application programming interface) is a set of rules one program uses to ask another for data or actions, and every service designs its own. MCP (the Model Context Protocol) is one open standard for connecting AI applications to tools and data. Most MCP servers sit on top of an API: the API does the work, and MCP describes it to the AI in a common format it can discover and use.
What is an API?
An API lets software talk to software. A weather service, for example, might publish a web API where your code sends a request to a URL such as /forecast?city=Boston and gets back JSON with the temperature. The service decides the endpoints, the parameters, the format of the reply and how you prove who you are, usually with an API key or a token.
A developer reads the documentation, then writes code that calls the right endpoint with the right parameters. The calls are fixed in advance by that code. See what an API is for the full picture.
What is MCP?
The Model Context Protocol is an open-source standard for connecting AI applications to external systems. Anthropic introduced it on November 25, 2024. The official documentation compares it to a USB-C port for AI applications: one standard connector instead of a different cable for every device.
MCP has three kinds of participant:
- Host: the AI application, such as Claude, ChatGPT, Visual Studio Code or Cursor.
- Client: a connection the host creates for each server it talks to.
- Server: a program that offers capabilities to the AI. It can run on your own computer or remotely.
A server can offer three types of thing, called primitives: tools (actions the AI can run, such as "search issues"), resources (data the AI can read, such as a file or a database schema) and prompts (reusable templates). Messages use JSON-RPC 2.0, sent either over standard input and output for local servers, or over Streamable HTTP for remote ones.
The how to use MCP servers guide shows how to add one to an AI app.
MCP vs API: the key differences
| API | MCP | |
|---|---|---|
| What it is | An interface one service designs for programs to use | A shared standard for connecting AI applications to tools and data |
| Who decides each call | Code a developer wrote in advance | The AI model chooses tools while it works, through the host |
| How capabilities are found | A developer reads the documentation | The client asks the server at runtime (tools/list returns names, descriptions and input schemas) |
| Format | Different for every service: its own endpoints, parameters and errors | The same JSON-RPC messages for every server |
| Transport | Usually HTTP | stdio for local servers, Streamable HTTP for remote ones |
| What it describes | Endpoints and data formats | Tools, resources and prompts written for an AI to understand |
| Main audience | Developers writing code | AI applications, and developers connecting them |
The biggest difference is discovery. With a plain API, a person has to read the docs and write the integration. With MCP, the AI application asks the server what it can do, gets back a list of tools with plain-language descriptions and a schema for their inputs, and the model can start using them in the same conversation.
The problem MCP solves
Anthropic's announcement put the problem like this: every new data source needed its own custom implementation. Imagine 5 AI apps that each want to connect to the same 8 services. If every app writes its own integration for every service, that is 5 × 8 = 40 separate pieces of work. With a shared protocol, each app supports MCP once and each service gets one MCP server: 5 + 8 = 13.
Count integrations for yourself in this question from the MCP Servers course.
Typed answer: apps times tools without MCP, apps plus tools with it. Random numbers each round.
Press Mark to have your answer marked in the MCP Servers course.
How MCP and APIs work together
Most MCP servers are thin layers over an existing API. Here is what happens when you ask an AI app connected to a weather MCP server, "Do I need a coat in Boston today?":
- The host has already asked the server for its tools and found one called get_forecast, with a description and an input schema asking for a city.
- The model decides the tool will help and asks for it with the argument city = "Boston".
- The MCP client sends a JSON-RPC tools/call message to the server.
- The MCP server turns that into an ordinary HTTPS request to the weather service's API, adding the API key from its own configuration.
- The API replies with JSON. The server passes the useful part back to the host as the tool result, and the model writes its answer.
A tool call looks roughly like this (simplified: real messages also carry protocol metadata):
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "get_forecast",
"arguments": { "city": "Boston" }
}
}Behind it, the server makes the API request it was written to make, something like GET https://api.example.com/forecast?city=Boston. The AI never needs to know that URL or hold the API key. MCP servers don't have to wrap a web API, though: some read local files, query a database directly or run command-line tools.
When to use an API directly and when to use MCP
Call the API directly when
- You are writing ordinary software, such as a website backend, a script or a scheduled job, and you know exactly which calls to make.
- You need the fastest, most predictable path, with no AI model choosing what to do.
- You are processing large batches where every request is the same.
Use MCP when
- You want an AI assistant or agent to use a service on its own, choosing the right action from the conversation.
- You want one integration to work in many AI apps that support MCP.
- You are offering your product's features to AI applications and want them described in a standard way.
Many teams do both: their product has a normal API for developers and an MCP server that exposes the same features to AI apps.
Check your understanding.
Security: APIs and MCP
Neither is safe automatically. With an API, you protect your keys and check every input. With MCP there are extra questions, because an AI model is choosing the actions:
- Keys stay on the server. The MCP server holds the API key in its configuration, so the model never sees it.
- Authorization for remote servers. Streamable HTTP supports normal HTTP authentication, and MCP recommends OAuth for getting tokens.
- Approvals. Good hosts ask you before running tools that change things, such as sending a message or deleting a file.
- Untrusted content. Text a tool returns, such as a web page or an email, could contain instructions aimed at the AI. Only connect servers you trust.
Common misconceptions
- "MCP is a new kind of API that replaces REST." It is a protocol for AI apps, usually built on top of existing APIs.
- "An MCP server is just an API with a new name." It adds runtime discovery, plain-language tool descriptions and one message format that any MCP host understands.
- "MCP only works with Claude." Anthropic introduced it, but it is an open standard supported by many AI applications and developer tools.
- "With MCP you don't need API keys." The server still authenticates with the service, usually with an API key or token.
Practice with a short timed paper
Networks, protocols and how programs communicate come up in computer science courses. The daily AP Computer Science A paper is a short timed practice test of 8 questions, with a new one every day.
Common questions
What is the difference between MCP and an API?
Is MCP an API?
Does MCP replace REST APIs?
Why use MCP instead of calling an API directly?
Who created MCP?
What protocol does MCP use?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Learn it
MCP Servers
What MCP servers are, how to plug them into AI apps and how to build your own
Start the course - Test it
AP Computer Science A
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper