Skip to main content

Architecture overview

This overview covers MCP scope, core concepts, and how clients and servers exchange context.

Because MCP SDKs abstract many concerns, most developers find the data layer protocol (primitives and discovery) the most useful part. For implementation details, use your language-specific SDK.

Adapted from the official Architecture overview. Verify against the live docs and specification.

MCP host with multiple clients connected to local and remote servers

Host → clients → servers: one dedicated connection per client–server pair. Playbook diagram adapted from MCP architecture concepts.

stdio vs Streamable HTTP transports

Two transport mechanisms: local stdio and remote Streamable HTTP. Playbook diagram.

Scope

The Model Context Protocol includes:

MCP focuses solely on the protocol for context exchange — it does not dictate how AI applications use LLMs or manage the provided context.

Participants

MCP follows a client–server architecture where an MCP host (for example Claude Code, Claude Desktop, Cursor or VS Code) establishes connections to one or more MCP servers by creating one MCP client per server.

RoleResponsibility
MCP HostAI application that coordinates one or many MCP clients
MCP ClientMaintains a connection to one MCP server and obtains context for the host
MCP ServerProgram that provides context (tools, resources, prompts) to clients

Example: Visual Studio Code acts as an MCP host. Connecting to the Sentry MCP server instantiates one MCP client; connecting to a local filesystem server instantiates another. A remote Streamable HTTP server may serve many clients; a local stdio server typically serves one.

Local servers (stdio) usually run on the same machine. Remote servers (Streamable HTTP) run on a platform — for example the official Sentry MCP server.

Layers

MCP has two layers:

LayerRole
Data layerJSON-RPC protocol: capability and version discovery, tools, resources, prompts, notifications
Transport layerConnection establishment, message framing, authorization

Conceptually the data layer is inner; transport is outer.

Data layer

Built on JSON-RPC 2.0:

  • Discoveryserver/discover for supported versions, capabilities and identity
  • Server features — tools, resources, prompts
  • Client features — elicitation (sampling is deprecated as of 2026-07-28)
  • Utilities — notifications, progress for long-running work

Transport layer

TransportWhen to use
stdioLocal processes on the same machine — high performance, no network
Streamable HTTPRemote servers — HTTP POST client→server, optional SSE for streaming; bearer tokens / OAuth recommended

The same JSON-RPC message format applies across transports.

Statelessness and discovery

MCP is a stateless protocol. Every request carries protocol version and relevant capabilities in its _meta field so the server can process each request independently. Clients should identify themselves in _meta unless configured not to.

Servers advertise supported versions and capabilities through the mandatory server/discover request. Clients may call it before other requests; discovery responses are typically cacheable.

Example discover request

{
"jsonrpc": "2.0",
"id": 1,
"method": "server/discover",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": {
"name": "example-client",
"version": "1.0.0"
},
"io.modelcontextprotocol/clientCapabilities": {
"elicitation": {}
}
}
}
}

Primitives

Server primitives

PrimitivePurposeTypical methods
ToolsExecutable actions (APIs, files, DB)tools/list, tools/call
ResourcesContextual data (files, records)resources/list, resources/read
PromptsReusable interaction templatesprompts/list, prompts/get

Listings can be dynamic — clients discover then invoke.

Client primitives

PrimitivePurposeNotes
ElicitationServer asks the user for structured inputDelivered via Multi Round-Trip Requests
SamplingServer asks the host LLM for a completionDeprecated in 2026-07-28
LoggingServer → client log streamDeprecated — prefer stderr / OpenTelemetry

Optional extensions (for example Tasks) build on the core protocol.

Notifications

Servers can notify clients when capabilities change (for example tools list updates). Change notifications are opt-in: the client opens a long-lived subscriptions/listen stream naming notification types; the server delivers matching notifications on that stream.

Negative cases to design for

  • Server does not support the requested protocol version → UnsupportedProtocolVersionError; retry with a mutual version or fail clearly.
  • Remote server requires auth the host cannot obtain → fail closed; do not silently strip scopes.
  • Tool list changes mid-session → subscribe or re-list before critical calls.
  • Stdio child process crashes → host must restart and re-discover; surface errors to the user.

Discussion

Comments

Share feedback or questions about this page. No account required.

Loading comments…