Topic 2 of 5 · 4 min read
Hosts, clients and servers in an MCP setup
Goal: Label the host, clients and servers in a described setup and say which component enforces user consent and which one executes a tool.
An MCP host is the AI application the user talks to; it creates one MCP client for every MCP server it connects to, and each server is a separate program that exposes capabilities.
Check yourself · 1 of 3
Claude Code is connected to a GitHub server and a filesystem server. How many MCP clients does it run?
Why it matters
When something goes wrong, such as a tool that ran without asking or a server that cannot be reached, you need to know which component to look at. People often say "the MCP" for all three parts. The official architecture page separates them.
The three roles
- Host: the application with the model and the user interface. Claude Code, Claude Desktop and Visual Studio Code are hosts. The host decides which servers to connect, shows tool calls to the user, asks for consent and sends context to the model.
- Client: a component inside the host that keeps one dedicated connection to one server. Connect to three servers and the host runs three clients. The client sends requests, receives results and hands them to the host.
- Server: a program that provides context and capabilities. "Server" says nothing about where it runs. A filesystem server launched as a subprocess on your laptop is a local server. The Sentry server, reached over HTTP, is a remote server.
Who does what in a tool call
- The model, running inside the host's loop, asks to call a tool such as
create_issue. - The host decides whether the user must approve. This is where consent lives.
- The host passes the call to the matching client.
- The client sends the request to its server.
- The server runs the code and returns a result, which travels back the same way.
The model never talks to a server directly. It only sees what the host puts in its context. The server executes the tool, but the host enforces consent and decides what the model sees.
Before and after
Weak description: "Claude connects to our MCP, and the MCP deletes the files." That blurs the model, the host and the server and hides where an approval step would go.
Better: "Claude Code is the host. It runs a client for the filesystem server, a local subprocess. The model proposes delete_file, the host asks the user, and only after approval does the client forward the call to the server, which deletes the file."
What goes wrong
- Assuming the server asks the user. Servers cannot show a prompt on their own. Consent is a host feature, and hosts differ.
- Sharing one connection across servers. The architecture gives each server its own client, so a failure or restart of one connection does not touch the others.
- Trusting a remote server like local code. A local server runs with your user's rights. A remote server runs elsewhere, under someone else's operations and updates.
- Forgetting the model sits in the host. Tool descriptions from a server are text that reaches the model, so a malicious description can try to steer it.
Examples
One host, three servers
Visual Studio Code is open with a filesystem server (local subprocess), a Postgres server (local subprocess) and the Sentry server (remote over HTTP). The host is VS Code, it runs 3 clients, and there are 3 servers. If the Sentry connection drops, the filesystem and Postgres clients keep working.
Where consent belongs
A review comment says "the GitHub server should ask before merging". The server can describe a tool as destructive, but it cannot prompt the user. The fix is a host setting that requires approval for that tool, or running the host in a mode that asks for every write.
Key points
- The host is the AI application; it creates one client per server connection and holds the model and the user interface.
- Each client keeps a dedicated connection to exactly one server, so servers fail and restart independently.
- Local versus remote describes where a server runs, not what it can do.
- The host enforces user consent and controls what the model sees; the server executes the tool.
- Text from a server, including tool descriptions, reaches the model and must be treated as untrusted input.
Common mistakes
- Calling the whole setup "the MCP" and then debugging the wrong component.
- Expecting a server to show an approval prompt instead of configuring consent in the host.
- Counting servers and clients as the same thing; a host creates one client per server connection.
- Equating local with trusted and remote with untrusted without checking who wrote and updates the code.
Check yourself · 2 of 3
In a described setup, a user must approve before a tool deletes files. Which component enforces that approval?
Check yourself · 3 of 3
A filesystem server is launched as a subprocess on the developer's laptop; a Sentry server is reached over HTTPS. What do 'local' and 'remote' describe?
Practice items, not counted towards your mastery.
Start here
- MCP architecture overview (opens in a new tab)DocsFree
The official definition of hosts, clients, servers, the data layer and the transport layer.
- Model Context Protocol specification (latest) (opens in a new tab)StandardFree
The normative text: what clients and servers MUST and SHOULD do.
- MCP specification changelog, 2026-07-28 revision (opens in a new tab)DocsFree
Lists what changed since 2025-11-25: no handshake, no sessions, server/discover, subscriptions/listen.