DEV Community

Cover image for MCP vs API: What a Model Does When It Has Both
Vladimir Beskorovainyi
Vladimir Beskorovainyi

Posted on Originally published at besk.tech

MCP vs API: What a Model Does When It Has Both

An API is how a program calls a service. MCP is a standard way for an AI assistant to discover a service's tools and call them. I gave a model two routes to GitHub, the MCP server and the gh command line that calls the same API. With the shell open, Claude Haiku sent 9 of 16 GitHub tasks around the server. With the shell closed, all 16 went to the right server tool.

An API is how a program calls a service: a developer picks the operations in advance and writes them into code. MCP is a standard way for an AI assistant to find out what tools a service offers and to choose among them during the conversation. Many MCP servers call the service's API underneath, so the real question is not which one exists. It is who chooses the call, and on whose permissions.

On 3 December Coinbase announced Wallet MCP, a server that lets an AI agent check balances, swap tokens and send funds from an agent wallet linked to the user's Coinbase Wallet. Its documentation puts the spending controls on that connection. Those controls hold only for that route. When I gave a model two routes to the same service, it did not always use the one I had set up. That test was on GitHub, not on Coinbase.

What an API is

An API, application programming interface, is a set of operations a service exposes to other programs. A REST API, the common kind, is a list of addresses that accept requests and return data: get a repository, create an issue, list deployments.

The first reader of an API is a developer. The developer learns which call does what, writes the code, handles errors and decides where the key is kept. Many APIs also publish a machine-readable description, such as an OpenAPI file, and a model with function calling can call such an API without MCP. In that case the developer still wires each API to each client by hand.

What MCP adds

MCP, the Model Context Protocol, is an open standard that Anthropic introduced on 25 November 2024. A service is wrapped once as an MCP server, and any client that speaks the protocol can use it: Claude Code, an IDE, a chat app.

A server can offer several kinds of things. The one that matters here is tools. Each tool has a name, a plain-language description and a schema for its arguments. The client asks the server for the list, passes the descriptions to the model, and the model chooses which tool to call and with what arguments. The client decides what the model sees and can ask the user before a call runs.

So MCP standardises the contract between an assistant and a service. Write the server once, and every compatible client can use it. The protocol does not decide what the server may do. A remote server usually gets an OAuth grant; a local server often reads the same kind of token a script would.

Where they differ

API called from code API via function calling MCP tool
Who chooses the call A developer, when the code is written The model, during the conversation The model, during the conversation
How it is described Documentation, sometimes an OpenAPI file A tool definition the developer writes for one app Name, description and argument schema from the server
Works in The program it was wired into The app it was wired into Any client that speaks MCP
Credentials Whatever key the code holds Whatever key the app holds The server's token or OAuth grant, plus the client's permission rules
Cost in the model's context None, no model involved Tool definitions the model reads Tool definitions the model reads

Once a model chooses the call, the context cost is the same for both. MCP's difference is that one server works in every client, which also makes it easy to connect many of them.

What MCP costs in context

A model can only choose a tool whose description it has read, and descriptions take space in its context window.

On 21 November I counted my setup in Claude Code: 738 tools from 19 MCP servers. Their definitions together come to about 534,000 tokens, more than most context windows hold. The client does not load them all. It shows the model the tool names and loads a full definition when the model asks for one. Even so, the client's /context estimate put MCP at 16,500 tokens of every conversation, 38% of everything in the session before my first question. More than half of that, 8,600 tokens, came from one server that loaded five tools in full up front.

Over 30 days I called 39 of those 738 tools. Twelve servers were never called. Blocking them in the client freed at least 9,300 tokens per conversation by the client's estimate. Later I disconnected eight servers for good.

A call written into code costs the model nothing to read. That is one reason I still reach for an API when I write an integration myself: less context, and code where I can see exactly which call is made.

What the model does when it has both

I did not test function calling against MCP. The second route in my test was the one an assistant usually already has: a shell with GitHub's gh command-line client, which calls the GitHub API directly. So this section is MCP server versus a CLI over the same API.

I ran 71 tasks in Claude Code, 63 of them with a right tool written down before the run. A hook let the client's tool search through and blocked the first real call, so nothing executed. The test records the model's first move, not where it would have gone after an error.

