# Host, Client and Server — Agent Frameworks and MCP Basics

Source: https://www.geekswithgeeks.com/en/agent-frameworks-mcp/mcp-architecture

> Describe the three roles and how JSON-RPC messages flow between them.

## Three roles

The **host** is the AI application the user talks to (such as Claude Desktop, an IDE or your own agent). The host creates one **client** connection per server. The **server** is a program exposing tools, resources and prompts. They exchange **JSON-RPC 2.0** messages, starting with an initialize handshake where both sides declare their capabilities.

## A tool call on the wire

Simplified messages: the client asks the server to run a tool, and the server responds with content. Host applications hide this plumbing from you.

```json
// client -> server
{ "jsonrpc": "2.0", "id": 7, "method": "tools/call",
  "params": { "name": "add", "arguments": { "a": 2, "b": 3 } } }

// server -> client
{ "jsonrpc": "2.0", "id": 7,
  "result": { "content": [ { "type": "text", "text": "5" } ] } }
```

## One client per server

A host with three servers runs three client connections. Each connection is isolated, so one server cannot read another server's data directly; the host decides what the model sees from each.

**Quiz:** Which role runs the tools and data access in MCP?

- [ ] The host
- [ ] The user
- [x] The server
- [ ] The model provider's billing system

*Answer:* The server. Servers expose and execute capabilities; hosts and clients connect to them.
