Text of modelcontextprotocol.io › docs › draft › learn › architecture as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Architecture overview - Model Context Protocol

Documentation Index Fetch the complete documentation index at: /llms.txt Use this file to discover all available pages before exploring further. Skip to main content Assistant Responses are generated using AI and may contain mistakes. This overview of the Model Context Protocol (MCP) discusses its scope and core concepts , and provides an example demonstrating each core concept. Because MCP SDKs abstract away many concerns, most developers will likely find the data layer protocol section to be the most useful.

It discusses how MCP servers can provide context to an AI application. For specific implementation details, please refer to the documentation for your language-specific SDK . Scope The Model Context Protocol includes the following projects: MCP Specification : A specification of MCP that outlines the implementation requirements for clients and servers. MCP SDKs : SDKs for different programming languages that implement MCP.

MCP Development Tools : Tools for developing MCP servers and clients, including the MCP Inspector MCP Reference Server Implementations : Reference implementations of MCP servers. MCP focuses solely on the protocol for context exchange—it does not dictate how AI applications use LLMs or manage the provided context. Concepts of MCP Participants MCP follows a client-server architecture where an MCP host — an AI application like Claude Code or Claude Desktop — establishes connections to one or more MCP servers.

The MCP host accomplishes this by creating one MCP client for each MCP server. Each MCP client maintains a dedicated connection with its corresponding MCP server. Local MCP servers that use the STDIO transport typically serve a single MCP client, whereas remote MCP servers that use the Streamable HTTP transport will typically serve many MCP clients. The key participants in the MCP architecture are: MCP Host : The AI application that coordinates and manages one or multiple MCP clients MCP Client : A component that maintains a connection to an MCP server and obtains context from an MCP server for the MCP host to use MCP Server : A program that provides context to MCP clients For example : Visual Studio Code acts as an MCP host.

When Visual Studio Code establishes a connection to an MCP server, such as the Sentry MCP server , the Visual Studio Code runtime instantiates an MCP client object that maintains the connection to the Sentry MCP server. When Visual Studio Code subsequently connects to another MCP server, such as the local filesystem server , the Visual Studio Code runtime instantiates an additional MCP client object to maintain this connection.

Note that MCP server refers to the program that serves context data, regardless of where it runs. MCP servers can execute locally or remotely. For example, when Claude Desktop launches the filesystem server , the server runs locally on the same machine because it uses the STDIO transport. This is commonly referred to as a “local” MCP server. The official Sentry MCP server runs on the Sentry platform, and uses the Streamable HTTP transport.

This is commonly referred to as a “remote” MCP server. Layers MCP consists of two layers: Data layer : Defines the JSON-RPC based protocol for client-server communication, including capability and version discovery, and core primitives, such as tools, resources, prompts and notifications. Transport layer : Defines the communication mechanisms and channels that enable data exchange between clients and servers, including transport-specific connection establishment, message framing, and authorization.

Conceptually the data layer is the inner layer, while the transport layer is the outer layer. Data layer The data layer implements a JSON-RPC 2.0 based exchange protocol that defines the message structure and semantics. This layer includes: Discovery : Lets clients query a server’s supported protocol versions, capabilities, and identity through the server/discover request Server features : Enables servers to provide core functionality including tools for AI actions, resources for context data, and prompts for interaction templates from and to the client Client features : Enables servers to elicit input from the user.

Utility features : Supports additional capabilities like notifications for real-time updates and progress tracking for long-running operations Transport layer The transport layer manages communication channels and authentication between clients and servers. It handles connection establishment, message framing, and secure communication between MCP participants. MCP supports two transport mechanisms: Stdio transport : Uses standard input/output streams for direct process communication between local processes on the same machine, providing optimal performance with no network overhead.

Streamable HTTP transport : Uses HTTP POST for client-to-server messages with optional Server-Sent Events for streaming capabilities. This transport enables remote server communication and supports standard HTTP authentication methods including bearer tokens, API keys, and custom headers. MCP recommends using OAuth to obtain authentication tokens. The transport layer abstracts communication details from the protocol layer, enabling the same JSON-RPC 2.0 message format across all transport mechanisms.

Data Layer Protocol A core part of MCP is defining the schema and semantics between MCP clients and MCP servers. Developers will likely find the data layer — in particular, the set of primitives — to be the most interesting part of MCP. It is the part of MCP that defines the ways developers can share context from MCP servers to MCP clients. MCP uses JSON-RPC 2.0 as its underlying RPC protocol. Clients send requests and servers respond to them.

Servers can request input from the client through the Multi Round-Trip Requests pattern. Notifications can be used when no response is required. Statelessness and discovery MCP is a . Every request carries the protocol version and the relevant to that request in its _meta field, so the server can process each request on its own. Clients should also identify themselves in the same field unless configured not to. Servers advertise their supported versions and capabilities through the mandatory server/discover request, which clients may send before any other request.

Detailed information can be found in the specification , and the example showcases the per-request metadata and the discovery sequence. Primitives MCP primitives are the most important concept within MCP. They define what clients and servers can offer each other. These primitives specify the types of contextual information that can be shared with AI applications and the range of actions that can be performed. MCP defines three core primitives that servers can expose: Tools : Executable functions that AI applications can invoke to perform actions (e.g., file operations, API calls, database queries) Resources : Data sources that provide contextual information to AI applications (e.g., file contents, database records, API responses) Prompts : Reusable templates that help structure interactions with language models (e.g., system prompts, few-shot examples) Each primitive type has associated methods for discovery ( */list ), and for either retrieval ( resources/read , prompts/get ) or execution ( tools/call ).

MCP clients will use the */list methods to discover available primitives. For example, a client can list the available tools ( tools/list ), provide them to a model, and execute the ones that the model calls ( tools/call ). This design allows listings to be dynamic. As a concrete example, consider an MCP server that provides context about a database. It can expose tools for querying the database, a resource that contains the schema of the database, and a prompt that includes few-shot examples for interacting with the tools.

For more details about server primitives see server concepts . MCP also defines primitives that clients can expose. Th

The rest of this page is on the live site.