MCP Architecture
About 5 minutes
MCP Architecture
Section titled “MCP Architecture”MCP is built on a client-server architecture. This architecture has three distinct roles: the Host (AI application), the Client (communication component), and the Server (tool-providing program).[1] Clear separation of these roles enables scalability and reusability.
Overview
Section titled “Overview”The following diagram shows the communication flow in MCP:
graph LR
U[User] --> H[Host\nClaude Desktop / Cursor]
H --> C[Client\nMCP Client]
C --> S1[Server A\nWeather MCP Server]
C --> S2[Server B\nFile System\nMCP Server]
S1 --> T1[Weather API]
S2 --> T2[Local\nFiles]The user sends instructions to the Host. The Host communicates with MCP servers through the Client to retrieve tools and information, then generates a response.
The Three Roles
Section titled “The Three Roles”The Host is the AI application that faces the user directly and coordinates one or more MCP Clients.[1]
Responsibilities
- Receive user input (text, voice, etc.)
- Maintain conversation history and manage context
- Call the AI model to generate responses
- Initiate connections to MCP servers when needed
- Display the final response to the user
Examples
| Host Application | Type |
|---|---|
| Claude Desktop | Desktop AI assistant |
| Cursor | AI-powered code editor |
| Windsurf | AI-powered code editor |
| Zed | AI-powered text editor |
| Chainlit | AI chat app building framework |
Client
Section titled “Client”The Client is a component embedded inside the Host that maintains a connection to a specific MCP Server and obtains context for the Host to use.[1] It acts like an “adapter” or “messenger.”
Responsibilities
- Send and receive messages according to the MCP protocol
- Retrieve the list of available tools, resources, and prompts from servers
- Convert Host instructions into MCP messages and send them to the Server
- Return Server results to the Host
Relationship Between Host and Client
Host and Client are conceptually separate but exist within the same application in practice:
- Host: Determines the AI’s intent (decides “I should look up the weather”)
- Client: Actually communicates via the MCP protocol (sends a request to the weather MCP server)
Server
Section titled “Server”The Server is an external program or service that provides context and capabilities to MCP Clients.[1]
Responsibilities
- Expose available capabilities (Tools, Resources, Prompts) in a standardized format
- Respond to tool-list requests from the Client
- Receive tool-call requests and execute the actual processing
- Return results to the Client
Deployment Options
| Type | Description | Example |
|---|---|---|
| Local server | Runs on the same machine and usually uses stdio transport | File system MCP server |
| Remote server | Runs over the network and usually uses Streamable HTTP transport | Remote MCP servers such as Sentry |
Detailed Communication Flow
Section titled “Detailed Communication Flow”The following sequence diagram shows how a tool is invoked through MCP:
sequenceDiagram
participant U as User
participant H as Host
participant C as Client
participant S as Server
U->>H: "What is the weather in Tokyo today?"
H->>C: Fetch available tools
C->>S: tools/list request
S-->>C: [get_weather, get_forecast, ...]
C-->>H: Return tool list
H->>H: LLM decides to call get_weather
H->>C: Execute get_weather(location="Tokyo")
C->>S: tools/call request
S->>S: Call weather API
S-->>C: {"temp": 18, "condition": "sunny"}
C-->>H: Return tool result
H->>H: LLM generates answer from result
H-->>U: "Tokyo is 18°C and sunny today."Implementation Example: Claude Desktop
Section titled “Implementation Example: Claude Desktop”Using Claude Desktop as an example, here is how the three roles map to the actual application:
Claude Desktop (Host + Client)
├── Chat UI (Host role)
│ - Accepting user input
│ - Displaying conversation history
│ - Communicating with the Anthropic API
│
└── MCP Client (Client role)
- Managing connections to MCP servers
- Sending and receiving messages per the protocol
Connected MCP Servers (Server role)
├── filesystem: File system operations
├── brave-search: Web search
└── github: GitHub repository operationsAdding MCP servers to Claude Desktop’s configuration file (claude_desktop_config.json) enables Claude to use the tools those servers provide. In Claude Code, the official documentation describes scope-specific configuration such as project-scoped .mcp.json and user-scoped ~/.claude.json.[2]
Architectural Characteristics
Section titled “Architectural Characteristics”Loose Coupling
Section titled “Loose Coupling”Loose coupling is a design principle that minimizes dependencies between components.
In MCP’s architecture, the Host does not need to know the implementation details of any Server. MCP separates a JSON-RPC-based data layer from stdio or Streamable HTTP transport, so Server implementations can change while the Host’s connection model remains stable.[1]
One-to-Many Connections
Section titled “One-to-Many Connections”In MCP, the Host creates a Client for each Server connection.[1] This lets the same AI application use multiple MCP servers, such as file system, search, and GitHub servers, in the same environment.
Summary
Section titled “Summary”| Role | What It Is | Primary Responsibility |
|---|---|---|
| Host | The AI app the user interacts with | User interaction, running the AI model |
| Client | Communication component inside the Host | Server communication per the MCP protocol |
| Server | Tool-providing program | Exposing capabilities, executing tool calls |
Frequently Asked Questions
Section titled “Frequently Asked Questions”Q: Can a single AI app have multiple MCP clients?
A: The official MCP documentation describes a Host creating one MCP Client for each MCP Server and maintaining a dedicated connection for that server.[1]
Q: Where do I run MCP servers?
A: MCP servers run either on a local machine or remotely. The official architecture guide describes stdio as the typical local transport and Streamable HTTP as the typical remote transport.[1]
Q: What programming languages can I use to implement a Server?
A: MCP is a protocol, and the official architecture guide treats language-specific SDKs as part of the MCP project set.[1] Check the SDK documentation for the language you plan to use.
Related Links
Section titled “Related Links”- What is MCP? — Basic MCP concepts
- MCP Capabilities — Tools, Resources, and Prompts
References
Section titled “References”- Model Context Protocol, Architecture overview
- Anthropic, Connect Claude Code to tools via MCP