No history yet

MCP Architecture Deep-Dive

The Host, Client, and Server

At its core, the Model Context Protocol (MCP) organizes communication into a clear, three-part structure. This isn't just about a model talking to a tool; it's a managed conversation between distinct architectural components: the Host, the Client, and the Server.

The Host is the orchestrator. It's the application that wants to accomplish a task, like a code editor, an analytics dashboard, or a chatbot framework. The Host doesn't speak directly to the LLM. Instead, it manages the overall goal and provides the user interface.

The Client is the part of the AI system that directly wraps the Large Language Model. It acts as an adapter, translating the Host's goals into prompts for the LLM and managing the communication link to one or more MCP Servers. The Client's job is to use the LLM's reasoning capabilities to decide which tools are needed.

The Server is the tool itself. It exposes a set of capabilities—like accessing a database, reading a file system, or calling a proprietary API—through a standardized MCP interface. It doesn't know or care which specific LLM is on the other end; it just responds to valid requests from any MCP Client.

This separation is critical. The Host worries about the 'what,' the Client handles the 'how' through reasoning, and the Servers provide the 'means' by exposing capabilities. This modularity allows any Host to work with any Client and any set of Servers, preventing the kind of tight coupling that plagues custom plugin ecosystems.

The Connection Lifecycle

An MCP interaction is not a series of stateless, disconnected API calls. It's a stateful session with a defined lifecycle, all transported over .

  1. Discovery: The Client first discovers available Servers. This can be done through a registry or local configuration. The goal is to find servers that offer the capabilities needed for the Host's task.
  2. Handshaking: Once a Server is identified, the Client initiates a connection and begins the . During this phase, the client and server exchange metadata. The server declares the tools it offers, their function signatures, and any authentication requirements. The client might provide information about its own identity or the user it represents.
  3. Active Session: After a successful handshake, the session is active. The Client can now make remote procedure calls to the Server to execute tools. The Server maintains the state of these interactions—for instance, keeping a database connection open or remembering the current working directory. The connection remains open, allowing for a continuous, low-latency conversation.
  4. Termination: The session ends when the Host's task is complete or when one side explicitly closes the connection. All state associated with that session on the Server is then torn down.

This stateful nature is a fundamental advantage. A traditional plugin might require the LLM to pass a session token back and forth with every call. In MCP, the state is managed at the protocol level, simplifying the logic required by the LLM and the tools.

FeatureAd-Hoc LLM Plugins (REST API)Model Context Protocol (MCP)
ConnectionStateless (new connection per call)Stateful (persistent session)
State ManagementHandled in application logic (e.g., passing tokens)Managed at the protocol level
DiscoveryManual or via proprietary marketplaceStandardized discovery & handshaking
CommunicationUnidirectional (Client -> Server)Bidirectional (Server can send notifications)
IntegrationCustom, one-off for each toolStandardized, reusable across any client/server

The Architectural Edge

In a technical interview, articulating why MCP is a superior architecture is key. It's not just a different way to call a tool; it's a more robust, scalable, and secure paradigm for building agentic AI systems.

First, standardization replaces fragmentation. Instead of building N*M custom integrations for N models and M tools, you build N clients and M servers that all speak the same language. This drastically reduces development overhead and fosters a reusable ecosystem of tools.

Second, stateful sessions are more efficient and powerful. For complex tasks involving multiple steps—like connecting to a database, running a query, and then transforming the results—a stateful session avoids the latency and complexity of re-authenticating and re-establishing context with every single call. The server remembers the context of the session, just as a human would.

Finally, the architecture provides clear security and governance boundaries. Because the Server defines exactly what capabilities it exposes, a host system can control precisely what an AI agent is allowed to do. You grant access at the MCP Server level, creating an auditable chokepoint rather than letting an LLM call arbitrary internal APIs directly.

MCP follows a client-server architecture, providing a flexible and scalable framework for AI models to interact with external tools and data sources.

When an interviewer asks about the rationale for adopting MCP, these are the points to emphasize. It's about moving from brittle, custom code to a formal, engineered protocol designed for the unique demands of multi-step, tool-using AI agents in a production environment.