D2 · Tool Design & MCP › Cluster 5 · MCP Fundamentals

5.2 · Architecture (Host · Client · Server)

Who talks to whom

CONCEPT Three roles: Host, Client, Server

MCP follows a client–server architecture with three participants. The official architecture doc defines them exactly:

🔑 The load-bearing rule: the host creates one client per server, and each client keeps a dedicated 1:1 connection to its server. Two servers ⇒ two clients. This 1:1 pairing is the heart of the architecture.

CONCEPT Two layers: data (JSON-RPC) over transport

The spec splits MCP into two layers. The data layer is the inner layer: the JSON-RPC 2.0 protocol itself — lifecycle management, and the core primitives. The transport layer is the outer layer: the actual channel that moves bytes (connection setup, message framing, auth). The same JSON-RPC message format runs unchanged over any transport.

Servers expose three server primitives, and clients can expose client primitives back:

SidePrimitiveWhat it is
Server exposesToolsExecutable functions the AI can invoke (API calls, DB queries) — tools/list, tools/call
ResourcesData sources providing context (file contents, records) — resources/list, resources/read
PromptsReusable interaction templates (system prompts, few-shot) — prompts/list, prompts/get
Client exposesSamplingServer asks the host's LLM for a completion — sampling/createMessage
ElicitationServer asks the user for more input — elicitation/create
LoggingServer sends log messages to the client
Every primitive follows the same discovery pattern: */list to find what's available, then */get or */call to use it. Discovery is dynamic — the client asks at runtime rather than hard-coding a fixed set.

DIAGRAM One host, many clients, 1:1 to servers

flowchart TD subgraph HOST["MCP Host (AI application, e.g. Claude Desktop)"] LLM["LLM"] C1["MCP Client 1"] C2["MCP Client 2"] C3["MCP Client 3"] end S1["Server A · local
(Filesystem)"] S2["Server B · local
(Database)"] S3["Server C · remote
(Sentry)"] C1 ---|"dedicated 1:1"| S1 C2 ---|"dedicated 1:1"| S2 C3 ---|"dedicated 1:1"| S3 LLM -.->|"uses context"| C1 classDef host fill:#d4edda,stroke:#28a745,color:#155724; classDef srv fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; class C1,C2,C3,LLM host; class S1,S2,S3 srv;

CODE The Claude-side connector: host declares its servers

When Claude is the host (Messages API MCP connector, beta mcp-client-2025-11-20), you declare each server in mcp_servers and reference it from a mcp_toolset. Claude spins up one client per server — the host/client/server roles made concrete.

# Python — Claude as MCP host connecting to a remote server
response = client.beta.messages.create(
    model="claude-opus-4-8", max_tokens=1024,
    betas=["mcp-client-2025-11-20"],
    # The HOST declares each SERVER (one client is created per entry)
    mcp_servers=[
        { "type": "url",
          "name": "example-mcp",
          "url": "https://example.com/mcp" }
    ],
    # Reference the server by name so its tools are exposed to the model
    tools=[{ "type": "mcp_toolset", "mcp_server_name": "example-mcp" }],
    messages=[{ "role": "user", "content": "Use the MCP tools" }],
)

TRADE-OFFS One client per server vs. one shared connection

✅ 1:1 client-per-server (the MCP model)

  • Clean isolation — one server's failure or restart affects only its client
  • Per-server capability negotiation and auth
  • Local (stdio) and remote (HTTP) servers coexist naturally

⚠️ Imagining one client multiplexing all servers

  • Fewer connection objects to track
  • But: not how MCP works — capabilities, lifecycle, and auth are per-connection
  • A shared pipe couples unrelated servers together

EXAM TRAPS

Trap: Confusing host and client. → The host is the whole app (and runs the LLM); the client is the per-server connector inside it. One host holds many clients.
Trap: "One client can connect to several servers." → No — each client maintains a 1:1 connection to exactly one server. The host creates a new client per server.
Trap: "Only servers expose primitives." → Servers expose tools, resources, prompts; clients can expose sampling, elicitation, logging back to servers.
Trap: Mixing up the two layers. → The data layer is JSON-RPC (lifecycle + primitives); the transport layer is the channel (stdio / Streamable HTTP). Same messages, any transport.

PRACTICE

Q1 · A host connects to a Filesystem server and a Sentry server. How many clients exist?

Two — one client per server, each holding its own dedicated 1:1 connection. The host instantiates a separate MCP client object for every server it connects to.

Q2 · Name the three server primitives and the pattern used to access them.

Tools, resources, and prompts. Each is accessed via */list for discovery and then */call (tools) or */get / */read to use it. Discovery is dynamic, done at runtime.

Q3 · Which layer is JSON-RPC 2.0, and which handles message framing?

JSON-RPC 2.0 is the data layer (the inner layer: lifecycle + primitives). Connection setup, message framing, and auth are the transport layer (the outer layer). The same JSON-RPC messages ride unchanged over whichever transport is in use.