MCP Explained: The Protocol That Lets AI Models Call Your Tools

A visual walkthrough of the Model Context Protocol (MCP), the JSON-RPC 2.0 spec that standardizes how AI models call tools, read resources, and use prompts. The guide covers the message flow, the lifecycle, transports like stdio and Streamable HTTP, OAuth 2.1 authorization, and the security risks — tool poisoning, shadowing, and prompt injection — that come with giving models access to real systems.
Every MCP message is JSON-RPC 2.0. There are only three shapes: a request (has an id, wants an answer), a response (same id, carries a result or an error) and a notification (no id, no answer).