Demystifying MCP
Transcript
Made automatically from the video's sound, so it may contain mistakes. Click a line to play from there.
You know that absolute headache of writing endless custom glue code just to get your LLM to read a database or check a local file system? Well, if you've been building in the AI space, you've definitely know that friction. But today, we're gonna solve that.
Welcome to this explainer, where we're demystifying a universal standard designed to eliminate that headache entirely, the Model Context Protocol, or MCP for short. So, the absolutely crucial point to understand right out of the gate is that MCP strictly handles how your AI gets its data, not how it uses it.
It really doesn't care what LLM you're running or how you're managing your prompt engineering. Instead, it acts as a stateless exchange protocol, utilizing a super lightweight data format called JSON RPC 2.0.
You can basically think of it as a universal bridge. It creates a standardized way for AI applications to request and receive contextual info from external data sources. It is quite literally the ultimate plug and play adapter for AI context.
To give you a solid scalable mental model, we're gonna break this down step by step today. We just met the protocol itself, so next we'll look at hosts, clients, and servers. Then we'll map out the data and transport layers, dive into the core primitives, and finally wrap up by seeing real-time MCP in action.
Okay, moving right into part two. Hosts, clients, and servers. Let's meet the cast of characters that actually build the foundation of this entire protocol.
Now this operates on a pretty standard client-server model, but it introduces a specific hierarchy with a really strict separation of concerns. At the very top, we have the MCP host. This is your actual AI application.
ThinkClaude Desktop or Visual Studio Code. The host doesn't actually talk to servers directly. Instead, it spins up an MCP client for every connection it needs. That client is just a dedicated manager for that specific link.
And finally, at the bottom, we have the MCP server, which is the program actually serving up the context data. Because of this setup, one single host can seamlessly coordinate multiple dedicated clients, each talking to a completely different server at the exact same time.
What's really interesting here is how it handles networking overhead, because your servers don't all have to live in the same place. If you're running a local file system server, MCP can use standard input/slash output streams, or STDI.
That means it communicates directly between local processes on your machine with absolutely zero network overhead. But if you need to reach out to an external platform, say a remote sensory server for air tracking, MCP just switches to streamable HTTP.
It's incredibly flexible. Let's jump into section three, data and transport layers. This is where we get into the actual rules of engagement that these participants have to follow to communicate.
The architecture is split neatly into two layers, starting with the outer one, the transport layer. Think of this as the secure pipes between your clients and servers. It completely abstracts the messy communication details away.
As we just mentioned, it handles STDIO for your local connections and streamable HTTP using post requests and server-sent events for the remote ones. Crucially, though, this layer also handles authentication, natively supporting standard methods like bearer tokens and OAuth.
Because of this, the inner data layer never has to worry about how the message is getting there or if it's secure. The transport layer does all that heavy lifting. Now, inside those secure pipes sits the data layer.
This is what defines the actual message structure and semantics. And because this layer is entirely stateless, every single request essentially has to pack its own backs. It carries the protocol version and the relevant client capabilities right there in its metadata field.
The server doesn't remember who you are from the last request, which is exactly what makes the whole system so incredibly resilient and easy to scale. Moving right along to section four, the core primitives. Let's look at the actual building blocks of context that these servers expose.
There are three core primitives an MCP server can offer up. First, you've got tools. These are executable functions the AI can actually invoke to do things, like querying a database or fetching the local weather.
Second, a resources. This is your raw context data, like pulling the contents of a text file or an API response. And third, prompts.
These are reusable templates to structure LLM interactions, like system prompts or a few shot examples. The huge takeaway here is that clients use really simple list methods, like toolslash list to discover these dynamic primitives before they ever even try executing or reading them.
But hey, it's not strictly a one-way street. While servers do provide most of the context, clients can expose capabilities too. For example, a client can declare support for elicitation. This is super cool because it allows the server to literally pause the action and ask the AI application to gather additional user input or confirmation before it proceeds.
So it really opens the door for much richer, multi-round trip interactions. Alright, section five, real-time MCP in action. Let's put this entire system in motion and look at a day in the life of a request to see how an AI actually discovers and uses a tool.
It all kicks off with the discovery exchange. Before any real action happens, the client sends a server slash discover request, which does three things in sequence. First, it syncs the protocol version so both sides are definitely speaking the exact same language.
Next, it exchanges capabilities, like the server saying, Hey, I support tools, and the client replying, great, I support a licitation. Finally, they exchange identity for debugging purposes. This handshake ensures that unsupported operations are literally never attempted.
Once that handshake is done, the client asks for a list of tools, and when the server responds, it doesn't just casually say, I have a weather tool. No, it returns a highly structured array. It gives an exact name, a human readable title, a detailed description of exactly when the AI should use it, and a strict JSON schema defining what parameters are required.
This is basically magic because it allows the AI application to dynamically build a unified tool registry on the fly without you writing a single line of custom glue code. The LLM instantly knows exactly what it can do.
So when the LLM actually decides to take action, say, checking that weather in San Francisco, it fires off a tool execution request. And this relies on a few key elements to ensure absolute type safety. The tool name has to be an exact match from discovery.
The arguments have to perfectly match that JSON input schema we just talked about. And, because we know MCP is stateless, it includes that standard meta field with the protocol version and capabilities, all wrapped up in a JSON RPC structure with a unique ID.
The server processes that request and fires back a tool execution response, and this response is incredibly versatile. It isn't just dumping a raw string back at you, it's an array of structured content objects.
A single response can include plain text, images, or resource data simultaneously, perfectly formatted for the AI to ingest straight as context. The real game changer for developers here is that MCP handles all of that routing completely seamlessly.
Your LLM decides to make a tool call. Your AI application's host intercepts it, finds the right client, routes the request to the correct server, executes it, and feeds that structured data right back into the conversation.
It enables your LLM to access real-time data dynamically, without being hard coded to any specific backend whatsoever. Now, you might be wondering what happens when the available tools actually change? Well, MCP handles this beautifully with change notifications.
These are long-lived subscriptions that allow servers to push real-time updates directly to clients whenever their internal states change. These notifications are super efficient. Staying true to JS and RPC 2.0 semantics, they require no response from the client.
They're also strictly opt-in, meaning the client has to explicitly ask to listen for tool changes. When an event does fire, it's tagged with a specific subscription ID so the client knows exactly what changed.
Because this whole thing is event driven, it completely eliminates that massive overhead of clients constantly pulling the server to ask, hey, did anything change yet? By just responding to these subscription tags, AI applications can immediately refresh their tool registry, adapting to new functionality on the fly as it happens.
So there you have it. We've mapped out the participants, the transport layers, the core primitives, and the real time execution. You now have a comprehensive understanding of the model context protocol.
It's fundamentally standardizing how AI talks to the world and removing the friction of custom integrations for good. With the Universal Adapter now right at your fingertips, the only question left to ask is what context will you provide to your AI next?
Thanks so much for joining me on this explainer. Keep building and I'll catch you next time.