MCP Architecture & Workflow Explained
Understanding How Everything Fits Together
I know that this can be a lot to take in, especially if you are new to this space. The terms "host", "client", and "server" can be confusing because they are used in different contexts in software development. In the context of MCP, they have specific meanings.
These terms will be better understood once we see them in action. At this level, we are discovering the protocol but when practicing it, we will use an implementation that abstracts away some of the complexities. Indeed, MCP is a protocol, not a product but its implementations (frameworks and libraries) will provide the necessary abstractions that make it easier to build the whole ecosystem in a modular and practical way.
For now, we're focusing on the high-level concepts and how they fit together.
Understanding the theory is one thing, but seeing how it all works together in practice is another. Let's walk through a typical workflow of how the host, client, and server interact in an MCP system.
We will take the example of a smart home that has different smart devices:
- A device that can control your lights.
- A device that can control your thermostat.
- A device that can open and close your garage door.
The whole system is powered by a language model that can understand natural language commands and interact with these devices.
The user, using a voice interface, says: Turn on the living room lights. Here are the different interactions summarized in 10 steps:
Step 1:
The voice interface captures the user’s command and sends it to the application (the MCP host).
Step 2:
The host prepares a request for the language model. As part of this request, it includes the list of available tools that were previously discovered from connected MCP servers. To discover available tools, clients send a tools/list request (for example, a control_light tool exposed by the smart home server).
Step 3:
The AI agent receives the user’s request along with the tool definitions (names, descriptions, and input schemas). It analyzes the intent of the user’s message: Turn on the living room lights.
Step 4:
Based on the semantic meaning of the request, the descriptions of the available tools, its system prompt and other contextual information
Practical MCP with FastMCP & LangChain
Engineering the Agentic ExperienceEnroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!
