API MCP Google Cloud agents IA Model Context Protocol

MCP i API no són rivals: així connecta el Model Context Protocol els agents d’IA

MCP ofereix descobriment de tools, recursos i esquemes sobre JSON-RPC, mentre que les API continuen executant bona part de les operacions reals.

El Model Context Protocol, conegut com MCP, vol estandarditzar la manera com una aplicació d’intel·ligència artificial descobreix dades i eines externes. El vídeo de Google Cloud el contraposa a les API tradicionals, però la conclusió més important és que no les substitueix: MCP acostuma a situar-se al damunt d’una API, una base de dades o un servei i els presenta a l’agent amb una interfície comuna.

Què resol una API tradicional

Una API defineix un contracte entre programes. Un client coneix una ruta, envia paràmetres en un format determinat i rep una resposta previsible. REST i JSON han fet aquest model especialment popular, però la mateixa idea també s’aplica a RPC, GraphQL i altres estils.

Per al programari determinista, el desenvolupador decideix quina operació s’executa i en quin moment. Si una aplicació ha d’obrir un tiquet, el codi crida l’endpoint corresponent. Si després ha d’enviar un correu, una altra funció prepara la petició següent. La documentació, l’autenticació, els límits de velocitat, la paginació i els errors es resolen integració per integració.

Un model de llenguatge introdueix una capa diferent: rep una intenció en llenguatge natural i ha de triar una acció. No n’hi ha prou que l’endpoint existeixi; el model necessita una descripció clara, un esquema dels arguments i una manera uniforme de rebre el resultat.

Què afegeix MCP

MCP utilitza una arquitectura client-servidor. L’aplicació d’IA és l’host i crea un client per a cada servidor MCP. El servidor exposa capacitats relacionades amb un servei o una font de dades. Pot executar-se localment, connectat per entrada i sortida estàndard, o remotament mitjançant Streamable HTTP.

La capa de dades es basa en JSON-RPC 2.0 i inclou inicialització, negociació de capacitats i notificacions. Un servidor pot oferir tres primitives principals:

  • «Tools», funcions executables que poden consultar o modificar sistemes.
  • «Resources», dades que l’aplicació pot llegir com a context.
  • «Prompts», plantilles reutilitzables per estructurar interaccions.

Quan el client envia tools/list, rep el nom, la descripció i l’esquema JSON de cada eina. Si el model decideix utilitzar-ne una, l’aplicació tramita un tools/call amb els arguments validables. Això evita haver de copiar manualment la definició de cada funció dins d’un prompt.

Un exemple amb correu, documentació i incidències

Imaginem un agent de suport connectat al correu, a una base de coneixement i a un gestor de tiquets. Amb API directes, l’equip crea tres adaptadors, transforma respostes i explica al model quan ha d’usar cada funció.

Amb MCP, cada sistema pot exposar les operacions disponibles amb el mateix protocol. El client reuneix aquestes definicions en un registre d’eines i les posa a disposició del model. L’agent pot llegir un missatge, consultar documentació i proposar l’obertura d’una incidència sense que totes les descripcions s’hagin codificat en una integració exclusiva per a aquell model.

La feina, però, no desapareix. Algú ha de construir o desplegar el servidor, connectar-lo a l’API real, gestionar credencials, transformar errors i decidir quines operacions s’exposen. MCP estandarditza la frontera amb l’agent; no converteix automàticament qualsevol backend en una eina segura.

MCP sobre API, no MCP contra API

Google Cloud ho mostra de manera explícita a Apigee: una API existent es pot publicar com a tools d’un endpoint MCP. El protocol actua com una capa de descobriment i invocació per a clients compatibles, mentre que la lògica de negoci continua a l’API.

Això facilita reutilitzar un connector amb diferents hosts i models, però no garanteix compatibilitat absoluta. Els clients poden admetre versions o funcions diferents, i una descripció ambigua pot fer que el model triï malament. També continuen existint contractes, versions i proves.

El vídeo esmenta WebSocket com a possible connexió genèrica. L’especificació actual se centra en stdio per a processos locals i Streamable HTTP per a servidors remots, amb missatges JSON-RPC. És un detall important perquè MCP evoluciona i convé consultar la versió de la documentació en lloc de donar per fixos exemples antics.

La seguretat no es pot delegar al model

Descobrir una eina no implica tenir permís per executar-la. Un agent pot enviar correus, modificar fitxers o tocar recursos del núvol; una decisió equivocada pot ser irreversible. Per això cal separar identitat, autorització i confirmació.

