Understanding Model Context Protocol: How MCP Connects AI Models to Tools and Data
A comprehensive technical guide to the Model Context Protocol — its host/client/server architecture, core primitives (tools, resources, prompts), transport mechanisms, and security model.
The Model Context Protocol (MCP) is the de facto standard for connecting large language models to external tools and data sources. This guide covers its host/client/server architecture, three core primitives, transport mechanisms, and security model.
What is MCP and how does it connect AI models to tools and data?
MCP is an open protocol that standardises communication between AI applications and external services using a host/client/server model with three primitives: tools (model-controlled functions), resources (application-controlled data), and prompts (user-controlled templates).
Sources: MCP Specification 2026-07-28 · Anthropic MCP Blog
When you hear about AI agents calling databases, reading files, or posting to APIs, the mechanism making that possible is increasingly likely to be the Model Context Protocol — or MCP. Originally created by Anthropic and now governed by an open specification, MCP has become the de facto standard for connecting large language models to external tools and data sources.
This article walks through how MCP actually works: its architecture, its core primitives, the transport mechanisms that carry messages, and the security model that keeps everything contained.
What Is MCP?
At its simplest, MCP is a protocol — a set of rules for structured communication between an AI application and external services. It defines how an AI model (or the application hosting it) can discover what capabilities are available, request data, execute tools, and receive responses — all in a machine-readable format.
Before MCP, each integration between an AI model and a tool required custom API code. MCP standardises this by providing a common protocol layer that any compliant server can implement and any compliant client can consume.
Architecture: Host, Client, and Server
MCP uses a three-component model:
The Host
The host is the application that orchestrates everything — typically an AI IDE, chat interface, or automation platform. It manages the lifecycle of clients and servers, routes messages between them, and presents the user interface.
The Client
The client lives inside the host and speaks the MCP protocol. It sends requests to servers, receives responses, and translates them into a format the host can use. Each server gets its own client instance.
The Server
The server provides capabilities — tools, resources, or prompts — to the client. It runs as a separate process (or remote service) and communicates over a defined transport. Servers can be local (running on the same machine) or remote (accessible over HTTP).
The separation is intentional: the host doesn't need to know how any particular server works, and servers don't need to understand the host's UI or logic. They communicate purely through the protocol.
The Three Primitives
MCP defines exactly three types of capability that a server can expose:
Tools (Model-Controlled)
Tools are functions that the AI model can call. When the model decides a tool is relevant, it sends a request with the appropriate arguments and receives a structured response. Examples include "search the web", "run a SQL query", or "create a file".
The key distinction: the model controls when and how tools are called. The client doesn't decide — the model's reasoning does.
Resources (Application-Controlled)
Resources represent data that servers make available — files, API responses, database records, or any other information the model might need. Unlike tools, resources are not invoked by the model directly; instead, the application (host/client) reads them when needed.
This separation means resources can be cached, permission-checked, and managed by the application independently of the model's decision-making.
Prompts (User-Controlled)
Prompts are pre-defined message templates that users can invoke. A server might offer prompts like "review this code for security issues" or "summarise this document". When a user selects a prompt, the client sends it to the server, which returns the composed message(s) ready for the model to process.
Prompts give servers a way to shape how the model approaches certain tasks without hardcoding behaviour into the application.
Transports: How Messages Get Delivered
MCP supports two transport mechanisms:
Stdio Transport
The simplest and most common transport. The client launches the server as a local process and communicates via standard input/output streams using JSON-RPC messages. This is ideal for local tools and development workflows.
Streamable HTTP Transport
For remote servers, MCP uses HTTP with SSE (Server-Sent Events) for the server-to-client direction and regular HTTP POST for client-to-server requests. Messages are routed using headers:
Mcp-Method: identifies the operation (e.g.,tools/list,resources/read)Mcp-Name: identifies the target server when multiple servers share an endpoint
This header-based routing replaces the older session-id approach, making MCP truly stateless — a key design principle in the 2026 specification.
The 2026 Spec: Statelessness and MRTR
The July 2026 update to the MCP specification introduced several important changes:
- Stateless protocol core: Sessions are established once and then all interactions are independent. No persistent state is maintained between requests.
- MRTR (Message-Request-Response-terminate): Replaces the older held-open stream model. Each request gets a response, and the connection can be cleanly closed.
- Header-based routing:
Mcp-MethodandMcp-Nameheaders replace session IDs for server identification.
These changes make MCP more robust, easier to deploy behind load balancers, and better suited for cloud-native environments.
Security Model
MCP includes a built-in authorization framework based on OAuth 2.1 with specific extensions:
- RFC 9207: Used for validating the resource owner's issuer identifier, preventing token confusion attacks.
- CIMD (Client Identity for Machine Users): Provides a mechanism for machine-to-machine authentication without human interaction.
The security model enforces clear boundaries: servers can only access what they're explicitly granted, clients can only request what the host permits, and the host maintains ultimate control over the entire pipeline.
Practical Patterns
Building an MCP Server
A minimal MCP server needs to:
- Implement at least one transport (stdio or HTTP)
- Register its capabilities (tools, resources, prompts)
- Handle requests using the JSON-RPC message format
- Return structured responses with error handling
Composing Multiple Servers
A single host can connect to multiple MCP servers simultaneously — for example, one server providing development tools, another providing monitoring data, and a third providing knowledge base access. Each server operates independently, and the host presents a unified interface to the user.
Ecosystem Adoption
As of late 2026, MCP has been adopted by major AI platforms including Claude, Cursor, Copilot, and various enterprise tooling providers. The open specification is maintained through a collaborative process involving Anthropic, Microsoft, and other industry participants.
Why MCP Matters
MCP solves a real problem: the fragmentation of AI-tool integrations. Before MCP, every new tool required custom code in every AI application. With MCP, a single server implementation works across any compliant client.
This standardisation accelerates innovation — developers build once, and their tools become available to everyone using an MCP-compatible client. For organisations, it means greater flexibility in choosing AI applications without vendor lock-in for individual integrations.
Getting Started
The quickest way to experiment with MCP:
- Install an MCP-compatible client (Claude Desktop, Cursor, or the reference CLI)
- Configure a server by specifying its command and arguments in the client's config
- Start the client — it will launch the server and establish the connection
- Use the available tools, resources, and prompts through the client interface
For remote servers, configure the HTTP endpoint and authentication credentials in the client configuration.
Final Thoughts
MCP represents a maturation of the AI ecosystem — moving from bespoke integrations to a standardised protocol layer. Its host/client/server architecture, three-primitive capability model, and stateless transport design make it suitable for everything from local development tools to enterprise-scale AI deployments.
As the specification continues to evolve and adoption grows, MCP is positioned to become the foundational protocol for how AI models interact with the world beyond their training data.
Sources: MCP Specification, Anthropic MCP Blog, GitHub MCP Repository
Feature image: Marxav / CC BY-SA 4.0 / Wikimedia Commons.