Model Context Protocol (MCP) vs REST API: Why MCP Is the Better Fit for AI Agents Than REST or BFF
From the publisher’s feed, collected in the ZeroLabs newsroom.
MCP vs REST isn’t just another tech comparison.Modern intelligent agents, especially those powered by large language models (LLMs), increasingly rely on external tools and real-time data to operate effectively. Traditionally, this interaction has been handled via REST APIs: developers expose endpoint specifications, and agents leverage them — typically through function calling or similar tool-use mechanisms — to fulfill specific tasks.Photo by Call Me Fred on UnsplashBefore we start!🦾If this piece gives you something practical you can take into your own system:👏 leave 50 claps (yes, you can!) — Medium’s algorithm favors this, increasing visibility to others who then discover the article.🔔 Follow me on Medium and LinkedIn for more deep dives into agentic systems, LLM architecture, and production-grade AI engineering.However, this approach quickly runs into scaling issues. Each integration requires bespoke code, leading to fragmented architectures that are hard to maintain and evolve. This is often referred to as the MxN problem — the combinatorial challenge of connecting M different models to N different tools, resulting in a proliferation of custom, brittle bridges.Even the most advanced AI systems remain limited when isolated from live, dynamic data. They’re frequently locked behind legacy systems and information silos, where adding just one new data source often demands yet another custom integration.As architectures grow more complex, REST-based approaches tend to introduce duplication, logic sprawl, and scalability bottlenecks.This is where the Model Context Protocol (MCP) comes in — an open standard designed to give AI models a unified, contextual, and dynamic interface for interacting with tools and data at scale.But why is this even necessary? Why invest in yet another abstraction that seems to merely formalize a combination of existing technologies?If I already have a set of microservices, couldn’t I just build a single proxy layer to connect them to an AI agent? Or better yet — use a proven Backend-for-Frontend (BFF) pattern to structure this interaction? Why should I bother learning something like MCP?These are valid questions — and ones many experienced engineers ask.In this article, we’ll:Review how REST APIs are typically used by AI agents todayExamine their limitations in real-world scenarios (data silos, tool orchestration, context loss)Explore what the Model Context Protocol (MCP) actually is and how it worksShow how MCP addresses concrete pain points developers face todayClarify what MCP doesn’t solve — its boundaries and trade-offsLet’s go a little deeper into the details of how everything works there.And finally, offer practical advice on when adopting MCP makes sense (and when it might not)REST API: Traditional Integration ApproachREST (Representational State Transfer) is the dominant architectural style for exhibiting functionality or data through HTTP-based services. In the agent’s workflows, this means that each data source or external tool is accessed through dedicated HTTP endpoints. These endpoints are documented (for example, using OpenAPI), and the developer writes code for the agent to call them with the appropriate parameters and interpret the answers.Script example: The agent must receive product information from the company's database and send a message to Slack. The developer exhibits two REST APIs: one for the database, one for Slack. The agent is encoded to read API specifications and build appropriate HTTP calls.While REST is standardized, scaled and widely supported, it becomes a bottleneck when an agent must dynamically choose between tools, maintain the context between calls, or work autonomously.REST restrictions for AI Agents❌ Fragmented InterfacesEach REST API has its own auth, parameters, response format and error codes. The agent does not have a single way to detect and use tools through the API. This leads to fragile adhesive code and duplicated logic.❌ Static LinkingREST endpoints are static. The agent must “know in advance ” which endpoint to use and how. For him, there is no built-in way to dynamically detect opportunities or decide during execution what actions to take.❌ Stateless Hurts ContextREST does not have design citizenship. This means that each call is independent, and the API does not remember past interactions. But agents benefit greatly from the continuity of the session: knowing what has been said/done to the point.❌ Prompt Bloat от API SpecsWhen trying to enter multiple API specifications into an LLM request, the input can quickly exceed the model context window. Long API documentation is difficult to process and prone to errors for models.❌ Lack of Push / Event AwarenessThe REST API cannot actively notify the agent of the changes. Agents have to conduct surveys periodically or use web hooks, which adds latency and complexity.❌ Orchestration OverheadTo model smart behavior, developers ultimately create orchestral layers (such as LangChain). These layers support memory, trigger actions, and aggregated results, but this logic is not part of the REST — it’s custom infrastructure protocol.Enter MCP: Context Protocol ModelModel Context Protocol (MCP) is an open, supplier-neutral standard (developed by Anthropic) that defines how the AI model can interact with external tools and data sources in a unified, contextual, and sessional way.Key Ideas Behind MCPThe model works in a structured form session.It can see resources (e.g., files, documents, databases).It can call tools (e.g,. functions with input circuits).It has access to a full dialogue and interaction history.All this happens through standardized message types, not custom glue code.It is independent of a specific AI model or vendor.Think of MCP as USB-C for AI agents: one port, one protocol, many compatible tools.Benefits of MCP vs REST✔ Single interface for all toolsNo more individual API integrations. Each tool or data source is a standard MCP server that provides resources and tools.✔ Structured Tool CallModels find tools through tools/listcalling them through tools/call, and describe the inputs through the JSON scheme. No custom HTTP logic.✔ Context memory through sessionsThe agent sees past actions, inputs, tool results — all in its working context. You can reproduce, summarize and check full interactions.✔ Real-time updates through eventsServers can push data / events to an agent (for example, “a new file downloaded ”) via SSE or WebSocket.✔ Observability and controlEach call and tool response is a structured message. It is easy to track, verify or block sensitive actions.✔ InteroperabilityWrite one MCP server for your service and reuse it in agents, IDE, browsers, etc. D. Stop inventing the logic of integration.What MCP does not decide❌ Not agent protocol to agentMCP connects models for tools not models for other models. For coordination between agents, other protocols (e.g. may be needed ACP, A2A)❌ Security is up to youMCP offers structure and control, but access control, sandbox and enforcement it is your responsibility.❌ Initial setup overheadWriting a fully functional MCP server requires planning (schemes, resource design, streaming). This is more effort than writing a fast REST endpoint.❌ The model still needs guidanceMCP gives models tools and data, but does not make them smarter. You still need well-designed instructions, good examples, and guards.How does MCP work?Components:Context: In AI systems, context refers to the information the model uses to generate relevant and coherent responses. For LLMs, this includes the input text, conversation history, and any additional information provided to help the model understand the task.Protocol: A standardized set of rules that allows different systems to communicate with each other. MCP uses JSON-RPC 2.0 as its underlying protocol for message exchange.Host: The main AI application (e.g., Claude Desktop, IDE (Windsurf/Cursor), or agent) that manages MCP clients and coordinates AI/LLM integration.Client: An intermediary component within the host that connects to an MCP server, handling protocol negotiation and message routing.Server: A lightweight program that exposes specific capabilities (resources, tools, prompts) through the MCP protocol.Primitives: The core message types that govern interactions in MCP, including resources, prompts, tools, and sampling.More here: https://modelcontextprotocol.io/introductionOne MCP Server Per Microservice or a Shared One?Personally, I don’t think there is a clear answer, depending on the architecture and implementation details. Lets resoning.Why per-microservice?Separation of concerns: Keeps logic focused and maintainable. Clear separation of concerns (Single Responsibility Principle). Independent deployment, scaling, and monitoring.Clear ownership: The team responsible order-service can maintain order-mcp-server. Yoca can locate this one even in the existing code base, but like a module, just add another dependency to it using the same DI (e.g., Dependency Injection).Security boundaries: Easier to enforce fine-grained permissions.Scaling independently: But to avoid problems with scaling, you can deploy the MCP server near the service. If your analytics tools are heavy, you can scale the MCP server separately.When to use a shared MCP server?For small projects or related capabilities (e.g., if you have 3 small services around messaging, wrap them under one communications-mcp-server).If you have a legacy monolith, a single MCP facade may be more practical.To prototype quickly without deploying many new services.How Does an MCP Server Know Which Microservice to Call?MCP servers act as adapters. Internally, they’re just programs that:Accept JSON-RPC 2.0 calls from the AI client.Map those calls to backend service operations.You configure the connections manually, often via environment variables or config files. For example:# inventory-mcp-server/config.yamlinventory_api_base_url: https://internal-api.company.com/inventoryapi_key: ${INVENTORY_API_KEY}timeout: 5sInside the MCP server code, when a tool like get_inventory(item_id) is called, it translates this into an HTTP request to:GET https://internal-api.company.com/inventory/items/{item_id}Authorization: Bearer {api_key}Or perhaps it connects directly to a Postgres DB, Snowflake, or internal SDK.You decide how deep it goes:Basic REST passthrough?Data transformation?Business logic aggregation?The key is that your MCP server encapsulates this, exposing a clean, standardized interface to the AI, so the model doesn’t have to know how anything works under the hood.Common misconception: “Will the model run out of context? ”Short answer: No — the model does not receive the entire history or data at once.MCP client (host application) decides which subset of messages / resources to convey to the prompt.Long-term session memory is stored outside the model.Methods such as summation, memory window and extraction limit the amount of invested funds in the model.MCP provides structured access for a bigger world, but only puts an appropriate cut at every step.The stream of the Session:The host starts the session through an MCP client.It connects to relevant MCP servers (e.g., Google Drive, GitHub).The model feeds on a structured tooltip: current messages, tool,s and resources.Model Launches tool_use commands (e.g,. “search_email ” with ferries).The MCP client executes them against the correct server.The answer is returned as tool_result.The loop continues with an updated context.This design shares decision making (model) from execution (host/client), keeping everything in the general message log.So, why not use REST or BFF?You absolutely can — and many teams do — wire AI agents directly to internal REST APIs, or introduce a BFF (Backend-for-Frontend) layer to simplify access. But it’s important to recognize that both REST and BFF were designed for deterministic clients (like web or mobile apps), where every request and response is explicitly coded in advance.By contrast, AI agents such as large language models (LLMs) operate probabilistically: they infer what needs to happen based on user intent, prior context, and available capabilities. These systems are not hardcoded workflows — they’re autonomous decision-makers.This is where Model Context Protocol (MCP) introduces a fundamental shift. It doesn’t just expose data — it gives the LLM tools, context, and a standardized execution environment. Agents can dynamically discover, reason about, and invoke tools through a shared protocol — no brittle wiring required.With REST, every possible interaction must be pre-defined and encoded ahead of time. With BFF, you create a proxy that optimizes API calls for specific UIs — a helpful abstraction, but still rooted in hardcoded flows.MCP, however, introduces a new level of abstraction, designed for AI. Instead of wiring your agents to fixed routes, you expose tools via a shared protocol. The LLM reads what’s available, reasons about what it needs, and invokes tools dynamically via structured calls like this:json{ "jsonrpc": "2.0", "method": "tool.invoke", "params": { "toolName": "getWeather", "args": { "location": "London" } }, "id": 1}This is not just a protocol — it’s an execution layer that lets AI agents orchestrate real-world tasks autonomously.ConclusionThis is not a revolution, but an evolution through standardization. [composio.dev]You can live without MCP, but then everyone will solve the same integration problems in their own way, while MCP sets uniform templates (list resources, invoke tool, etc.).Reduced Integration OverheadOne standard to rule them all: Say goodbye to fragmented REST glue. MCP introduces a clean, declarative interface between agents and tools.Smarter agents: Agents can make decisions, access toolchains, and understand their own history, without needing hardcoded API paths.Write once, use anywhere: Define a tool adapter once and reuse it across different agents and contexts.Improved Control and ObservabilityTrack and log everything the model tries to do, not just what it says.Establish secure boundaries without limiting AI capabilities.MCP significantly lowers the complexity and cost of integrating AI into microservice-based systems.Without it, developers are often forced to:Build custom BFF-style middleware with assistant-specific logic, orUse orchestration frameworks like LangChain, Semantic Kernel, etc., and manually write adapters for each individual service.Real Benefits in PracticeMCP accelerates AI adoption:Prototype faster by mixing and matching existing MCP-compliant services.No need to expose new APIs or rewrite old ones.If the idea doesn’t work, turn off the MCP server. If it does, you’re already in production.If you create AI-native applications, then MCP is the evolution you want. This gives agents both the context and the agency — the ability to think and act in a rich, observable environment.And that’s a wrap! If you’ve read this far, it probably means you found this article useful or insightful. If that’s the case, consider leaving a few claps or sharing it with your team, please. Thanks for reading! 🚀Sources and LinksResources and Further Reading🔗 Official MCP HomepageOfficial landing page for MCP by Anthropic with technical docs and news.📚 MCP Protocol SpecificationThe GitHub repo contains the full spec, design rationale, and links to SDKs.⚙️ MCP SDKs and Example ServersTypeScript MCP SDKPython SDK (Community)Go MCP GitHub Server🧠 Intro Blog from AnthropicExplains why MCP was created, with example use cases and ecosystem plans.🛠️ DeepSet Blog: “MCP and LLM Integration”A practical perspective on how MCP can be used with agents to dynamically access external tools.🔐 Stytch: “Authentication and Authorization in MCP”Explores how OAuth2 and security are handled in MCP-based environments.🧹 PromptHub: Using MCP with OpenAI & LangChainHow to wire MCP into existing LLM agent workflows built on LangChain.📺 Workshop: Building Agents with MCP (YouTube)Presentation by Anthropic engineers explaining the protocol with live demos.Model Context Protocol (MCP) vs REST API: Why MCP Is the Better Fit for AI Agents Than REST or BFF was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.