By MCPfolio Editorial · Facts checked against primary sources on
MCP vs API: Key Differences, With Real Examples
MCP doesn't replace APIs. It wraps them for AI agents. See the same task both ways, what each costs in context, how auth works, and which to use.
Short answer: MCP wraps an API for AI
MCP (Model Context Protocol) is a standard way for an AI app to find and call tools. An API is the service those tools call. MCP does not replace APIs. Many MCP servers are a thin layer over an API that already exists, and they still need your API credentials.
The short version: write code against the API when you know the steps in advance. Use MCP when the model should choose which tools to call, across several AI clients.
Use the API directly for a fixed workflow you control line by line, such as a nightly backend job.
Use MCP when a model decides at runtime which tools to call, or when the same tools must work in Claude, Cursor and Codex.
If you own an API and want AI access, keep the API as the source of truth and add a narrow MCP server in front of it.
What we ran to check this
The examples and numbers below come from four checks run on 28 November 2026. Protocol and security details come from the sources at the end. Nothing was run against a private account or a real data store.
A REST call to the public github/github-mcp-server repository, unauthenticated.
A 20-line MCP server in a scratch folder outside this site. It wraps the same REST endpoint. We sent it raw JSON-RPC messages and saved what came back.
A tool-list size check on the archived GitHub reference server, using only the initialize and tools/list messages. No tool was called.
Queries on the MCPfolio catalog's active release: 680 servers. Counts come from the listing text, so they are approximate.
What changes between an API and MCP
An API gives your code a fixed set of endpoints. MCP gives a model a list of named tools, each with a description and a typed input schema, and lets it call them at runtime. The table shows where the two differ.
API
MCP
Who picks the call
Your code, when you write it
The model, when it runs
How you find out what exists
Read the docs
The client asks the server for its tool list
Contract
Endpoints such as GET /issues
Named tools with JSON Schema inputs
Message format
HTTP with REST, GraphQL or gRPC
JSON-RPC 2.0 messages
Transport
HTTP
stdio (a local process) or Streamable HTTP (remote)
Sign-in
Keys, tokens or OAuth that your code sends
The same credentials, plus an OAuth flow in clients that support it
Sent to the model
Nothing extra
Every tool's name, description and schema
Best for
Fixed pipelines and backend services
Agent or chat work across many tools
The same task, both ways
Task: list two open issues from a public GitHub repository. The REST version is one request. The MCP version needs a handshake and a tool list first, because the model has to learn what the server can do. The MCP server still makes the same REST request underneath.
The initialize step lets the client and server agree on a protocol version and features.
tools/list is how the client learns that list_issues exists and what inputs it takes. The client passes that list to the model.
tools/call is the only step that touches GitHub. The result comes back as text content inside a JSON-RPC response.
REST: the request your code would make
curl -s "https://api.github.com/repos/github/github-mcp-server/issues?state=open&per_page=2"
# Response: a JSON array. Each item has number, title, state, html_url, and more.
# Unauthenticated requests on public repos work but are limited to 60 per hour.
MCP: the minimal server we ran (scratch folder, not in this repo)
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({ name: "mini-github-issues", version: "0.1.0" });
server.tool(
"list_issues",
"List open issues for a public GitHub repository.",
{ owner: z.string(), repo: z.string(), limit: z.number().int().min(1).max(10).default(3) },
async ({ owner, repo, limit }) => {
const url = `https://api.github.com/repos/${owner}/${repo}/issues?state=open&per_page=${limit}`;
const res = await fetch(url, { headers: { Accept: "application/vnd.github+json" } });
if (!res.ok) return { isError: true, content: [{ type: "text", text: `GitHub returned ${res.status}` }] };
const items = (await res.json()).map((i) => ({ number: i.number, title: i.title, state: i.state, url: i.html_url }));
return { content: [{ type: "text", text: JSON.stringify(items) }] };
}
);
await server.connect(new StdioServerTransport());
MCP: raw JSON-RPC messages captured on 28 November 2026 (>> sent, << received)
>> {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"demo-client","version":"1.0"}}}
<< {"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{"listChanged":true}},"serverInfo":{"name":"mini-github-issues","version":"0.1.0"}},"jsonrpc":"2.0","id":1}
>> {"jsonrpc":"2.0","method":"notifications/initialized"}
>> {"jsonrpc":"2.0","id":2,"method":"tools/list"}
<< {"result":{"tools":[{"name":"list_issues","description":"List open issues for a public GitHub repository.","inputSchema":{"type":"object","properties":{"owner":{"type":"string"},"repo":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":10,"default":3}},"required":["owner","repo"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}}]},"jsonrpc":"2.0","id":2}
>> {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_issues","arguments":{"owner":"github","repo":"github-mcp-server","limit":2}}}
<< {"result":{"content":[{"type":"text","text":"[{\"number\":3978,\"title\":\"Insiders Feedback: Make MCP App actions and write approvals clearer\",\"state\":\"open\",\"url\":\"https://github.com/github/github-mcp-server/issues/3978\"},{\"number\":3977,\"title\":\"Insiders Feedback:\",\"state\":\"open\",\"url\":\"https://github.com/github/github-mcp-server/issues/3977\"}]"}]},"jsonrpc":"2.0","id":3}
How MCP sits on top of an API
Think of MCP as three layers over the API. The AI app hosts the conversation. The MCP client keeps the connection open and speaks the protocol. The MCP server maps each tool to one or more API calls.
Servers come in two transport types. Local servers run as a process on your machine and talk over stdio. Remote servers run on the vendor's infrastructure and talk over Streamable HTTP. In the MCPfolio catalog of 680 servers, 441 (65%) list a remote HTTP transport, and 219 (32%) run only locally over stdio. The full breakdown is on the remote vs local research page.
Layers
AI app (Claude, Cursor, Codex) the host
MCP client speaks JSON-RPC 2.0
MCP server your code, or a vendor's
REST or GraphQL API where the work happens
What MCP costs in context
When a session starts, the client sends each tool's name, description and input schema to the model. The more tools a server has, the more tokens the model reads before your first message. A direct API call sends none of this.
We measured the size of the tool definitions with no tool calls. Token counts below are estimates at about four characters per token. We did not run a token counter, so treat them as rough.
The archived GitHub reference server is not the current official GitHub MCP server. Its tool list is older, so do not quote it as today's count.
Turn on only the toolsets you need. Fewer tools means fewer definitions in every session.
A gateway can filter which tools each client sees. See the MCP gateway guide.
Auth and security
MCP doesn't remove your API's permissions. A server acts with the account it is connected to. Across the catalog, 369 of 680 listings (54%) mention OAuth, and 326 (48%) mention an API key or token. Only 53 (8%) say no sign-in is needed.
Three risks come up again and again. First, write tools can change data, so use read-only access where you can. The GitHub server warns that write-capable tools can change repository content. Second, tool descriptions come from the server. A malicious server can hide instructions in them, so install servers only from publishers you trust. Third, the MCP security best practices warn against token passthrough, where a server accepts a token that was not issued for it and forwards it to another API.
Stripe uses OAuth for interactive clients and an API key for clients that cannot use OAuth. Team admins can manage live and sandbox access separately.
Notion uses interactive OAuth, and the client can reach only content the connected account permits.
Vercel asks you to authorize each client separately.
MCP vs function calling vs API
These three are often mixed up because they work together. Function calling is how a model asks your app to run a tool. Your app defines the functions and sends them with each request. MCP is a standard way to deliver that tool list from a server to any compatible client. The API is the service that does the work.
Function calling
MCP
API
Defined by
Your app
The server
The service owner
Reusable across apps
No, per app
Yes, any MCP client
Yes, any HTTP client
Runs where
Your app
A local process or remote server
The service
Needs a model
Yes
No. Our test client called the server without one, but MCP is built for model use
No
Which one to use
Start from who makes the decision. If your code knows the next call, use the API. If the model should decide, use MCP.
Use the API directly when the steps are fixed, the job runs unattended, and you need predictable, testable behavior.
Use MCP when people connect an AI client to their own account, or when one set of tools should work in several clients.
Use both when you own the API. Keep the API for your own code and add an MCP server with a few narrow tools for AI clients.
You do not need MCP for one fixed call in a script. Adding a protocol to a single request costs more than it saves.
Real MCP servers that wrap popular APIs
These servers are in the MCPfolio catalog. Each one wraps a service you may already use. Transport and sign-in come from the listing text, so check the server page before you install.
The server in the same-task section is the whole pattern: declare a tool, call the API inside it, and return text. A real server adds error handling, rate limits, and the right credentials for each user. Start with one endpoint and add more tools only when the model needs them.
Frequently asked questions
Does MCP replace APIs?
No. An MCP server calls an API to do the work. Replacing the API would mean every app that uses it had to change. MCP only adds a standard way for AI clients to discover and use the API's functions.
Is MCP an API?
Not quite. MCP is a protocol: a set of JSON-RPC messages for listing and calling tools. An MCP server exposes tools, and those tools usually call an API.
Is MCP just JSON?
The messages are JSON, following the JSON-RPC 2.0 format. They travel over stdio for local servers or Streamable HTTP for remote ones.
Is MCP an API gateway?
No. A gateway sits in front of APIs to route traffic, enforce auth, and log requests. Some gateways can also host MCP servers. See the MCP gateway guide.
Does an MCP server need an API key?
Usually it needs credentials for the service it wraps. That can be OAuth, a token, or an API key. In the MCPfolio catalog, 8% of listings say no sign-in is needed.
Is MCP slower than calling the API directly?
It adds a handshake and a tool-list step at the start of each session, and sends tool definitions to the model. After that, each tool call is one JSON-RPC request that the server turns into an API call. We did not benchmark latency, so we cannot give a time difference.
Primary sources
Check the maintainer documentation for current setup steps, tool availability, and limitations.