NewAI Content Creation is now live in Early Access
Turning Point Training Instituteby Training Center
Skip to content
0%
Module 0 — Fundamentals (from zero)Lesson 3 of 3
Video lesson

Architecture in practice: connecting a server to a host

IntermediateVideo lesson
8 min readIntermediate
Downloads & resources
Download this lesson's materials, ready to use.

Architecture in practice: connecting a server to a host

Example prompt

If you watch the video: the workshop (kQmXtrmQ5Zg) explains hosts, clients and servers well. Two parts are legacy under revision 2026-07-28: the client "opening a connection" with an initialize handshake and keeping session state, and sampling and roots described as active client features (they are now deprecated). In the current revision each request stands alone and carries its own version and capabilities.

Where you are: Module 0, lesson 3. You have the pinned lab from L02. Here you connect one real server to one real host and look at what each side is responsible for.

What you will be able to do

  • Assign each responsibility in an MCP integration (consent, tool display, input validation, isolation) to the host, the client or the server.
  • Connect the L11 lab server to Claude Code over Streamable HTTP and confirm it is connected.
  • Observe the host asking for approval before a state-changing tool runs, and explain why a server's annotations cannot replace that.
  • Explain why one server cannot read the conversation or another server's data.

Who does what (current, 2026-07-28)

The architecture page defines the roles by responsibility:

  • Host: creates and manages clients; "controls client connection permissions"; "enforces security policies and consent requirements"; "handles user authorization decisions"; coordinates the model; aggregates context.
  • Client: created by the host; "communicates with exactly one server"; "attaches protocol version and capabilities to every request"; "maintains security boundaries between servers".
  • Server: exposes resources, tools and prompts; requests client input (elicitation) by returning an InputRequiredResult inside a reply; "must respect security constraints"; runs locally or remotely.

Two design principles matter most in practice:

  1. Isolation. "Servers should not be able to read the whole conversation, nor 'see into' other servers." The full history stays with the host, and each server receives only the context it needs. If you connect a GitHub server and a database server, the database server never sees what GitHub returned unless the host passes it along.
  2. Stateless requests. MCP is stateless: every request carries its own version and capabilities. A client is not "a connection that remembers"; it is the component that attaches the right metadata to each request for its one server. (Legacy 2025-11-25 clients opened a session with initialize; see L06.)

The tools page says tools are model-controlled: the model decides when to call one. It then adds: "there SHOULD always be a human in the loop with the ability to deny tool invocations", and applications SHOULD show which tools are exposed, show when a tool is invoked, and ask for confirmation. Clients SHOULD also "show tool inputs to the user before calling the server".

The protocol does not prescribe the UI; that part is host-specific. Your server cannot force a confirmation dialog. What it can do is describe its tools honestly, validate every input, and keep dangerous operations out of the tool list (the L11 lab exposes three tools and deliberately leaves the admin DELETE out).

Annotations such as readOnlyHint or destructiveHint help a host decide how to present a tool, but the spec is explicit: "clients MUST consider tool annotations to be untrusted unless they come from trusted servers." A malicious server can label a destructive tool "read-only". Consent decisions belong to the host and the user.

Worked example: one server, one host

The L11 lab server (mcp_server.py, official Python SDK mcp 2.3.0) wraps a demo inventory API with three tools: search_items, get_item (both annotated read-only) and reserve_stock (changes state). It binds 127.0.0.1 and checks Host and Origin headers.

Start it from the lab-l11 folder:

bash
./run.sh serve     # API on 127.0.0.1:8001, MCP endpoint http://127.0.0.1:8000/mcp

Register it in Claude Code (host-specific command, from the Claude Code MCP docs):

bash
claude mcp add --transport http demo-inventory http://127.0.0.1:8000/mcp
claude mcp list

The default scope is local: the server is stored in ~/.claude.json, private to you, for this project only. A project scope writes .mcp.json to the repository so the team shares it; for those servers, Claude Code "prompts for approval in interactive sessions before using project-scoped servers from .mcp.json files". That is a host defending the user against a repository that silently adds a server.

What happens when you start a session:

  1. Claude Code's client sends requests to http://127.0.0.1:8000/mcp. Claude Code negotiates 2026-07-28 by default (you can force the old handshake with MCP_PROTOCOL_NEGOTIATION=legacy; the lab server accepts both).
  2. The client calls tools/list and gets three tool definitions, each with a name, description, inputSchema and annotations.
  3. The host decides how to present them to the model and the user. In Claude Code, MCP tools appear with names of the form mcp__<server>__<tool>, for example mcp__demo-inventory__reserve_stock.
  4. When the model chooses reserve_stock, Claude Code shows an MCP tool permission prompt (in its default manual permission mode) with the arguments. Only after you approve does the client send tools/call.

You can pre-approve the read-only tools with Claude Code permission rules, for example an allow rule mcp__demo-inventory__get_item, and leave reserve_stock to prompt. Note that this is a decision you make in the host, based on what you know about the server; the server's read_only_hint=True is only a hint.

Other hosts expose this differently (a settings page, a JSON config file, a per-tool toggle). Read your host's documentation; do not assume Claude Code's behaviour elsewhere.

What the server still owns

Consent in the host does not remove server duties. The tools page says servers MUST validate all tool inputs, implement access controls, rate-limit invocations and sanitise outputs. The lab shows the first two: get_item rejects ../admin through a schema pattern before any HTTP call, and reserve_stock caps quantity at 10. A user can approve a call that is still invalid; the server must refuse it.

Practice task

Connect the lab server to your host and watch the consent flow.

  1. In lab-l11, run ./run.sh serve and leave it running.
  2. Run claude mcp add --transport http demo-inventory http://127.0.0.1:8000/mcp, then claude mcp list.
  3. Start claude in any folder and run /mcp to check the server status.
  4. Ask: "Using demo-inventory, show me in-stock electronics." Then ask: "Reserve 2 units of ELC-0001."
  5. Approve the reservation once. Then ask for 50 units and approve again.
  6. When you finish, remove the entry with claude mcp remove demo-inventory and stop the server with Ctrl+C.

If you use a different host, add the same URL using its documented method and note how it asks for approval. If your host only speaks 2025-11-25, it still works: the lab server answers the legacy handshake on the same endpoint.

Check your result: claude mcp list shows demo-inventory with the URL you gave; /mcp reports it connected; the search returns the two in-stock electronics (ELC-0001 and ELC-0002); a permission prompt naming reserve_stock and its arguments appears before the reservation runs; and the 50-unit request comes back as a tool error from the server (quantity must be 1 to 10) even though you approved it. (If the model declines to send 50 because it read the schema's maximum, that is fine too: the limit is visible to it in inputSchema.)

Check your understanding

  1. Your server marks delete_project with destructiveHint: false. A host trusts it and runs it without asking. Whose fault is the outcome, by the spec? The spec puts the duty on the client: annotations MUST be treated as untrusted unless the server is trusted, and there SHOULD be a human able to deny invocations. The server author was also wrong to mislabel the tool. Annotations are presentation hints, not a security control.

  2. You connect a "notes" server and a "payments" server to the same host. Can the notes server read the last payment the user made in this conversation? Not through MCP. Each client talks to exactly one server, the full conversation stays with the host, and servers cannot see into other servers. The only way the notes server sees payment data is if the host (or the model, through a tool argument) passes it in. That is why tool inputs should be shown to the user.

  3. The user approved reserve_stock with quantity: 500. Should the server execute it? No. Host consent says the user wants the call; it does not make the input valid. Servers MUST validate all tool inputs. The lab's schema limits quantity to 1 to 10 and returns isError: true with a short message, which the model can read and correct.

Sources