| Roles |
|---|
| Host | The AI application the user runs — owns the model and the permissions. | Claude Desktop, an IDE, your agent |
| Client | The connector inside the host; one client per server, 1:1. | host spawns a client per MCP server |
| Server | The program exposing capabilities over the protocol. | a Postgres MCP server |
| Primitives |
|---|
| Resources | Read-only context the model can attach — files, rows, documents. | resources/list → resources/read |
| Tools | Executable functions the model may call, with user approval. | tools/call { name: 'query', args } |
| Prompts | Reusable prompt templates the server ships; user-invoked. | prompts/get { name: 'code-review' } |
| Sampling | Server asks the host's model to complete text — the reverse direction. | sampling/createMessage |
| Transports |
|---|
| stdio | Local servers: JSON-RPC over the process's stdin/stdout. | command: npx mcp-server-pg |
| Streamable HTTP | Remote servers: HTTP POST + optional SSE stream. | https://mcp.example.com/mcp |
| JSON-RPC 2.0 | The message envelope everywhere — requests, responses, notifications. | {"jsonrpc":"2.0","method":"tools/list"} |
| Lifecycle |
|---|
| initialize | Client and server exchange capabilities and protocol version. | initialize → initialized |
| Discovery | List what exists: tools/list, resources/list, prompts/list. | tools/list |
| Operation | Normal traffic — calls, reads, subscriptions. | resources/subscribe |
| Shutdown | Close the transport; no special message required. | process exit / connection close |