[KongchangAI]
· 3 min read· 1,630 words

MCP vs REST API: What Do AI Agents Really Need?

MCP vs REST API: What Do AI Agents Really Need?

MCP doesn't replace REST — it's the layer that lets AI autonomously discover and invoke services.

The article compares MCP and REST APIs, concluding they are layered collaborators rather than substitutes. REST API is how programmers write calling code by documentation; MCP lets AI models directly ask the Server for available tools and autonomously decide at runtime based on tool descriptions and parameter Schemas. The article breaks down MCP's invocation chain and demonstrates natural-language-driven parameter mapping through weather query and task creation scenarios. On security, the MCP Server's proxy layer passes tenant and user context while AI never directly touches REST APIs. Recommendation: keep REST for web and mobile apps, layer MCP Server on top of existing REST for AI Agent scenarios.

MCP vs REST API: What Do AI Agents Really Need?

When AI Agents need to call external services, developers face a core question: should they stick with traditional REST APIs, or switch to MCP (Model Context Protocol)? A tech content creator, through code demos and analogy-based analysis in a video, gave a clear answer: MCP doesn't replace REST — it's the layer that lets AI discover and invoke services on its own.

Understanding the Core Difference in One Sentence

The video offers a concise comparison: REST API is how code written by programmers talks to a service; MCP is how AI models discover and use services by themselves.

This distinction seems simple, but its implications run deep. In the REST era, human developers had to read documentation, understand interfaces, and write calling code. In the MCP era, AI models can directly ask a server "what can you do?" and then automatically decide which interface to call based on the returned tool descriptions.

As the restaurant analogy in the video goes: REST is like a restaurant where you must know the menu in advance and order by number; MCP is like a waiter who hands the AI a menu with descriptions, letting the AI choose based on its needs. The creator describes MCP as "the communication channel between AI and REST APIs," which is a fairly accurate positioning.

Breaking Down the MCP Workflow

MCP tool invocation flow

The video uses multiple flowcharts to illustrate MCP's invocation chain in detail. The core roles include:

AI Client (e.g., LLM) receives the user query and communicates with the MCP Server through the MCP protocol. Inside the MCP Server are several key modules — Tool Registry, Context Analysis, Tool Schema exposure, and a Secure Proxy Layer.

The tool invocation chain works like this: the AI asks the MCP Server for available tools, the Server returns tool names, descriptions, and parameter Schemas, the AI decides which tool to call based on this information, then indirectly calls the underlying REST API through the MCP Server, and finally returns the result to the user.

The video illustrates this flow with a concrete example: the AI identifies a "query employee basic info" tool, initiates a call based on the employee id parameter in its description, the MCP Server forwards the request to the corresponding REST API method, retrieves the data, passes it back to the AI, and the AI presents it to the user.

Tool Schema is the core data structure in the MCP tool registry, typically describing a tool's name, purpose (description), and input parameters in JSON Schema format. For example, a weather tool's Schema would declare city as a required string parameter. The AI model doesn't execute the tool itself — it reads this Schema and reasons that "user asks whether they need an umbrella in Lucknow" should map to a call with city=Lucknow. The quality of the Schema directly determines the AI's invocation accuracy — the clearer the description and the more explicit the parameter constraints, the lower the probability of mis-invocations and parameter errors. This is also the part that MCP Server developers need to refine the most.

How Security Context Is Passed

Agent security context passing

In enterprise-level scenarios, API calls often involve tenant isolation and permission control. The video reveals a key detail: the Controller layer of a REST API extracts security context information such as tenant ID, user ID, and department ID from request headers.

When an Agent executes a task, it needs to pass this security context along to the underlying services. The code demo in the video shows an agent.ask() method that receives a prompt, advisor, and question, while also constructing filter expressions to ensure security policies take effect.

AI cannot directly access REST APIs — it must go through the MCP Server's Secure Proxy Layer. The creator emphasizes: "We simply cannot hand over REST API access permissions to AI" — this statement highlights MCP's core value at the security level.

The Secure Proxy Layer is the intermediate component inside the MCP Server that isolates AI from backend services. The AI model only holds credentials for communicating with the MCP Server, and neither sees nor holds the underlying REST API tokens or database addresses. When a request passes through the proxy layer, it verifies the caller's identity, injects or passes through tenant and user context, then initiates a request to the downstream REST API. The value of this design: even if the model is induced by a prompt injection attack to call an unauthorized tool, the proxy layer can still reject it based on policy — thereby incorporating the premise that "AI is untrustworthy" into the architectural assumptions rather than relying on the model to voluntarily respect permission boundaries.

