The MCP protocol under the hood
TL;DR
MCP is a JSON-RPC protocol layered on top of a transport. Two applications build one-way JSON-RPC message routes over stdio or HTTP. The protocol establishes authentication, capability negotiation, and a defined lifecycle for tools, resources, and prompts.
Message layer
The message layer uses JSON-RPC. The two applications create connections in which one side sends requests and the other responds; notifications flow in either direction without a reply.
Initialization
Every connection begins with an initialize request. It identifies the protocol version and the client's capabilities. The server replies with its version and capabilities. Both sides agree on a baseline before any tool or resource operation.
Primitives lifecycle
Tools, resources, and prompts each have a list-request and an invocation lifecycle. The client discovers what the server supports, then exercises it. Each primitive is a first-class protocol concept, not a special case.
Authorization
For remote servers, the specification supports OAuth-based authorization for advertised protected endpoints. Authentication controls who may connect; the transported messages remain JSON-RPC.