Claude Opus 5.5 ran the set three times on 22 November. In 189 picks on 63 tasks it never took a tool from the wrong MCP server. Its misses went elsewhere. On 12 of the 48 GitHub picks across those three runs, with the GitHub MCP server connected, it went to the shell and ran gh.

That was not a random error. As of Claude Code 2.1.325, the client's own description of its shell tool tells the model to use the gh CLI for GitHub operations. The model was following the client's instruction, which competed with the server I had connected.

Every run I have, by the number of the 16 GitHub tasks sent to gh:

Run Model Servers connected GitHub tasks sent to gh
22.11, two runs Opus 5.5 19 5, 4
22.11 Opus 5.5 19, with 12 unused ones blocked 3
23.11 Opus 5.5 11 1
23.11 Opus 5 11 0
25.11 Opus 5.5 11 4
25.11 Sonnet 5.5 11 3
25.11 Haiku 5.5 11 9
25.11, shell denied Haiku 5.5 11 0

Haiku shows the effect most clearly. With the shell open it sent 9 of the 16 GitHub tasks to gh and got 7 right by the test's rule. With the shell denied and everything else the same, zero calls to gh follows by construction. The finding is that all 16 then went to the right tool on the GitHub server, not to a wrong one, and its total rose from 48 to 58 of 63. The routing problem did not vanish, though. Three Vercel tasks that should have gone to the Vercel server went to local file search instead. One run each, and I have not measured run-to-run noise for Haiku, so the size is rough.

The other route is not wrong in itself. Several of those gh calls would probably have answered the task. It is the route I use myself when I write an integration by hand, which is exactly why it was open.

Whose permissions

The route changes whose rights the call runs on.

The GitHub MCP server runs on the grant given to that connection. gh runs on the token from my command-line login. By default gh asks for repo, read:org and gist at login; my token also carries workflow. These are two separate grants, and the one on the shell was not set up for these tasks. I have not compared them scope by scope, so I do not claim one is wider. The point is that a limit set on one of them does not apply to the other.

Coinbase draws a similar line in its documentation. The agent's spending budget covers a rolling 24 hours, has to be saved before the agent can spend on its own, and has no default allowance. The documentation also says the controls "constrain MCP-initiated actions, not transactions you personally make". That sentence is about the user's own transactions. I have not used Wallet MCP and have not tested whether an agent could reach the wallet another way. On GitHub, the general rule held: a limit on one route covered only that route.

When to use which

My own default is the API, partly from habit: I have written many integrations by hand. The cases below are where each one fits.

Use an API when:

  • you write the integration yourself and know which calls it needs;
  • the same input should lead to the same calls;
  • you want to keep the context window for the task.

Use MCP when:

  • an assistant should choose the action during the conversation;
  • the service has a maintained MCP server and you would rather not write and keep up the code;
  • you want the assistant's rights on one connection you can review and revoke, and you can close the other routes to the same service.

If you give an assistant both, decide which route counts and close the other. For Haiku, denying the shell was what moved the GitHub tasks onto the server. Disconnecting servers did not reliably do it: Opus 5.5 sent 1 GitHub task to gh in one run on 11 servers and 4 in the next, the same range as with 19. A line in my own instructions telling the model to prefer the server is the next thing to test. I have not tested it, and it would be arguing with the client's own line about gh.

Limits

One client, Claude Code, and four models from one family. Five runs on Opus 5.5, one on Opus 5, one on Sonnet 5.5, and one each for Haiku 5.5 with and without the shell. Function calling over an OpenAPI description was not tested. The hook stops at the first call, so the test measures the choice of route, not whether the call would have succeeded, and a correct gh call counts as a miss. Most tasks name the service; on vaguer tasks the model reached for local tools more often. The tool count changed between runs as I disconnected servers. The Coinbase details come from its documentation as of 6 December 2026.

Before you connect an MCP server, list every other way the assistant can reach the same service. The server's permissions only hold if those other routes are closed.

Sources


Vladimir Beskorovainyi, Enterprise AI Architect & CTO, author of the Amazon bestseller "Enterprise AI: The KATA Way", founder of Besk Tech (besk.tech)

Top comments (0)