Real-World Scenarios: Weather Queries and Task Creation

AI calls weather tool via MCP

The video uses two everyday scenarios to illustrate how MCP works:

Weather query scenario: AI first asks the Server what tools are available, the Server returns a tool list (names, descriptions, parameter Schemas). The user asks "Do I need an umbrella in Lucknow?" The AI determines it should call the weather tool, passes city=Lucknow, gets back "Sunny, 30°C," and replies "No umbrella needed." Throughout this process, there's no hardcoded decision logic — the AI makes autonomous decisions entirely based on tool descriptions.

Task creation scenario: The user says "Remind me to buy milk," the AI calls the create_task tool, automatically filling in title=buy milk and due date. Compared to the REST API approach, where developers must explicitly call and pass structured parameters, the MCP approach requires only natural language expression from the user, with the AI handling parameter mapping.

Both examples demonstrate the same core capability: AI understands purpose from tool descriptions and autonomously decides what to call at runtime.

Point-by-Point Comparison: Developer vs AI — Who Decides

The video provides a set of clear comparison dimensions:

  • Who writes the calling code: REST is written by developers; MCP is decided by the AI model and Agent at runtime
  • How capabilities are discovered: REST requires reading API docs and OpenAPI specs; MCP directly asks the Server for the tool list
  • Who invokes: REST is controlled by programmers; MCP is selected by the AI model at runtime
  • Interface consistency: Every REST API has different error handling and pagination; MCP provides a unified Server interface
  • State management: MCP supports session persistence and progress updates because a long-lived connection is maintained between AI and MCP Server
  • Transport: REST is based on HTTP; MCP supports stdio (local) and HTTP (remote)

These differences point to a key conclusion: MCP provides AI with a standardized, self-describing service discovery mechanism, while REST is designed for human developers.

How They Work Together

MCP and REST API collaborative invocation

The video repeatedly emphasizes one point: MCP does not replace REST API. Most MCP Servers are actually thin wrappers around existing REST APIs.

The typical architecture is: user sends a natural language request → AI connects to MCP Server → MCP Server translates the request into REST calls → the underlying service (e.g., GitHub API) processes and returns the result. AI communicates with MCP, MCP communicates with REST — each plays its own role.

Thin wrapper means the MCP Server itself doesn't carry business logic — it only does protocol conversion and routing. It translates MCP tool invocation requests into corresponding REST endpoint calls, then wraps HTTP responses into MCP's result format. This means existing enterprise capabilities on the REST side — authentication, rate limiting, auditing, monitoring — can be fully reused without reimplementing them at the MCP layer. The trade-off is that the MCP Server must keep its tool Schema in sync with REST API changes, otherwise AI will call new interfaces with old parameters, causing mismatches. Version alignment is therefore a long-term operational priority for this type of wrapper architecture.

When to Use Which?

The video's selection advice is pragmatic:

  • Use REST: Web apps, mobile apps, service-to-service communication
  • Use MCP: When you want AI assistants or Agents to use your services or data
  • Use both: You have an existing REST API and want to add AI — just build an MCP Server on top of REST

Core Conclusion

Back to the question in the video title — what do AI Agents really need? The answer is: AI needs a standardized protocol that can autonomously discover, understand, and invoke services. REST API is the foundation of service capabilities; MCP is the bridge that lets AI reach those foundations. The two are layered, not substitutes. For developers building AI Agent applications, understanding this is crucial — you don't need to tear down your existing REST API architecture. You just need to add an MCP Server layer on top, and AI can drive your services with natural language.

One-line Summary

MCP doesn't replace REST — it's the layer that lets AI autonomously discover and invoke services.

Paragraph Summary

The article compares MCP and REST APIs, concluding that they are layered collaborators rather than substitutes. REST API is how programmers write calling code and order from the menu by documentation; MCP lets AI models directly ask the Server for available tools and autonomously decide at runtime based on tool names, descriptions, and parameter Schemas. The article breaks down MCP's invocation chain — AI client, tool registry, context analysis, secure proxy layer — and demonstrates natural-language-driven parameter mapping through weather query and task creation scenarios. On security, the MCP Server's proxy layer handles passing tenant ID, user ID, and other context, while AI never directly touches REST APIs. The selection advice: keep REST for web and mobile apps, and layer an MCP Server on top of existing REST for AI Agent scenarios.

#MCP#REST API#AI Agent#Model Context Protocol#Tool Schema#Secure Proxy Layer#AI service discovery
Share:

Related articles