Google recomana identitats pròpies per als agents de producció i permisos mínims, en lloc de reutilitzar les credencials completes d’una persona. També cal restringir claus, registrar accions, validar entrades i demanar aprovació humana per a canvis sensibles. L’especificació d’MCP inclou mecanismes d’autorització, però la política final depèn del servidor, el client i el sistema subjacent.

Altres riscos inclouen instruccions malicioses dins de dades llegides per l’agent, servidors locals compromesos, robatori de sessions o redireccions d’autenticació insegures. Un esquema correcte redueix errors de format, però no elimina la injecció de prompts ni el mal ús d’una eina legítima.

Quan té sentit adoptar MCP

MCP aporta més valor quan diversos agents o aplicacions han d’utilitzar les mateixes capacitats, quan el catàleg d’eines canvia o quan es vol evitar mantenir una capa diferent per a cada proveïdor de model. Una API directa pot continuar sent més simple per a una única crida ben definida dins d’una aplicació convencional.

Per això la comparació correcta no és quin dels dos guanyarà. Les API continuen sent la infraestructura que mou dades i executa negocis; MCP defineix com els sistemes orientats a models descobreixen i invoquen aquesta infraestructura. És una capa nova per a un client nou: l’agent.

Contrast i context

Fonts consultades

4 fonts
  1. 01
  2. 02
    Model Context Protocol Architecture overview
  3. 03
  4. 04

Font de treball

Transcripció amb marques de temps

