Module 6 · Lesson 2 · 14 min read
MCP architecture: host, client and server
MCP Architecture: Host, Client and Server
Introduction
To understand MCP in depth we need to know who does what. This lesson details the responsibilities of the host, the client and the server, the "one client per server" rule, and traces the journey of the user's question from the moment it is written until the tool's result reaches the model.
Learning objectives
- Describe the responsibilities of the host, the client and the server precisely
- Explain the relationship between the client and the server and why each server is isolated from the others
- Trace the sequence of messages when a tool is called from the user's question
- Distinguish between local and remote servers
Three roles with three responsibilities
Host
The host is the application the person deals with: a chat application, a development environment, or an agent running in the background. It has the final say, and its responsibilities are:
- Running the language model and managing the conversation.
- Creating a client for every server it wants to connect to.
- Gathering tools and resources from the servers and deciding what is shown to the model.
- Applying security policies and asking for user consent before sensitive operations.
Client
The client is a component inside the host, tied to a single server only. It sends requests in JSON-RPC 2.0 format, puts the protocol version in _meta for each request according to the 2026-07-28 specification, and receives the replies and passes them to the host. If the host wants to talk to three servers, it creates three clients.
Server
The server is a focused program that offers specific capabilities through tools, resources and prompts. It does not see the whole conversation and does not see the other servers; it sees only the requests that reach it. And it must provide the server/discover method so the client can learn about it and its capabilities.
Local and remote servers
| Kind | How it works | The usual transport | Example |
|---|---|---|---|
| Local | The host runs it as a subprocess on the same machine | stdio | A server that reads the files in the project folder |
| Remote | It runs on a web server that the client reaches over the network | Streamable HTTP | The university's ticketing system server |
We go deeper into transports in a later lesson; what matters now is that the architecture is the same in both cases: a host, clients and servers.
A question's journey: from the user to the tool
A student writes in the university assistant: "When is the CS101 lecture?" This is the sequence of what happens:
- The host has already asked each server for its list of tools through
tools/list(and it can learn about the server first throughserver/discover). - The host presents the available tools to the model together with the student's question.
- The model decides to call the
get_course_scheduletool with the argumentcourse_code: "CS101". - The host checks the policies, and asks for the user's consent if the tool is sensitive.
- The courses server's client sends a
tools/callrequest carrying the version in_meta. - The server runs the tool and returns a result containing
content, which may also containstructuredContent. - The host passes the result to the model, which writes the answer for the student.
Notice that the model never connects to the server directly; it proposes, and the host decides and executes through the client.
A practical example: a host with two clients
The following simulation (Python with no libraries, with the model replaced by a fixed rule) embodies three architectural rules: a client for each server, consent before sensitive tools, and the model never connecting to the server directly:
class Server:
def __init__(self, tools, sensitive=()):
self.tools, self.sensitive = tools, set(sensitive)
def handle(self, request):
name = request["params"]["name"]
args = request["params"]["arguments"]
text = self.tools[name](**args)
return {"content": [{"type": "text", "text": text}], "isError": False}
class Client: # one client tied to one server
def __init__(self, server):
self.server, self.next_id = server, 1
def call_tool(self, name, arguments):
request = {"jsonrpc": "2.0", "id": self.next_id, "method": "tools/call",
"params": {"name": name, "arguments": arguments,
"_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28"}}}
self.next_id += 1
return self.server.handle(request)
class Host:
def __init__(self, servers, ask_user):
self.clients = {n: Client(s) for n, s in servers.items()}
self.ask_user = ask_user
def run_tool(self, server_name, tool, args):
server = self.clients[server_name].server
if tool in server.sensitive and not self.ask_user(tool, args):
return "The user refused to run the tool"
result = self.clients[server_name].call_tool(tool, args)
return result["content"][0]["text"]
servers = {
"courses": Server({"get_course_schedule": lambda course_code: f"{course_code}: Sunday 10:00"}),
"mail": Server({"send_email": lambda to, body: f"Sent to {to}"}, sensitive=["send_email"]),
}
host = Host(servers, ask_user=lambda tool, args: False) # the user refuses here
print(host.run_tool("courses", "get_course_schedule", {"course_code": "CS101"}))
print(host.run_tool("mail", "send_email", {"to": "dr@example.edu", "body": "Hello"}))
print("Number of clients:", len(host.clients))Summary
The host is the application that manages the model, the conversation, security and user consent, and it creates a client for each server. The client is tied to a single server and sends JSON-RPC requests carrying the version in _meta. The server is focused and isolated from the others, and it must provide server/discover. And the model does not connect to the servers directly; it proposes and the host executes through the client.
Terms
| Term | English | Definition |
|---|---|---|
| Host | Host | The application that manages the model, the clients and the security policies |
| Client | Client | A component in the host that is tied to a single server and exchanges messages with it |
| Server | Server | A focused program that offers tools, resources and prompts |
| Local server | Local Server | A server that the host runs as a subprocess on the same machine |
| Remote server | Remote Server | A server reached over the network |
| User consent | User Consent | Explicit permission from the user before a sensitive operation |
Review questions
- Why is each client tied to only one server?
- What host responsibilities cannot be delegated to the server?
- In your own words, put in order the steps of calling a tool from the moment the user asks.
- What is the difference between a local and a remote server in terms of running and transport?
References
- MCP Specification 2026-07-28: Tools modelcontextprotocol.io Reviewed on 2026-11-18
- MCP Specification 2026-07-28: Changelog modelcontextprotocol.io Reviewed on 2026-11-18
