Skip to content
AI agents

MCP vs API: the difference, and when to use each

MCP vs API: an API exposes a system to code, MCP lets AI agents find and call tools. A comparison table, when to use each, and why one governed MCP layer on the APIs works best.

Paul Turner

VP of Product Marketing and Market Strategy, Tray.ai Updated Nov 29, 2026

MCP vs API comes down to who is calling: an API is how a system exposes its functions to code a developer writes, and MCP, the Model Context Protocol, is how an AI agent finds and calls tools at run time. Most MCP tools are a layer over an API, so the two work together rather than compete. With Tray, Agent Gateway for MCP publishes any of the 12,000+ apps, databases, APIs, and services Tray connects to as a governed MCP tool.

For an enterprise the real question is where the governed layer sits: in front of a separate MCP server for every system, or directly on the APIs. Ask an agent to update a customer’s renewal, and in a typical setup it goes through a gateway, then Salesforce’s MCP server, then Salesforce’s API. Before it does anything, it has loaded the tool definitions of every server it can see. Anthropic measured that load on five popular servers, GitHub, Slack, Sentry, Grafana and Splunk: 58 tools and about 55,000 tokens, gone before the conversation starts.

MCP vs API at a glance

How an API and MCP differ, row by row.
What changes API MCP
What it is A system's interface for other software, such as Salesforce's REST API An open protocol for AI applications to discover and call tools
Who calls it Code a developer wrote for a known task An agent that decides at run time which tool to use
How it is described Docs or an OpenAPI spec, read by a developer Tool names, descriptions and schemas, read by the model
Where the work happens In the system behind it Usually in an API call the MCP tool makes for the agent
What it costs to call The request itself The request, plus the tool definitions and results the model reads
How an API and MCP differ, row by row.

When to use MCP and when to use an API

Use an API directly when:

  • A developer’s code makes a known, fixed call, such as a nightly sync or a webhook handler.
  • The caller is another system, not an AI agent, and the steps never change.
  • You need every option the API offers, not a curated set of tools.

Use MCP when:

  • An AI agent decides at run time which tool to call, and the tool has to be described in a form the model can read.
  • You want one way for several AI clients to find the same tools, instead of custom glue for each.
  • You need each call tied to a person, scoped to its job and logged, which is what a governed MCP layer adds.

Most teams need both. The API is where the work happens, and MCP is how an agent reaches it. An OpenAPI or Swagger spec is a good starting point: with Tray, the CDK builds a connector from the spec and Agent Gateway exposes it as a governed MCP tool.

Most MCP servers are a layer over an API

A Salesforce MCP server does not hold your opportunities. It describes a set of tools to the agent, and when the agent calls one, it makes a call to Salesforce’s API and hands the result back. The same is true of almost every MCP server for a business system. MCP took away the custom glue each AI application used to need for each tool. It did not take away the API. If MCP itself is new, start with what MCP is and which tools support it.

That matters because it means there are two ways to give agents governed access to a system. You can run the vendor’s MCP server and put a proxy in front of it. Or you can connect to the API yourself and publish governed MCP tools from one layer.

What stacking MCP servers costs

The first way is where most teams start, because a vendor server is quick to switch on. The costs show up once there are several of them.

  • Tool definitions fill the context. Most MCP clients load every tool definition from every connected server at the start of a session. In Anthropic’s measurement, GitHub’s server alone was 35 tools and about 26,000 tokens and Slack’s was 11 tools and about 21,000. Those are thorough servers, which is the point: each tool you might need costs context whether you use it or not. Add Jira, at about 17,000 tokens on its own, and the overhead passes 70,000 before any work begins.
  • Results pass back through the model. Anthropic’s engineers put the second problem plainly: “Every intermediate result must pass through the model.” A server that returns a full API response, when the agent needed three fields, fills the context again.
  • Every server is its own security domain. The OWASP MCP Security Cheat Sheet treats each MCP server as an untrusted, independent domain to isolate. Four servers means four places your credentials live and four logs to reconcile, plus tool definitions on each one that can change after you approved them.
  • One more hop. A proxied call goes agent, gateway, vendor server, API. The vendor server is one more thing to run, patch and trust.

Proxying vs one MCP layer built on APIs

A server per system

  1. Agent
  2. Gateway
  3. Vendor MCP server
  4. System API
Four hops, with credentials held at the vendor server

One governed layer

  1. Agent
  2. Agent Gateway
  3. System API
Three hops, with credentials and the audit log in one place
What changes
What changes Proxying a server per system One MCP layer on the APIs
Path of a call Agent, gateway, vendor MCP server, API Agent, MCP layer, API
Tool definitions loaded Every tool on every connected server The tools each agent is given
What comes back Often the full API response The fields the task needs
Credentials and permissions One set per server Held and scoped in one place
Audit The gateway's log, plus each server's own One log for every call
Multi-step jobs The agent chains raw tools and works out the order One composite tool runs the same steps every time
Best when You depend on servers you already run You want fewer things to govern

