Client-server architecture for tools and MCP hosts
Why a tool server is a separate process with its own client, channel and handshake.

When an agent calls a tool, the tool usually does not run inside the model’s process. The Model Context Protocol (MCP) puts it in a separate program reached over a connection: it “follows a client-host-server architecture where each host can run multiple client instances.” A host creates one client per server, and each client holds a session with that one server. The split draws a boundary: the host keeps the conversation, the server receives only what it needs. This sheet covers the connection itself — process, channel and handshake; the protocol’s own vocabulary and primitives are the companion MCP sheet’s subject.
Three participants and a one-to-one connection
MCP names three roles. The overview says MCP “follows a client-server architecture where an MCP host — an AI application like Claude Code or Claude Desktop — establishes connections to one or more MCP servers”. The architecture page states the same rule the other way: “A host application creates and manages multiple clients, with each client having a 1:1 relationship with a particular server.”
The pairing is load-bearing: a host talking to three servers holds three clients. The architecture page lists what depends on it — “Servers receive only necessary contextual information”, “Each server connection maintains isolation”, “Cross-server interactions are controlled by the host”.
“Server” names a role, not a location: a server “can be local processes or remote services”.
Two layers: the protocol and the pipe
MCP splits into two layers. The data layer “defines the JSON-RPC based protocol for client-server communication, including capability and version discovery, and core primitives, such as tools, resources, prompts and notifications”. The transport layer “defines the communication mechanisms and channels that enable data exchange between clients and servers”.
Because the layers are independent, the same messages cross different channels: the transport “abstracts communication details from the protocol layer, enabling the same JSON-RPC 2.0 message format across all transport mechanisms”. The specification page fixes the encoding — “MCP uses JSON-RPC to encode messages. JSON-RPC messages MUST be UTF-8 encoded”.
Local over stdio, remote over Streamable HTTP
The transports differ in who owns the process. In stdio, “the client launches the MCP server as a subprocess”, and “the server reads JSON-RPC messages from its standard input (stdin) and sends messages to its standard output (stdout)”. The rule is strict: “The server MUST NOT write anything to its stdout that is not a valid MCP message.”
Streamable HTTP is a network service: “the server operates as an independent process that can handle multiple client connections”, and must expose “a single HTTP endpoint path … that supports both POST and GET methods”.
The difference is trust and reach: a stdio server is a child process the client started locally, while an HTTP server answers on a socket anyone reachable may hit. The specification therefore warns that such servers “MUST validate the Origin header on all incoming connections to prevent DNS rebinding attacks” and “SHOULD bind only to localhost (127.0.0.1) rather than all network interfaces (0.0.0.0)”, since without these protections “attackers could use DNS rebinding to interact with local MCP servers from remote websites”.
The connection has a lifecycle
The lifecycle page says MCP “defines a rigorous lifecycle for client-server connections” in three phases — “Initialization: Capability negotiation and protocol version agreement”, “Operation: Normal protocol communication”, “Shutdown: Graceful termination of the connection”. Initialization “MUST be the first interaction between client and server”: the client sends an initialize request with a supported protocol version, its capabilities and its implementation information.
Version agreement is negotiated, not assumed: “If the server supports the requested protocol version, it MUST respond with the same version. Otherwise, the server MUST respond with another protocol version it supports.” Capabilities work the same way — MCP “uses a capability-based negotiation system where clients and servers explicitly declare their supported features during initialization”, and once agreed “both parties must respect declared capabilities throughout the session”.
Shutdown carries no messages of its own: “No specific shutdown messages are defined—instead, the underlying transport mechanism should be used to signal connection termination”. Over stdio the client closes the server’s input stream and escalates to SIGTERM, then SIGKILL.
Stateful session, stateless request
Two documents describe the same connection in opposite terms, and the difference is a version difference worth naming. The architecture page (version 2025-06-18) calls MCP “a stateful session protocol focused on context exchange and sampling coordination between clients and servers”. The newer overview (version 2026-07-28) states that “MCP is a stateless protocol”, because “every request carries the protocol version and the capabilities relevant to that request in its _meta field”.
They differ on how much the connection remembers, not on the topology: a session can be long-lived while each request stays self-describing.
Level and prerequisites. L4 — the sheet is about the runtime shape a tool integration must assume: who owns the process, what crosses the boundary, and what a connection negotiates before any call. It sits past writing a tool schema and before securing the server. Prerequisites: the L1/L2 material on how a model produces a call and how a request is framed on the wire, and the L4 sheet on tool schemas and argument validation.
Where to go next
- Automation & AI — the macro-area this sheet belongs to.
- Applications — the node this sheet sits in.
References
- Model Context Protocol — Architecture (specification page) — the client-host-server topology, the 1:1 client–server pairing and the isolation design principles.
- Model Context Protocol — Architecture overview — the host, client and server definitions, the data and transport layers, the transport mechanisms and the stateless-per-request reading.
- Model Context Protocol — Transports — the JSON-RPC encoding, the stdio and Streamable HTTP framing rules and the Streamable HTTP security warning.
- Model Context Protocol — Lifecycle — the initialization, operation and shutdown phases, and the version and capability negotiation.