πŸ€– HarDojo
Log in Sign up

MCP Architecture

Hosts, clients, servers, and transports β€” how the pieces fit.

MCP has a small, precise vocabulary. Get these four terms right and every tutorial becomes obvious.

The pieces

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    MCP    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ MCP HOST   β”‚ ────────> β”‚ MCP CLIENT │───>β”‚ MCP SERVER β”‚
β”‚ (Claude,   β”‚           β”‚ (1 per      β”‚    β”‚ (provides  β”‚
β”‚  Cursor)   β”‚           β”‚  server)    β”‚    β”‚  tools)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Host β€” the AI application (Claude Desktop, Cursor, Claude Code). It wants to use tools.
  • Client β€” a connection the host opens to one server. 1:1 with a server.
  • Server β€” a program exposing tools/resources/prompts. It does the real work.
  • Transport β€” how client and server talk: stdio (same machine, spawned process) or HTTP/SSE (network).

Lifecycle

  1. The host reads its config and launches each server (e.g. npx -y @modelcontextprotocol/server-filesystem).
  2. The client and server handshake β€” exchange capabilities.
  3. The server announces its tools, resources, and prompts.
  4. When the user asks something, the model calls a tool through the host.
  5. The server runs the tool and returns a result β€” which becomes new context for the model.

The config format

Every client uses essentially the same JSON:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." }
    }
  }
}

command + args describe how to launch the server; env passes secrets.

Why stdio is the default

Local servers are spawned as child processes and talk over stdin/stdout. That means they run on your machine with your credentials β€” private and controllable.

Remember: one host, many clients, many servers. The host is the brain; the servers are the hands.