Building on the API is also how the token cost comes down. Anthropic’s own fixes for the same two problems are to load tools on demand and to let agents run code, and in one of their examples that took a job from 150,000 tokens to 2,000. A composite tool goes after the same waste from the other side: one tool that does a multi-step job in one call, with one definition and one compact result, instead of dozens of raw tools and their responses.

What one layer looks like in practice

Agent Gateway for MCP is built this way. It connects to each system’s API through Tray’s connectors and publishes governed tools from one MCP layer, so each call is tied to a named person, can run on their own credentials, is scoped to its job and lands in one audit log, whichever client makes it. The security and compliance controls of the platform underneath are set out on Trust. A Customer 360 tool pulls a customer’s Salesforce, Zendesk and Stripe records in a single call, which cuts token use by up to 10× and runs the same steps every time.

J.W. Pepper shows the result at scale: 500+ MCP tools reduced to about 20 governed workflows, with zero raw database access, launched in weeks. As Marcus Dubreuil put it, the workflows started to become “these little drops of determinism into what the agent can do.”

When proxying is the right call

Building on the API is not always the answer. Proxy a server when:

  • A team depends on a vendor’s MCP server for a system your layer does not connect to.
  • The vendor’s server offers something its API does not.
  • It is one developer working in one tool, where a vendor server is the fastest start and governance can wait.

Agent Gateway doesn’t sit in front of vendor MCP servers, because for the systems it connects to it doesn’t need to. For the cases above, a proxying gateway is the better fit. The MCP gateway comparison sets out which products proxy, which publish their own tools, and which do both.

How to decide

  • Count the servers. One or two, for a few developers, and proxying is fine. Five or more, across teams, and the credentials, logs and tool definitions multiply.
  • Check what loads. Ask how many tool definitions each agent sees at the start of a session, and what that costs in tokens.
  • Look at the result size. If a tool returns whole records when the task needs a status, the model pays to read the rest.
  • Ask who the call runs as. Every call should run as the person asking, not a shared account. The MCP security checklist covers the rest of the controls, and governing the MCP servers you already run covers moving off the servers you have.

Sources

  • MCP
  • Agent development

Frequently asked questions

What's the difference between MCP and an API?

An API is how a system such as Salesforce exposes its functions to other software, with endpoints a developer calls from code. MCP, the Model Context Protocol, is how an AI application discovers and calls tools at run time: a server describes the tools it offers, and the agent picks which to call. Most MCP tools are a layer over an API, so the two work together rather than compete.

Is MCP replacing APIs?

No. MCP sits on top of APIs. Almost every MCP server turns a request from an agent into calls to a system's API, so the API is still where the work happens. What MCP replaces is the custom glue code each AI application used to need for each tool.

Should I proxy MCP servers or connect to APIs directly?

For a company running agents against many systems, connecting to the APIs and publishing governed MCP tools from one layer usually costs less and is easier to govern. A proxy in front of a separate server for each system adds a hop, loads every server's tool definitions into the agent's context, and leaves a set of credentials, permissions and logs per server. Proxying makes sense when a team depends on a particular vendor's MCP server that the layer does not connect to.

How many tokens do MCP tool definitions use?

More than most teams expect. Anthropic measured 58 tools across five popular MCP servers consuming about 55,000 tokens before a conversation starts, and has seen tool definitions reach 134,000 tokens before optimization. Each definition loads at the start of a session whether the agent uses that tool or not.

Does Tray.ai's Agent Gateway proxy MCP servers?

No. Agent Gateway connects to each system's API directly through Tray's connectors and publishes governed MCP tools from one layer, so there is no vendor MCP server in the path. If a team needs a specific vendor's server to stay in place, a proxying gateway is the better fit for that server.

Does an MCP server use an API?

Yes, almost always. An MCP server describes tools to an agent, and when the agent calls one, the server makes a call to the system's API and returns the result. The API is where the work happens. MCP is the way the agent finds the tool and learns how to call it.

Is MCP like an API gateway?

Not quite. An API gateway sits in front of APIs and manages traffic from the code that calls them: authentication, rate limits and routing. An MCP gateway governs what AI agents can do through MCP tools: which tools an agent sees, who each call runs as, and a log of every call. Tray's Agent Gateway for MCP is the second kind.

When should I use MCP instead of an API?

Use MCP when an AI agent decides at run time which tool to call, and you want that tool described in a form the model can read. Use an API directly when a developer's code makes a known, fixed call, such as a nightly sync. Many systems need both, with MCP tools built on the APIs.

Can an OpenAPI spec become an MCP tool?

Yes. With Tray, an OpenAPI or Swagger spec can become an MCP tool: the Tray CDK builds a connector from the spec, and Agent Gateway exposes it as a governed tool. Any of the 12,000+ apps, databases, APIs, and services Tray connects to can become a governed MCP tool the same way.

See your next integration running on Tray.

Tell us the systems you connect today and we'll show you the workflow on Tray iPaaS, or start free.

Great, a couple more details

This helps us connect you with the right person. Optional, and you can skip it.