# Host, Client और Server — Agent Frameworks और MCP की बुनियाद

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

> तीन भूमिकाएँ और उनके बीच JSON-RPC messages का प्रवाह वर्णित करें।

## तीन भूमिकाएँ

**Host** वह AI ऐप है जिससे user बात करता है (जैसे Claude Desktop, IDE या आपका अपना agent)। Host हर server के लिए एक **client** connection बनाता है। **Server** वह प्रोग्राम है जो tools, resources और prompts देता है। वे **JSON-RPC 2.0** messages का आदान-प्रदान करते हैं, जो initialize handshake से शुरू होता है जहाँ दोनों पक्ष अपनी क्षमताएँ बताते हैं।

## तार पर एक tool call

सरल किए गए messages: client server से tool चलाने को कहता है, और server content के साथ उत्तर देता है। Host applications यह plumbing आपसे छिपाते हैं।

```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" } ] } }
```

## हर server के लिए एक client

तीन servers वाला host तीन client connections चलाता है। हर connection अलग है, इसलिए एक server दूसरे का डेटा सीधे नहीं पढ़ सकता; host तय करता है कि model को हर एक से क्या दिखे।

**Quiz:** MCP में tools और data access कौन-सी भूमिका चलाती है?

- [ ] Host
- [ ] User
- [x] Server
- [ ] Model provider की billing system

*Answer:* Server. Servers क्षमताएँ उपलब्ध कराते और चलाते हैं; hosts और clients उनसे जुड़ते हैं।