10 fragments
Consulta la transcripció
  1. 0:04 , obre el vídeo en una pestanya nova

    If you've ever built an app that talks to an AI model, MCP changes everything. Because the way AI connects to your tools, data, and systems is being completely rewritten. For years, APIs used to be the glue that held everything together. But now there's a new standard rising fast, and that something is called the model context protocol, or MCP. And it might just be the biggest shift since APIs themselves. So what exactly is MCP, and why are people saying it could replace the way we integrate AI with everything around it. Let's break it down clearly so that by the end of this video, you'll understand how MCP actually works and how it's different from APIs, and why it's reshaping how we build agents and applications that use large language models. For decades, API were the universal handshake

  2. 1:05 , obre el vídeo en una pestanya nova

    between systems. You define an endpoint, you send a request and you got a response back. It's clean and predictable, and for traditional software, that is perfect. But when large language models enter the picture, everything changed. Models don't just call one endpoint, they might talk to 10 endpoints. They want to chain them together or even interpret unstructured data and also ask follow up questions. And that means they don't just need access to a tool, they also need context. But here's the problem APIs are built for programs talking to programs. They are not built for models. Reasoning over messy real world data and API is like a locked cabinet. You need to know exactly what drawer to open and what shape the key is. But a model is trying to understand what's inside the cabinet without clear labels so it doesn't know which function to call

  3. 2:08 , obre el vídeo en una pestanya nova

    or which parameters to pass until you tell it. And you have to hardcode it sometimes. And oftentimes have to keep explaining over and over again. That's where MCP comes in. It was designed to make models autonomously discover and use tools without the constant hand-holding that we've been doing in prompt engineering. So before we dive deeper, let's define both sides. Clearly, APIs are the traditional way software communicates. They expose specific endpoints. They accept requests in structured formats like JSON, and they return predictable outputs. Developers document them, secure them, and version them. But they assume one thing that both sides knows exactly what to expect. MCP flips that assumption. Instead of the model needing to be manually thought about each endpoint, MCP gives the model a standardized way to discover what a tool can do. What kind of inputs it expects, and what kind of outputs it returns all through context. Think of it like giving a model a live, machine readable map of your API instead of a static instruction manual. Now that sounds abstract, so let's make it real. Imagine you're building an AI agent that manages support tickets. You give it access to Gmail, notion, and Jira. With APIs. You'd write custom code for each integration,

  4. 3:40 , obre el vídeo en una pestanya nova

    handle issues like pagination, auth tokens, error cases, rate limits, and also teach the model through long prompts like when you want to create a Jira ticket. Call this endpoint with these fields when you want to reply to an email, call Gmail with this payload, but with MCP you don't need to do any of that. Each service like Gmail, notion, Jira exposes and MCP compatible interface. The model discovers these tools automatically and understands their functions as part of its environment. You don't tell it how to do it, you give the context and it figures it out dynamically. That's the core difference between APIs, which are code level contracts between two applications, and MCP, which is a semantic protocol between a model and its environment. So you're no longer teaching the model which endpoint to hit,

  5. 4:40 , obre el vídeo en una pestanya nova

    but you're giving it a structured description of what's available and letting it reason about which tool to use and when. It's like giving the model a toolbox instead of forcing it to memorize how each tool works. This shift might sound small, but it's actually massive for developers building agentic systems with APIs. The logic of what to call and when to call it lived in your app code. With MCP, that logic can actually move into the model's reasoning layer itself. You can now build a general purpose agent that can plug into any tool that supports the protocol, without having to rewrite code for each integration. That's the magic here, and it's standardization the same way HTTP made websites interoperable, allowing them to share and use data with each and other systems, and letting them work together to perform tasks with minimal human intervention. MCP is trying to make AI environments interoperable. But let's talk about what's actually happening under the hood. And MCP server is a lightweight process that sits next to your service or data source. It describes what it can do and what functions it exposes, all using JSON schemas. The model connects to this server through a standardized interface like WebSocket or HTTP, and receives metadata about the available resources. Once connected, the model can call these functions directly,

  6. 6:15 , obre el vídeo en una pestanya nova

    not by guessing, but by using the metadata. It knows what inputs are required and what each field means and what type of output to expect. The beauty is that everything is self-describing. You don't have to prompt engineer the schema or reformat responses. It's all standardized. Compare that to an API where every single integration is bespoke. You need a developer to read the docs, map the payloads, and manually wrap the endpoints so MCP abstracts that away. This means instead of building 100 custom integrations, you build one MCP interface and every compatible model can use it instantly. That's why people are calling MCP the plug and play layer for AI systems. Now, this doesn't mean APIs are going away. APIs are still the foundation. They're how your systems actually function. But MCP changes how models access those APIs.

  7. 7:16 , obre el vídeo en una pestanya nova

    Think of it like this. MCP doesn't replace your backend. It replaces the middleware between the model and the API. The MCP server acts like a translator, converting your existing APIs into a format that models can understand automatically. So instead of saying MCP versus API, it's more like MCP on top of APIs. This distinction is key. MCP doesn't compete with APIs. It actually leverages them, but it changes who the client is with API. The client is another program or user with MCP, the client is the model itself. And that subtle difference changes everything about how we design integrations. Let's Zoom out for a bit. The rise of MCP is part of a bigger movement towards model native software architecture. For decades, we've built systems for humans and for code.

  8. 8:17 , obre el vídeo en una pestanya nova

    Now we're building systems for models and models don't consume REST endpoints the way code does. They consume context, which includes structured descriptions, schemas, and examples. They do this so that they can reason, plan and act. So MCP gives them that in a standardized way. That's why developers building agent frameworks are moving in this direction. They're realizing that connecting a model to a world of tools isn't about a bigger context window. It's about cleaner protocols. And let's be honest, it's not all magic. MCP is still pretty new. The biggest challenge right now is adoption. For MCP to truly work, the ecosystem needs servers, clients, and tools to agree on the same standard. Another huge challenge is security and control. When models can directly call tools through a protocol, you need clear permission layers. You don't want a model accidentally sending an email, deleting a file or making a huge database change that it wasn't supposed to. APIs handle that through authentication keys and rate limits. MCP needs to bring those guardrails into its protocol layer, which is already happening. The spec defines capabilities, scopes, and authentication methods that keep things safe. But it's still early days, and the final challenge is the developer mindset. Most of us grew up in an API world.

  9. 9:48 , obre el vídeo en una pestanya nova

    We think in terms of endpoints and routes. MCP asks us to think in terms of capabilities and context to design systems that describe what they can do, not just how to do it. That's a huge paradigm shift, but it's worth learning early. Here's where it all comes together. Think about the moment when HTTP unified the internet. Before that, every service had its own protocol from FTP, Gopher, Telnet, which are all different internet protocols. Once the web standardized on HTTP, suddenly everything became interoperable. MCP is doing the same thing for AI agents. Instead of each company inventing its own plugin format or integration layer, MCP provides a single open protocol that any model can understand. You build your connector once and any compliant model can use it. That means the future of AI tools will look less like custom integrations

  10. 10:49 , obre el vídeo en una pestanya nova

    and more like a shared ecosystem. You will have an MCP server for your product and any AI like Gemini Claude GPT can use it instantly. That's the world we're heading towards, one where models, not just humans, become first class users of software. So to sum it all up APIs are not dead. They are just evolving. APIs were made for deterministic systems. One program asking another for data, and MCP is made for probabilistic realistic systems, a model reasoning about what it can do. So the next time someone says MCP versus API, just remember it's not a direct comparison. It's a foundation being rebuilt. MCP sits one layer above APIs and turning them from static routes into living interfaces that models can actually reason about. And as more frameworks adopt it, you'll start seeing a new pattern emerge. Instead of hard coded integrations, we'll build model aware systems where context, tools, and reasoning can all live in harmony. I hope this video was helpful in explaining the differences between MYC and APIs. To learn more about the model context protocol at a deeper level, check out this next video.