Architecture: Hosts, Clients, and Servers
- Describe the distinct responsibilities of a host, a client, and a server
- Explain why MCP enforces one client per server connection
- Trace a tool call from user input through the full host-client-server round trip
Three Roles, One Protocol
Every MCP deployment involves exactly three kinds of participants. Getting their roles clear is fundamental — confusion between them is the most common source of architectural mistakes.
- Host — the AI application the user runs. Claude Desktop, Claude Code, VS Code with Continue, and Cursor are all hosts. The host coordinates one or more clients, manages the LLM, and presents results to the user.
- Client — a component the host creates and manages, one per server it connects to. The client maintains a live connection to exactly one server, sends requests, and returns results to the host.
- Server — an independent program that exposes capabilities (tools, resources, or prompts). Servers are written by tool authors, not by LLM vendors. They run separately from the host and know nothing about which LLM is on the other end.
Hosts in Detail
When the host starts up, it reads a configuration file that lists the servers the user wants to connect to. For each listed server, the host creates a client, which establishes the connection. The host queries each server for its capabilities and merges everything into a unified registry.
When the user sends a message, the host passes it to the LLM along with the aggregated tool list. If the LLM calls a tool, the host routes the call to the client managing the server that owns that tool. When the result comes back, the host injects it into the conversation and lets the model continue.
The host is also responsible for the human-in-the-loop requirements the protocol mandates: showing users which tools are available, marking tool invocations visually, and in some cases asking the user to confirm before a tool executes.
Clients in Detail
A client is a connection manager. Each client maintains exactly one persistent connection to exactly one server. The client speaks the MCP wire protocol — it sends JSON-RPC requests and receives JSON-RPC responses. It handles transport specifics (launching a subprocess for stdio, making HTTP requests for Streamable HTTP) so the host does not have to.
Local servers using stdio are usually served by a single client, because each subprocess is an isolated process. Remote servers using Streamable HTTP can serve many clients simultaneously. Clients are created and destroyed by the host as servers are added or removed from configuration.
Servers in Detail
A server is an independent executable that speaks the MCP protocol. It can be written in any language — Python, TypeScript, Go, Rust, Java, or anything that can read from stdin and write to stdout (for stdio), or handle HTTP requests (for Streamable HTTP). The official SDK provides implementations for all major languages.
The server's job is narrow: expose capabilities and execute requests. It does not know what LLM is on the other side. It does not manage conversation state. It listens for requests, executes them, and returns results. This narrowness makes servers easy to test, audit, and reuse across multiple hosts.
The One-Client-Per-Server Rule
MCP enforces a strict one-to-one relationship between clients and servers at the connection level. One client connects to one server and only one server.
This has three important consequences. First, routing is deterministic — the host always knows which server produced which result. Second, security containment is straightforward — if one server misbehaves, the host terminates that specific client without affecting others. Third, failure handling is clean — the host can reconnect one client independently.
Local vs Remote Servers
Local servers run on the same machine as the host. The client launches them as a subprocess and communicates over stdin/stdout (the stdio transport). No network, no authentication, no firewall rules. Local servers serve only the clients on that machine — ideal for filesystem access, scripts, or any capability that makes sense only on the user's machine.
Remote servers run somewhere on the network. Clients connect via HTTP using the Streamable HTTP transport. Remote servers can serve many clients simultaneously and support bearer token authentication and OAuth, making them suitable for production multi-tenant deployments.
How a Tool Call Travels End to End
- The user types a request in Claude Desktop (the host).
- The host sends the request to the LLM, including all tools aggregated from all connected servers.
- The LLM responds with a tool call — say,
search_webwith{"query": "MCP architecture"}. - The host looks up which server owns
search_weband sends the call to the corresponding client. - The client wraps it in a JSON-RPC
tools/callrequest and sends it over the transport. - The server executes the search and returns a JSON-RPC response with the results.
- The client unwraps the response and returns the results to the host.
- The host injects the results into the conversation as a tool result message.
- The LLM reads the results and continues generating its response.
The LLM never communicates directly with the server. It only sees the tool list (assembled by the host) and the tool results (injected by the host). The protocol exchange is entirely between the client and the server.
How the Host Assembles the Tool Registry
When a host connects to multiple servers, it queries each one with tools/list and merges all definitions into a single registry. It typically prefixes each tool name with the server identifier to avoid collisions — filesystem__read_file and github__read_file are both read_file at the server level, disambiguated by the host. The LLM sees a flat list and picks one; the host uses the prefix to route the call to the right client.
- Hosts aggregate capabilities from all connected servers into one tool registry for the LLM
- Clients are connection managers — one per server, created and destroyed by the host
- Servers are narrow and stateless by design, which makes them easy to test and reuse
Progress is saved in this browser only — clear your cache or switch device and it's gone. Create a free account and it follows you everywhere.