MCP Architecture Diagram
A visual reference for the Model Context Protocol (MCP) — the emerging standard for connecting AI agents to external tools, APIs, and data sources.
The Three-Layer Architecture
MCP Host
The AI application (Claude Desktop, Cursor, custom app). Manages connections, enforces trust boundaries, routes requests.
e.g. Claude Desktop, Cursor, custom agent
MCP Client
Lives inside the Host. Maintains a 1:1 connection with each MCP Server. Handles protocol negotiation and message routing.
e.g. One client per server connection
MCP Server
Exposes capabilities (Tools, Resources, Prompts) to the client. Can be local (stdio) or remote (HTTP/SSE). Calls external APIs or systems.
e.g. Filesystem, GitHub, Slack, databases
Transport: stdio (local) | HTTP + SSE (remote) · Protocol: JSON-RPC 2.0
MCP Host
The AI application (Claude Desktop, Cursor, custom app). Manages connections, enforces trust boundaries, routes requests.
MCP Client
Lives inside the Host. Maintains a 1:1 connection with each MCP Server. Handles protocol negotiation and message routing.
MCP Server
Exposes capabilities (Tools, Resources, Prompts) to the client. Can be local (stdio) or remote (HTTP/SSE). Calls external APIs or systems.
Request Flow: User → Tool → Answer
User sends request
User types a message or triggers an action in the Host application.
Host routes to LLM
Host sends the conversation (with available tool list) to the AI model.
Model selects tool
LLM decides which MCP tool to call and generates the tool call arguments.
Host authorises
Host checks user consent and permission policies before allowing the call.
Client calls Server
MCP Client sends the tool call to the appropriate MCP Server.
Server executes
Server calls the underlying API, filesystem, or database and returns results.
Result returned
Result flows back: Server → Client → Host → LLM → final answer to user.
MCP Primitives — What Servers Expose
Tools
Defined by Server
Executable functions the model can call. Have names, descriptions, and JSON Schema input specs. Examples: search_files, send_email, query_db.
Resources
Defined by Server
Read-only data the model can read. URI-addressed. Examples: file:///repo/README.md, postgres://db/schema.
Prompts
Defined by Server
Reusable prompt templates with arguments. Let servers define standard workflows.
Sampling
Defined by Server→Host
Server requests the Host to call the LLM. Enables agentic loops where servers can initiate model inference.