@@ -5,10 +5,12 @@ title: Architecture
55<div id = " enable-section-numbers" />
66
77The Model Context Protocol (MCP) follows a client-host-server architecture where each
8- host can run multiple client instances. This architecture enables users to integrate AI
9- capabilities across applications while maintaining clear security boundaries and
10- isolating concerns. Built on JSON-RPC, MCP provides a protocol focused on context
11- exchange and sampling coordination between clients and servers.
8+ host can run multiple client instances. MCP is a stateless protocol: every request is
9+ self-contained and carries its own protocol version, client identity, and capabilities.
10+ This architecture enables users to integrate AI capabilities across applications while
11+ maintaining clear security boundaries and isolating concerns. Built on JSON-RPC, MCP
12+ provides a protocol focused on context exchange and sampling coordination between
13+ clients and servers.
1214
1315## Core Components
1416
@@ -58,10 +60,10 @@ The host process acts as the container and coordinator:
5860
5961### Clients
6062
61- Each client is created by the host and maintains an isolated server connection :
63+ Each client is created by the host and communicates with exactly one server :
6264
63- - Establishes one connection per server
64- - Handles protocol negotiation and capability exchange
65+ - Communicates with exactly one server
66+ - Attaches protocol version and capabilities to every request
6567- Routes protocol messages bidirectionally
6668- Manages subscriptions and notifications
6769- Maintains security boundaries between servers
@@ -75,7 +77,7 @@ Servers provide specialized context and capabilities:
7577
7678- Expose resources, tools and prompts via MCP primitives
7779- Operate independently with focused responsibilities
78- - Request sampling through client interfaces
80+ - Request client input ( sampling, elicitation, roots) via ` IncompleteResponse ` within a reply
7981- Must respect security constraints
8082- Can be local processes or remote services
8183
@@ -100,7 +102,7 @@ implementation:
100102 servers**
101103 - Servers receive only necessary contextual information
102104 - Full conversation history stays with the host
103- - Each server connection maintains isolation
105+ - Each server maintains isolation
104106 - Cross-server interactions are controlled by the host
105107 - Host process enforces security boundaries
106108
@@ -114,13 +116,16 @@ implementation:
114116## Capability Negotiation
115117
116118The Model Context Protocol uses a capability-based negotiation system where clients and
117- servers explicitly declare their supported features during initialization. Capabilities
118- determine which protocol features and primitives are available during a connection.
119+ servers declare their supported features on each request. Clients include their
120+ capabilities in ` _meta.io.modelcontextprotocol/clientCapabilities ` on every request.
121+ Servers advertise their capabilities in response to
122+ [ ` server/discover ` ] ( /specification/draft/server/discover ) , which clients may call before
123+ any other request for up-front capability discovery.
119124
120- - Servers declare capabilities like resource subscriptions, tool support , and prompt
125+ - Servers declare capabilities like tool support, resource subscriptions , and prompt
121126 templates
122- - Clients declare capabilities like sampling support and notification handling
123- - Both parties must respect declared capabilities throughout the connection
127+ - Clients declare capabilities like sampling support and elicitation handling
128+ - Both parties must respect declared capabilities throughout the interaction
124129- Additional capabilities can be negotiated through extensions to the protocol
125130
126131``` mermaid
@@ -129,43 +134,40 @@ sequenceDiagram
129134 participant Client
130135 participant Server
131136
132- Host->>+Client: Initialize client
133- Client->>+Server: Initialize with capabilities
134- Server-->>Client: Respond with supported capabilities
135-
136- Note over Host,Server: Active Connection with Negotiated Features
137+ opt Discovery
138+ Client->>Server: server/discover
139+ Server-->>Client: supported versions + capabilities
140+ end
137141
138142 loop Client Requests
139143 Host->>Client: User- or model-initiated action
140- Client->>Server: Request (tools/resources)
144+ Client->>Server: Request (with _meta: version, clientInfo, clientCapabilities)
145+ alt Server requires client input
146+ Server-->>Client: IncompleteResponse (e.g. sampling/createMessage)
147+ Client->>Host: Forward to AI
148+ Host-->>Client: AI response
149+ Client->>Server: Original request (with input)
150+ end
141151 Server-->>Client: Response
142152 Client-->>Host: Update UI or respond to model
143153 end
144154
145- loop Server Requests
146- Server->>Client: Request (sampling)
147- Client->>Host: Forward to AI
148- Host-->>Client: AI response
149- Client-->>Server: Response
155+ opt Subscriptions
156+ Client->>Server: subscriptions/listen (toolsListChanged, resourceSubscriptions, …)
157+ Server--)Client: notifications/subscriptions/acknowledged
158+ loop Stream
159+ Server--)Client: notifications/* (tagged with subscriptionId)
160+ end
150161 end
151-
152- loop Notifications
153- Server--)Client: Resource updates
154- Client--)Server: Status changes
155- end
156-
157- Host->>Client: Terminate
158- Client->>-Server: End connection
159- deactivate Server
160162```
161163
162- Each capability unlocks specific protocol features for use during the connection. For
163- example:
164+ Each capability unlocks specific protocol features on a per-request basis. For example:
164165
165166- Implemented [ server features] ( /specification/draft/server ) must be advertised in the
166167 server's capabilities
167- - Emitting resource subscription notifications requires the server to declare
168- subscription support
168+ - Receiving resource update notifications requires opening a
169+ [ ` subscriptions/listen ` ] ( /specification/draft/basic/utilities/subscriptions ) stream
170+ with the desired resource URIs
169171- Tool invocation requires the server to declare tool capabilities
170172- [ Sampling] ( /specification/draft/client ) requires the client to declare support in its
171173 capabilities
0 commit comments