MCP Architecture: How the Model Context Protocol Works Under the Hood

July 10, 2026 · 10 min read

MCPArchitectureTutorial
Some links below are affiliate links. I may earn a commission at no extra cost to you.

Introduction

The Model Context Protocol (MCP) is more than just another API standard. Its architecture is deliberately designed to solve the fundamental challenge of connecting AI agents to external tools and data. In this guide, we'll break down exactly how MCP works — from the high-level client-server model down to the data layer protocol.

The Three Participants

MCP has three distinct roles:

Client-Server Architecture

MCP follows a strict client-server model:

Host (e.g., Claude Desktop)
  |
  +-- Client 1 ----> Server A (Filesystem)
  |
  +-- Client 2 ----> Server B (GitHub)
  |
  +-- Client 3 ----> Server C (Database)

Each client maintains a dedicated 1:1 connection with its server. Local servers (using stdio transport) typically serve one client at a time. Remote servers (using Streamable HTTP) can serve many clients concurrently.

Transport Layer

MCP supports two transport mechanisms:

Stdio Transport (Local)

The host launches the MCP server as a subprocess and communicates via stdin/stdout. This is the simplest setup for development:

Host launches: npx -y @modelcontextprotocol/server-filesystem .
Host <-> Server: JSON-RPC messages over stdin/stdout

Streamable HTTP Transport (Remote)

For production, servers run as HTTP endpoints. The client connects via SSE (Server-Sent Events) for streaming responses and POST for requests:

Client --POST--> Server: Request
Client <--SSE--- Server: Streaming response

Data Layer Protocol

MCP uses JSON-RPC 2.0 as its message format. Every message is a JSON object with jsonrpc, method, and params fields.

Lifecycle

  1. Initialization — Client and server exchange protocol versions and capabilities. The client sends an initialize request; the server responds with its supported features.
  2. Tool Discovery — The client calls tools/list to get all available tools. Each tool has a name, description, and input schema (JSON Schema format).
  3. Tool Execution — The client calls tools/call with the tool name and arguments. The server executes and returns results.
  4. Notifications — Servers can push notifications (e.g., notifications/tools/list_changed) when available tools change.

Example: Tool Discovery Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}

Example: Tool Discovery Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "read_file",
        "description": "Read contents of a file",
        "inputSchema": {
          "type": "object",
          "properties": {
            "path": { "type": "string" }
          },
          "required": ["path"]
        }
      }
    ]
  }
}

Example: Tool Execution

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "read_file",
    "arguments": { "path": "/data/config.json" }
  }
}

Resources and Prompts

Besides tools, MCP servers can expose:

Security Model

MCP leaves security to the host application. Key considerations:

Why This Design Matters

MCP's architecture solves three key problems:

This design is what makes MCP a true "USB-C port for AI" — one protocol that works with any tool, any data source, any model.

This article contains affiliate links. I may earn a commission at no extra cost to you.