Model Context Protocol (MCP) Learning Path: A 17-Lesson Curriculum from Stateless Fundamentals to Production Security
The Model Context Protocol (MCP) learning path is a comprehensive, hands-on curriculum that teaches you to design, implement, and secure a stateless, JSON-RPC-based protocol for model-driven workflows through 17 progressive lessons and an optional capstone.
This learning path is defined in the rohitg00/ai-engineering-from-scratch repository within the manifest file learning-paths/model-context-protocol.json. It moves from basic request metadata to advanced conformance engineering, providing production-ready patterns for building interoperable AI tools and servers.
Curriculum Structure: 17 Core Lessons
The MCP learning path consists of 17 required lessons that must be completed sequentially, followed by an optional capstone project. Each lesson builds upon the stateless architectural foundation established in the early phases.
Phase 1: Fundamentals and Transport
- Lesson 1: MCP Fundamentals (
phases/13-tools-and-protocols/06-mcp-fundamentals) introduces per-request metadata (_meta) and the stateless request lifecycle using JSON-RPC 2.0 envelopes. - Lesson 2: Building an MCP Server (
phases/13-tools-and-protocols/07-building-an-mcp-server) demonstrates minimal server implementations in Python and TypeScript that handleserver/discover,tools/list, andtools/callwithout connection-scoped state. - Lesson 3: Building an MCP Client (
phases/13-tools-and-protocols/08-building-an-mcp-client) covers capability discovery, protocol era routing, and dual-era fallback mechanisms. - Lesson 4: MCP Transports (
phases/13-tools-and-protocols/09-mcp-transports) explains stdio framing and stateless Streamable HTTP (POST /mcp) transport mechanisms.
Phase 2: Core Primitives and Context
- Lesson 5: Resources and Prompts (
phases/13-tools-and-protocols/10-mcp-resources-and-prompts) teaches URI-addressable resources and reusable prompts with deterministic caching hints. - Lesson 6: Model Input and MRTR (
phases/13-tools-and-protocols/11-mcp-sampling) describes Multi-Round-Trip Requests (MRTR) for model sampling without server-initiated JSON-RPC calls. - Lesson 7: Explicit Scope and Elicitation (
phases/13-tools-and-protocols/12-mcp-roots-and-elicitation) shows how request-scoped roots replace hidden state and how elicitation responses undergo schema validation.
Phase 3: Extensions and Applications
- Lesson 8: Tasks Extension (
phases/13-tools-and-protocols/13-mcp-async-tasks) adds durable asynchronous tasks that survive across independent requests. - Lesson 9: MCP Apps (
phases/13-tools-and-protocols/14-mcp-apps) demonstrates building UI-driven applications that maintain separation between protocol data and view state.
Phase 4: Security Hardening
- Lesson 10: Security Fundamentals (
phases/13-tools-and-protocols/15-mcp-security-tool-poisoning) protects the routing layer from poisoned metadata and drifted descriptors. - Lesson 11: Authorization Flows (
phases/13-tools-and-protocols/16-mcp-security-oauth-2-1) implements OAuth 2.0-style flows including CIMD, Issuer Binding, PKCE, and step-up authentication bound to request metadata. - Lesson 12: Production Auth (
phases/13-tools-and-protocols/18-mcp-auth-production) covers issuer-bound enrollment, token validation, and multi-issuer handling in production environments.
Phase 5: Infrastructure and Conformance
- Lesson 13: Gateways and Registries (
phases/13-tools-and-protocols/17-mcp-gateways-and-registries) examines registry admission logic, immutable descriptors, and gateway routing patterns. - Lesson 14: Tool Contracts (
phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content) defines strict tool descriptors with schema validation, annotations, and header-to-body mapping. - Lesson 15: Reliability and Flow Control (
phases/13-tools-and-protocols/29-mcp-reliability-cancellation-and-flow-control) provides deterministic cancellation, deadline enforcement, and disconnect handling without sleep-based race conditions. - Lesson 16: Registry Supply Chain (
phases/13-tools-and-protocols/30-mcp-registry-supply-chain-and-drift) manages namespace collisions, descriptor drift detection, and rollback decisions. - Lesson 17: Conformance Engineering (
phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations) builds conformance matrices, generates release decisions based on additive-field behavior, and records wire transcripts.
After completing these 17 lessons, learners may attempt the optional capstone (phases/13-tools-and-protocols/23-capstone-tool-ecosystem), which integrates the entire stack into a stateless tool ecosystem. This final project requires completion of two prerequisite learning paths in addition to the core MCP curriculum.
Stateless Architecture and JSON-RPC Foundation
The entire Model Context Protocol learning path rests on a strictly stateless, JSON-RPC 2.0-based architecture. Every request must embed a _meta object containing protocolVersion, clientCapabilities, and optional clientInfo (see lines 57‑66 of the fundamentals documentation). This guarantees that each request can be interpreted in isolation, eliminating the need for handshakes or connection-scoped state.
Requests and responses follow the standard JSON-RPC envelope shape:
{
"jsonrpc": "2.0",
"id": "request-id",
"method": "server/discover",
"params": {
"_meta": {
"protocolVersion": "2026-07-28",
"clientCapabilities": {}
}
}
}
Error handling uses standard JSON-RPC error codes including -32600 (Invalid Request), -32602 (Invalid params), and -32022 (Unsupported protocol version). The mandatory server/discover method advertises supported protocol versions, server capabilities, and cache hints, enabling clients to negotiate the correct era without maintaining persistent connections.
Protocol Primitives: Tools, Resources, and Prompts
The MCP specification defines three core primitives that learners implement throughout the path:
- Tools – Invoked via
tools/call, these are deterministic functions with strict input schemas and output annotations. Lesson 14 covers tool contracts in depth, including header↔body mapping and schema validation. - Resources – Addressed via
resources/read, these provide URI-addressable context with deterministic caching hints (Lesson 5). - Prompts – Retrieved via
prompts/get, these are reusable templates for model interaction that support parameter substitution.
All primitives return cache-aware results with TTL metadata, allowing clients to optimize repeated requests without server round-trips.
Security and Reliability Patterns
Lessons 10–12 form a comprehensive security module. Metadata poisoning protection (Lesson 10) validates _meta contents and rejects requests with drifted or malicious metadata before routing occurs. The authorization layer (Lessons 11–12) implements CIMD (Client-Initiated Metadata Distribution), PKCE (Proof Key for Code Exchange), and step-up authentication flows bound directly to the request metadata rather than connection state.
Multi-Round-Trip Requests (MRTR) enable complex interactions like model sampling without violating the stateless constraint. Instead of the server initiating autonomous JSON-RPC calls, the client receives a partial response indicating required additional information, then resubmits the original operation with extended parameters (Lesson 6).
Reliability engineering (Lesson 15) introduces deterministic cancellation tokens, explicit deadlines, and flow control mechanisms that prevent race conditions without relying on network timeouts or sleep statements.
Implementation Example: Stateless MCP Server
The following implementation from phases/13-tools-and-protocols/06-mcp-fundamentals/code/main.py demonstrates the core request handling loop:
# Build a request with per-request metadata (lines 70-85)
def make_request(request_id, method, params=None, *, version="2026-07-28", capabilities=None):
body_params = dict(params or {})
body_params["_meta"] = request_meta(version, capabilities) # request_meta defined at lines 56-68
return {
"jsonrpc": "2.0",
"id": request_id,
"method": method,
"params": body_params,
}
# Validate the incoming request (lines 17-46)
def validate_request(message):
request_id = message.get("id")
if message.get("jsonrpc") != "2.0" or not isinstance(message.get("method"), str):
return rpc_error(request_id, -32600, "Invalid Request")
# Additional checks for params, _meta, version, capabilities...
return None # None => request is valid
# Dispatch the method after validation (lines 49-97)
def dispatch(message):
if "id" not in message:
return None
invalid = validate_request(message)
if invalid is not None:
return invalid
request_id = message["id"]
method = message["method"]
if method == "server/discover":
result = complete_result({
"supportedVersions": SUPPORTED_VERSIONS.copy(),
"capabilities": SERVER_CAPABILITIES.copy(),
"instructions": "Use notes_list for titles and notes_search for keywords.",
}, ttl_ms=3_600_000, cache_scope="public")
# ... other method branches ...
return {"jsonrpc": "2.0", "id": request_id, "result": result}
Execute the quick-start command to see a trace of four sample requests, including an intentional unsupported version error (-32022):
python3 phases/13-tools-and-protocols/06-mcp-fundamentals/code/main.py
Key Files and Repository Structure
The following files constitute the reference implementation and documentation for the MCP learning path:
learning-paths/model-context-protocol.json– Master manifest enumerating all 17 lessons, ordering, estimated minutes, and required evidence artifacts.phases/13-tools-and-protocols/06-mcp-fundamentals/docs/en.md– Introductory documentation explaining the stateless request model and discovery flow.phases/13-tools-and-protocols/06-mcp-fundamentals/code/main.py– Minimal Python server demonstrating JSON-RPC message building, validation, and dispatch.phases/13-tools-and-protocols/07-building-an-mcp-server/docs/en.md– Full-featured stateless server implementation guide (Python and TypeScript).phases/13-tools-and-protocols/08-building-an-mcp-client/docs/en.md– Client-side discovery, routing, and dual-era fallback logic.phases/13-tools-and-protocols/15-mcp-security-tool-poisoning/docs/en.md– Security validation patterns for metadata poisoning prevention.phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/docs/en.md– Conformance engineering guide for versioning, evidence collection, and release operations.
Summary
- The Model Context Protocol learning path contains 17 required lessons that progress from JSON-RPC basics to production conformance engineering.
- The protocol is strictly stateless, requiring per-request metadata (
_meta) that includesprotocolVersionandclientCapabilities. - Core primitives include Tools (
tools/call), Resources (resources/read), and Prompts (prompts/get), all supporting deterministic caching. - MRTR (Multi-Round-Trip Requests) enable complex model interactions without violating stateless constraints or requiring server-initiated calls.
- Security layers include metadata poisoning prevention, CIMD/PKCE authorization flows, and immutable descriptor validation.
- The curriculum culminates in conformance engineering, teaching learners to generate release decisions based on compatibility matrices and wire transcripts.
Frequently Asked Questions
What prerequisites are required before starting the MCP learning path?
According to the learning-paths/model-context-protocol.json manifest, you must complete two prerequisite learning paths before attempting the optional capstone project. While the 17 core lessons are self-contained, familiarity with JSON-RPC 2.0 fundamentals and basic Python or TypeScript is assumed for the implementation exercises.
How does the Model Context Protocol maintain statelessness across complex interactions?
MCP enforces statelessness by requiring every request to include complete context within the _meta object, containing protocolVersion, clientCapabilities, and optional clientInfo (lines 57‑66 of the fundamentals documentation). For multi-step operations like model sampling, Multi-Round-Trip Requests (MRTR) allow the client to receive a partial response and resubmit the request with additional data, rather than maintaining server-side session state or allowing the server to initiate autonomous calls.
What distinguishes MCP tools from resources?
Tools are executable functions invoked via tools/call that perform actions and return computed results, while Resources are URI-addressable data sources accessed via resources/read that provide context for model operations. As implemented in phases/13-tools-and-protocols/10-mcp-resources-and-prompts, resources include deterministic caching hints (TTL and cache scope), whereas tools emphasize schema-structured input/output contracts defined in phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content.
How does MCP handle security and authorization?
The protocol implements defense-in-depth through metadata validation (Lesson 10) that rejects poisoned _meta before routing, followed by CIMD and PKCE-based OAuth 2.0 flows (Lesson 11) that bind authorization to specific request metadata rather than connection state. Production deployments (Lesson 12) enforce issuer-bound enrollment and token validation, while gateways (Lesson 13) verify immutable descriptor snapshots to prevent supply chain attacks.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →