Introduction to Model Context Protocol · lesson 1 of 6
Model Context Protocol (MCP) Overview
MCP is the open protocol that connects Claude (or any compatible LLM client) to external systems — file systems, databases, APIs, your internal tools. Released by Anthropic in late 2024; now adopted broadly.
Think of it as USB-C for LLMs: standardize the connector, let any tool plug into any client.
The two layers
MCP separates what from how:
- Data layer (inner) — JSON-RPC 2.0 protocol: lifecycle, primitives, notifications.
- Transport layer (outer) — stdio or Streamable HTTP, with auth.
Same JSON-RPC message format across all transports.
Server primitives (what the server offers)
- Tools — actions the model can invoke. Side effects expected. model-controlled.
- Resources — read-only data identified by URIs (
file://...,postgres://...). application-controlled. - Prompts — parameterized templates. user-controlled.
Discovery + invocation methods follow a pattern: */list, */get/*/read, tools/call.
Client primitives (what the server can ask of the client)
- Sampling (
sampling/createMessage) — server asks client to run an LLM call. Keeps server model-independent. - Elicitation (
elicitation/create) — server asks user for input / confirmation. - Logging — server sends log messages to client.
Who decides each primitive runs
| Primitive | Decided by | Surfaced as |
|---|---|---|
| Tools | Model | Tool calls during conversation |
| Resources | Application / host | Attached context, picker UI |
| Prompts | User | Slash command menu |
This "who decides" mapping is a frequent exam question.
Architecture
flowchart TB
subgraph Host["MCP Host (AI Application)"]
C1[MCP Client 1]
C2[MCP Client 2]
C3[MCP Client 3]
C4[MCP Client 4]
end
SA["MCP Server A (local)<br/>e.g. Filesystem"]
SB["MCP Server B (local)<br/>e.g. Database"]
SC["MCP Server C (remote)<br/>e.g. Sentry"]
C1 -- "dedicated connection" --> SA
C2 -- "dedicated connection" --> SB
C3 -- "dedicated connection" --> SC
C4 -- "dedicated connection" --> SC
A host can run many MCP clients simultaneously, each connected to a different server. The same server can have multiple clients (different tabs of VS Code, e.g.).
"Local" vs "remote" is determined by transport, not where code runs:
- stdio = local subprocess (filesystem server).
- Streamable HTTP = remote service (Sentry MCP server).
Why MCP vs raw tool use
| Aspect | Raw API tool use | MCP |
|---|---|---|
| Where the tool lives | In your app code | In a separate server (your own or third-party) |
| Reusability | Per-app | Plug into any MCP-aware client |
| Discovery | Hardcoded | Server advertises capabilities |
| Trust model | App developer controls | Explicit user consent + scopes |
| Ecosystem | None | Growing registry (Slack, Linear, Postgres, etc.) |
Lifecycle
sequenceDiagram
participant C as MCP Client
participant S as MCP Server
C->>S: initialize (protocolVersion, capabilities, clientInfo)
S-->>C: result (serverInfo, capabilities)
C->>S: notifications/initialized
Note over C,S: Ready to operate
C->>S: tools/list
S-->>C: tools[]
C->>S: tools/call (name, arguments)
S-->>C: content[]
S->>C: notifications/tools/list_changed
C->>S: tools/list (refresh)
S-->>C: tools[]
- Initialize — client and server negotiate protocol version + capabilities.
- Ready — client sends
notifications/initialized. - List capabilities —
tools/list,resources/list,prompts/list. - Use —
tools/call,resources/read,prompts/get. - Notifications — either direction (e.g.,
notifications/tools/list_changed). - Shutdown.
Notifications only flow if the corresponding capability was declared at init (e.g., tools: {listChanged: true}).