๐Ÿ—บ๏ธ COMPLETE IN-DEPTH ROADMAP: BUILDING MODEL CONTEXT PROTOCOL (MCP)

From Zero to Advanced โ€” Architecture, Design, Development, Security, and Beyond

Reference: Official MCP Specification (v2025-11-25) | Linux Foundation | Anthropic Open Source | Research Literature

Version: 2025-11-25 | Purpose: Educational and Research Roadmap | Governance: Agentic AI Foundation (AAIF) under Linux Foundation

0. WHAT IS MCP AND WHY IT EXISTS

The Model Context Protocol (MCP) is an open standard and open-source framework introduced by Anthropic in November 2024 to standardize the way AI systems like large language models integrate and share data with external tools, systems, and data sources.

The Core Problem MCP Solves โ€” The Nร—M Integration Nightmare

Before MCP, every AI application had to build a unique custom connector for every external data source. If you had 10 AI apps and 10 data sources, you needed up to 100 unique integration pipelines โ€” each with its own authentication, parsing, error handling, and maintenance burden. MCP solves this by introducing a standardized protocol, reducing the equation from Nร—M integrations to N+M integrations โ€” a massive reduction in complexity.

Analogy: MCP is to AI what USB is to hardware

Just as USB standardized how devices connect to computers regardless of the manufacturer, MCP standardizes how AI models connect to data sources and tools. MCP takes inspiration from the Language Server Protocol (LSP), which standardized how to add support for programming languages across development tools. In a similar way, MCP standardizes how to integrate additional context and tools into the ecosystem of AI applications.

Ecosystem Adoption

1. STRUCTURED LEARNING PATH & TOPICS

LEARNING PATH FLOW

STAGE 1: FOUNDATION             STAGE 2: CORE CONCEPTS          STAGE 3: PROTOCOL MECHANICS
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ - What is MCP       โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ - Host / Client /     โ”‚ โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ - JSON-RPC 2.0          โ”‚
โ”‚ - Why it matters    โ”‚         โ”‚   Server model        โ”‚        โ”‚ - Transport Layers      โ”‚
โ”‚ - Prerequisites     โ”‚         โ”‚ - Primitives          โ”‚        โ”‚ - Lifecycle & Handshake โ”‚
โ”‚ - Ecosystem map     โ”‚         โ”‚   (Tools/Resources/   โ”‚        โ”‚ - Message Types         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚    Prompts)           โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                                            โ”‚
STAGE 6: PRODUCTION             STAGE 5: SECURITY               STAGE 4: SERVER DEVELOPMENT
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ - Deployment        โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ - Auth & Authorizationโ”‚ โ—„โ”€โ”€โ”€โ”€โ”€ โ”‚ - SDK Setup             โ”‚
โ”‚ - Observability     โ”‚         โ”‚ - Threat Models       โ”‚        โ”‚ - Tools Implementation  โ”‚
โ”‚ - Scaling           โ”‚         โ”‚ - Consent Flow        โ”‚        โ”‚ - Resource Serving      โ”‚
โ”‚ - Registry          โ”‚         โ”‚ - Audit Logging       โ”‚        โ”‚ - Prompt Templates      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    

STAGE 1 โ€” FOUNDATIONS (Week 1โ€“2)

Topic 1.1 โ€” Understanding Protocols in AI Context
  • What is a protocol vs. an API vs. a framework
  • How LLMs process context windows
  • The stateless nature of LLM inference
  • Why external tools are needed at runtime (as opposed to fine-tuning or RAG alone)
  • History: function calling (OpenAI 2023) โ†’ ChatGPT plugins โ†’ MCP
Topic 1.2 โ€” Prerequisites and Tech Stack Baseline
  • Python 3.10+ or Node.js 18+ (both supported officially)
  • Understanding of async/await programming patterns
  • JSON and JSON Schema fundamentals
  • REST API and HTTP concepts (GET, POST, headers, status codes)
  • Basic understanding of processes, stdin/stdout, and inter-process communication
  • Familiarity with TypeScript or Python type hints
Topic 1.3 โ€” MCP Ecosystem Overview
  • The protocol was released with SDKs in Python, TypeScript, C# and Java. Anthropic maintains an open-source repository of reference MCP server implementations for enterprise systems.
  • Official SDKs: Python SDK, TypeScript SDK, Java SDK, C# SDK, Kotlin SDK
  • Key consumers: Claude Desktop, VS Code extensions, Cursor IDE, Replit, Sourcegraph, Zed Editor
  • Reference MCP servers: Filesystem, GitHub, PostgreSQL, Slack, Google Drive, Brave Search
Topic 1.4 โ€” The Language Server Protocol Connection
  • LSP architecture (editor โ†” language server)
  • How MCP mirrors this pattern for AI โ†” data source
  • Capability negotiation concept borrowed from LSP
  • JSON-RPC as the shared message format

STAGE 2 โ€” CORE ARCHITECTURE CONCEPTS (Week 3โ€“4)

Topic 2.1 โ€” The Three-Role Model

The core architecture components are Hosts (applications like Claude Desktop or IDEs that initiate connections), Clients (components that maintain 1:1 connections with servers), and Servers (lightweight programs that provide specific capabilities such as tools or resources).

Roles in Detail:
  • HOST: The user-facing AI application (e.g., Claude Desktop, a custom chatbot, an IDE plugin). The host orchestrates LLM interactions, manages multiple client instances, enforces access controls, and is responsible for user consent flows. The host is what the end-user directly interacts with.
  • CLIENT: Lives inside the host. Maintains exactly one connection per server. Handles protocol negotiation, sends requests, and receives responses. The client is the protocol-level bridge between the host logic and the external server.
  • SERVER: Lightweight external program (local subprocess or remote HTTP service) that exposes capabilities โ€” tools the AI can call, resources it can read, and prompt templates it can use. Each server should have one focused purpose.
ROLE RELATIONSHIP MAP โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ HOST APPLICATION โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ MCP โ”‚ โ”‚ MCP โ”‚ โ”‚ MCP โ”‚ โ”‚ โ”‚ โ”‚ Client 1 โ”‚ โ”‚ Client 2 โ”‚ โ”‚ Client 3 โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ–ผ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP โ”‚ โ”‚ MCP โ”‚ โ”‚ MCP โ”‚ โ”‚ Server A โ”‚ โ”‚ Server B โ”‚ โ”‚ Server C โ”‚ โ”‚(Filesystem) โ”‚(Database)โ”‚ โ”‚ (GitHub) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Topic 2.2 โ€” The Three Core Primitives

Everything an MCP server exposes belongs to one of three primitive categories:

TOOLS
  • Executable functions that the LLM can invoke (like function calling)
  • Each tool has a name, a description, and a JSON Schema defining its input parameters
  • Tools cause side effects (write data, send emails, execute code, call APIs)
  • Must be treated with highest security scrutiny โ€” tools represent arbitrary code execution and must be treated with appropriate caution
  • Examples: create_file, send_message, execute_sql, search_web
RESOURCES
  • Read-only data sources that the LLM can access to gain context
  • Can be static (a file) or dynamic (a database query result)
  • Each resource has a URI (Uniform Resource Identifier) following the format scheme://path/to/resource
  • Examples: file:///home/user/document.txt, postgres://db/table, github://repo/issues
  • Two sub-types: direct resources (immediately available) and resource templates (URI patterns with parameters)
PROMPTS
  • Pre-defined, reusable prompt templates stored on the server
  • Can accept arguments to fill in dynamic content
  • Allow standardization of how LLMs interact with domain-specific systems
  • Examples: a code review prompt template, a SQL query builder prompt, a customer support script prompt
Topic 2.3 โ€” Capability Discovery

Capability Discovery is a crucial feature that allows AI systems to dynamically understand what resources and tools are available through connected MCP servers. This discovery mechanism enables AI systems to adapt their behavior based on available capabilities rather than requiring pre-configured knowledge of system limitations.

Discovery method calls:
  • tools/list โ€” returns all available tools with their descriptions and schemas
  • resources/list โ€” returns all available resources and their URIs
  • prompts/list โ€” returns all available prompt templates
  • resources/read โ€” reads a specific resource by URI
Topic 2.4 โ€” Context Preservation and State

The protocol supports both session-based context (maintained across a single conversation or task) and persistent context (maintained across multiple sessions) depending on the specific use case and security requirements.

STAGE 3 โ€” PROTOCOL MECHANICS (Week 5โ€“6)

Topic 3.1 โ€” JSON-RPC 2.0 as the Wire Format

MCP uses JSON-RPC 2.0 as its wire format. The transport layer is responsible for converting MCP protocol messages into JSON-RPC format for transmission and converting received JSON-RPC messages back into MCP protocol messages.

Three message types in JSON-RPC 2.0 as used by MCP:
  • Request โ€” sent when a response is expected. Contains jsonrpc, id, method, and optional params.
  • Response โ€” returned for every request. Contains jsonrpc, id, and either result (success) or error (failure with code and message).
  • Notification โ€” one-way fire-and-forget message. Contains jsonrpc and method but NO id. No response is expected.
JSON-RPC MESSAGE IDENTIFICATION LOGIC Has method field + has id field โ†’ REQUEST Has result/error field + has id โ†’ RESPONSE Has method field + NO id field โ†’ NOTIFICATION
Topic 3.2 โ€” Transport Layer Mechanisms

The protocol currently defines two standard transport mechanisms for client-server communication: stdio (communication over standard input and standard output) and Streamable HTTP.

STDIO Transport (Local Servers)
  • The host/client spawns the MCP server as a child process
  • Communication happens through the process's stdin and stdout streams
  • The client writes JSON-RPC messages to the server's STDIN; the server writes responses to STDOUT
  • Zero network overhead โ€” ideal for local tools, file system access, CLI integrations
  • Best for: local development tools, file system servers, code execution environments, desktop applications
  • Security boundary: process-level isolation
Streamable HTTP Transport (Remote Servers)
  • Introduced in March 2025 as the modern standard for remote MCP connections
  • Client sends JSON-RPC messages as HTTP POST requests to a single MCP endpoint
  • Server can respond with either immediate JSON or an SSE (Server-Sent Events) stream for long-running operations
  • Client can also open an SSE stream via HTTP GET for server-initiated messages
  • Supports standard HTTP authentication (API keys, OAuth tokens, Bearer tokens)
  • Best for: cloud services, public APIs, multi-tenant deployments, web-accessible tools
SSE Transport (Legacy โ€” Deprecated)
  • HTTP+SSE was the original HTTP transport from the 2024-11-05 specification
  • Deprecated in favor of Streamable HTTP in the 2025 spec
  • Servers should maintain backwards compatibility by hosting both old SSE endpoints and the new Streamable HTTP endpoint
WebSockets (Custom Transport)
  • Not standardized in the spec but supported as a custom transport
  • True full-duplex connection, lower latency for interactive scenarios
  • Best for: AI-powered IDEs needing real-time bidirectional communication, long-running interactive sessions
Topic 3.3 โ€” Connection Lifecycle

The MCP lifecycle describes the complete sequence of steps governing how a host and server establish, use, and end a connection. Initialization must be the first interaction between client and server.

CONNECTION LIFECYCLE FLOW Client Server โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ initialize (version, caps) โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ”‚ โ”‚ โ—„โ”€โ”€โ”€ initialize response (caps) โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ notifications/initialized โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ”‚ โ”‚ [ACTIVE SESSION BEGINS] โ”‚ โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ tools/list โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ—„โ”€โ”€โ”€ tools list response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ tools/call (name, args) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ—„โ”€โ”€โ”€ tool result โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ resources/read (uri) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ—„โ”€โ”€โ”€ resource content โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚ โ”‚ โ”‚ โ”€โ”€โ”€โ”€ [SHUTDOWN SIGNAL] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ โ”‚ โ”‚ โ”‚ [CONNECTION TERMINATED]
Initialization Rules:
  • The client must not send requests (except pings) before the server responds to initialization, and the server must not send requests (except pings and logging) before receiving the initialized notification.
  • Protocol version negotiation happens here โ€” client and server agree on the spec version
  • Capability exchange tells each side what features are supported
Topic 3.4 โ€” Utility Mechanisms
  • PING โ€” lightweight heartbeat to verify the connection is still alive. Can be sent before full initialization.
  • CANCELLATION โ€” a notifications/cancelled message that explicitly stops an in-progress request
  • PROGRESS NOTIFICATIONS โ€” servers can emit notifications/progress for long-running operations
  • PAGINATION โ€” for large lists (tools, resources, prompts), cursor-based pagination is used via nextCursor tokens
  • LOGGING โ€” servers can send log messages to clients at various severity levels
  • COMPLETION โ€” servers can provide auto-completion suggestions for resource URI templates and prompt arguments
Topic 3.5 โ€” Sampling (Client โ†’ Server Direction)

Sampling is a unique capability where MCP servers can request the host LLM to perform text generation. This enables servers to create agentic loops where the server uses AI to make decisions during its own processing. The server sends a sampling/createMessage request to the client, which passes it to the LLM and returns the result.

Topic 3.6 โ€” Roots

Roots define the filesystem boundaries that an MCP server is allowed to access. The client provides a list of root URIs (directories) to the server during connection. This is a key security control โ€” servers should only operate within declared root paths.

STAGE 4 โ€” SERVER DEVELOPMENT (Week 7โ€“10)

Topic 4.1 โ€” SDK Setup and Project Structure

Official SDKs and their minimum requirements:

  • Python SDK: Python 3.10+, pip install mcp or uv add mcp
  • TypeScript SDK: Node.js 18+, npm install @modelcontextprotocol/sdk
  • Java SDK: Java 17+
  • C# SDK: .NET 8+
  • Kotlin SDK: Kotlin 1.9+
Recommended project layout (Python):
my-mcp-server/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ __init__.py โ”‚ โ”œโ”€โ”€ server.py โ† main server definition โ”‚ โ”œโ”€โ”€ tools/ โ† individual tool handlers โ”‚ โ”œโ”€โ”€ resources/ โ† resource handlers โ”‚ โ””โ”€โ”€ prompts/ โ† prompt templates โ”œโ”€โ”€ tests/ โ”œโ”€โ”€ pyproject.toml โ””โ”€โ”€ README.md
Topic 4.2 โ€” Defining and Implementing Tools

Tools are the most powerful primitive and require the most careful design:

  • Give each tool a highly descriptive name (snake_case)
  • Write rich descriptions because the LLM reads these to decide which tool to call
  • Define a strict JSON Schema for all input parameters, including types, required fields, and descriptions
  • Return structured content: text, images, embedded resources, or error objects
  • Always validate inputs before processing
  • Handle and return meaningful errors
Tool Design Principles:
  • Single responsibility โ€” each tool does exactly one thing
  • Idempotent where possible โ€” calling the same tool twice with the same arguments should produce the same result
  • Minimal privilege โ€” request only the permissions your tool actually needs
  • Descriptive errors โ€” return error messages that help the LLM understand what went wrong and how to correct its call
Topic 4.3 โ€” Defining and Implementing Resources

Resources represent data the LLM can read:

  • Static resources: files, documentation, configuration data with fixed URIs
  • Dynamic resources: database rows, API results represented via URI templates like orders://{order_id}/details
  • Resources must return content in supported MIME types: text/plain, text/html, application/json, image/png, application/pdf
  • Resources can be subscribed to โ€” clients can request notifications when resources change
Topic 4.4 โ€” Defining Prompt Templates

Prompt templates are parameterized message sequences:

  • Define argument names and their descriptions
  • Templates are resolved server-side and returned as a fully formed list of messages
  • Can include embedded resources as context within the prompt
  • Useful for: standardizing how users interact with complex systems, creating domain-specific interaction patterns
Topic 4.5 โ€” Server Design Patterns
FOCUSED SERVICES PATTERN (Best Practice) โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Database โ”‚ โ”‚ File System โ”‚ โ”‚ Email โ”‚ โ”‚ MCP Server โ”‚ โ”‚ MCP Server โ”‚ โ”‚ MCP Server โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ - query_db โ”‚ โ”‚ - read_file โ”‚ โ”‚ - send_email โ”‚ โ”‚ - insert_row โ”‚ โ”‚ - write_file โ”‚ โ”‚ - list_inbox โ”‚ โ”‚ - list_tables โ”‚ โ”‚ - list_dir โ”‚ โ”‚ - search_email โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Each MCP server should have one clear, well-defined purpose. The monolithic anti-pattern (a "mega-server" that handles databases, files, APIs, and email all in one) should be avoided in favor of focused, single-purpose services.

Topic 4.6 โ€” Client Development

Building an MCP client (for a custom host application):

  • Initialize connection and perform capability negotiation
  • Maintain session state across the conversation
  • Implement the tools/list โ†’ tools/call flow
  • Handle streaming responses correctly
  • Build the consent and authorization UI for users
  • Manage multiple server connections (one client per server)
  • Implement proper disconnection and reconnection logic
Topic 4.7 โ€” Testing MCP Servers
  • Use the MCP Inspector (official web-based debugging tool) for interactive testing
  • Unit testing individual tool handlers in isolation
  • Integration testing with a real MCP client (MCP Inspector, Claude Desktop, or a test harness)
  • Test edge cases: malformed inputs, empty results, authentication failures, network timeouts
  • Test pagination for large datasets
  • Test cancellation handling for long-running operations

STAGE 5 โ€” SECURITY (Week 7โ€“8)

Full security details in Section 5 below.

STAGE 6 โ€” PRODUCTION (Week 10โ€“12)

  • Deployment: Docker containerization, Kubernetes orchestration
  • Observability: Structured logging, OpenTelemetry, Prometheus metrics
  • Scaling: Horizontal pod autoscaling, connection pooling
  • Registry: Publishing to MCP registry for discovery

2. ALGORITHMS, TECHNIQUES & TOOLS

2.1 โ€” Core Protocol Algorithms

Capability Negotiation Algorithm
  • Step 1: Client sends its supported protocol version range and capability flags
  • Step 2: Server selects the highest mutually supported version
  • Step 3: Server declares its own capabilities (which primitives it supports)
  • Step 4: Client stores server capabilities for the session and only calls supported methods
  • Failure path: if no compatible version exists, connection is rejected with an error
Tool Selection Algorithm (LLM-side)
  • Step 1: LLM receives user message
  • Step 2: LLM queries tools/list to discover available capabilities
  • Step 3: LLM maps user intent to the most relevant tool(s)
  • Step 4: LLM constructs tool call with arguments matching the tool's JSON Schema
  • Step 5: LLM submits the call, receives result, incorporates into its context
  • Step 6: LLM decides whether to call another tool or respond to the user
Message Routing and Multiplexing
  • Each request has a unique id field (integer or string)
  • Responses are matched to requests by their id
  • Notifications have no id and are processed asynchronously
  • Multiple in-flight requests can coexist (non-blocking async pattern)
Context Window Management
  • Resources are included in the LLM context window on demand
  • Large resources should be paginated or chunked to avoid exceeding token limits
  • The MCP host is responsible for deciding which resources to include and in what order
  • Sampling requests from servers consume additional context window capacity
Cursor-based Pagination
  • For large lists, the server returns a nextCursor token in the response
  • The client re-issues the list request with cursor: <nextCursor> to get the next page
  • Pagination is stable โ€” the cursor represents a specific point in the dataset, not a page number

2.2 โ€” Data Structures and Formats

  • JSON Schema (Draft 7) โ€” used to define tool input schemas and resource templates
  • URI templating (RFC 6570) โ€” used for dynamic resource URIs with variable path segments
  • MIME types โ€” used to specify the content type of resources and tool outputs
  • Base64 encoding โ€” used to transmit binary content (images, PDFs) within JSON messages
  • ISO 8601 timestamps โ€” used in logging and progress notifications

2.3 โ€” Security Techniques

  • OAuth 2.1 / PKCE โ€” for authorization on remote HTTP servers (added to spec March 2025)
  • Bearer token authentication โ€” passed in HTTP Authorization headers
  • TLS/HTTPS โ€” mandatory for all remote HTTP transport connections
  • JSON Schema validation โ€” input sanitization before tool execution
  • Origin header validation โ€” protection against DNS rebinding attacks on local servers
  • Rate limiting โ€” per-client and per-tool request rate controls
  • Audit logging โ€” structured logs of every tool call, resource access, and authorization decision

2.4 โ€” Performance Techniques

  • Connection pooling โ€” reuse connections to backing data sources (databases, HTTP APIs)
  • Multi-level caching โ€” in-memory (L1), shared Redis (L2), database (L3) for frequent resource requests
  • Async/await non-blocking I/O โ€” critical for servers handling concurrent client requests
  • Streaming responses โ€” progressive delivery of large tool outputs via SSE
  • Lazy resource loading โ€” only load resource content when actually requested

2.5 โ€” Key Tools in the MCP Ecosystem

Development Tools
  • MCP Inspector โ€” official browser-based interactive debugging and testing tool for MCP servers
  • Claude Desktop โ€” primary MCP host for local development and testing
  • Cursor IDE / Windsurf / VS Code โ€” MCP-enabled IDEs for developer tooling
  • uv (Python) โ€” fast package manager recommended for MCP Python servers
Infrastructure Tools
  • Docker / Podman โ€” containerization for MCP server deployment
  • Kubernetes โ€” orchestration for production MCP server scaling
  • Cloudflare Workers โ€” serverless deployment platform with native MCP support
  • Redis โ€” shared caching layer for multi-instance MCP deployments
  • Prometheus + Grafana โ€” metrics collection and dashboarding for MCP servers
  • OpenTelemetry โ€” distributed tracing across MCP server chains
Testing and Quality
  • Pytest (Python) / Jest (TypeScript) โ€” unit and integration testing
  • MCP Conformance Test Suite โ€” official test suite to verify protocol compliance
  • Postman / Bruno โ€” HTTP-level testing for Streamable HTTP transport servers

3. DESIGN & DEVELOPMENT PROCESS

3.1 โ€” Forward Engineering Path (Scratch to Advanced)

PHASE 1: CONCEPT AND REQUIREMENTS
Step 1 โ€” Problem Definition
  • What data source or tool do you want to expose to an AI?
  • Who are the users (developers, end users, automated agents)?
  • What are the security requirements (public vs. internal vs. sensitive data)?
  • What latency is acceptable (real-time tools vs. batch resources)?
  • Local (STDIO) or remote (HTTP) deployment?
Step 2 โ€” Primitive Selection
  • Does the AI need to perform actions? โ†’ Use Tools
  • Does the AI need to read data for context? โ†’ Use Resources
  • Does the AI need structured interaction templates? โ†’ Use Prompts
  • Most servers use all three, but start with only what you need
Step 3 โ€” Tool Interface Design (API-First)
  • List every operation your server will expose
  • For each operation, define: name, description (written for an LLM), input schema, output format
  • Think of tool descriptions as documentation for the AI, not for humans
  • Write descriptions that clarify WHEN to use the tool, not just what it does
PHASE 2: SCAFFOLDING AND SKELETON
Step 4 โ€” Project Setup
  • Choose language (Python recommended for beginners, TypeScript for frontend-heavy projects)
  • Initialize package manager (uv for Python, npm/bun for TypeScript)
  • Install MCP SDK
  • Set up a basic server with your chosen transport
Step 5 โ€” Stub Implementation
  • Create empty tool handlers that return placeholder responses
  • Register all tools, resources, and prompts in the server manifest
  • Connect transport and verify the server starts without errors
  • Run MCP Inspector and confirm tools appear in the discovery list
Step 6 โ€” Iterative Tool Implementation
  • Implement one tool at a time, fully and with tests
  • Test in MCP Inspector before moving to the next tool
  • Implement input validation first, then business logic, then error handling
  • Add comprehensive error messages that help the LLM understand what went wrong
PHASE 3: INTEGRATION AND CONTEXT
Step 7 โ€” Resource Implementation
  • Identify what contextual data will improve the AI's responses
  • Implement resource handlers to serve this data
  • Use URI templates for parameterized resources
  • Test resource reading via resources/read in MCP Inspector
Step 8 โ€” Prompt Template Implementation
  • Design prompt templates for your most common use cases
  • Test that prompt arguments are validated and templates render correctly
  • Ensure prompt content is accurate and clearly instructs the LLM
Step 9 โ€” Host Integration
  • Connect your server to Claude Desktop (or another host) via the config file
  • Test with real LLM interactions โ€” observe how the model uses your tools
  • Refine tool descriptions based on actual LLM behavior
PHASE 4: HARDENING AND PRODUCTION
Step 10 โ€” Security Hardening
  • Implement authentication (OAuth 2.1 for remote, environment variables for STDIO)
  • Validate all inputs against JSON Schema before processing
  • Implement rate limiting
  • Add comprehensive audit logging
  • Review the principle of least privilege for all tool capabilities
Step 11 โ€” Performance Optimization
  • Add caching for frequently accessed resources
  • Implement connection pooling for database-backed tools
  • Add pagination for list operations that could return large datasets
  • Profile and optimize slow tool handlers
Step 12 โ€” Observability
  • Add structured logging with severity levels
  • Implement OpenTelemetry tracing for distributed debugging
  • Set up Prometheus metrics for tool call rates, latencies, and error rates
  • Build a Grafana dashboard for production monitoring
Step 13 โ€” Deployment
  • Containerize with Docker (include health check endpoints)
  • Deploy to Kubernetes or serverless (Cloudflare Workers, AWS Lambda)
  • Implement horizontal scaling and load balancing for high-traffic servers
  • Set up CI/CD pipeline with automated conformance testing

3.2 โ€” Reverse Engineering Method (Analyzing Existing Servers)

The reverse engineering approach is powerful for learning how production MCP servers are built by studying the official reference implementations.

Step 1 โ€” Study Official Reference Servers
  • Clone the official MCP servers repository from GitHub
  • Start with the simplest server: the Filesystem MCP server
  • Study every tool definition: how is the name chosen? How is the description written? What validation is done?
  • Map the code structure to the conceptual model you've learned
Step 2 โ€” Traffic Analysis
  • Install Claude Desktop and connect an official MCP server
  • Enable debug logging in Claude Desktop to capture all JSON-RPC messages
  • Have real conversations that trigger tool calls
  • Trace each conversation turn: what tools/list response was sent, what tools/call was made, what the result was
Step 3 โ€” Schema Extraction
  • Call tools/list on an official MCP server via MCP Inspector
  • Export the full JSON schema for each tool
  • Analyze: what makes a good tool schema? How are complex nested inputs handled?
  • Compare schemas across different servers to identify patterns
Step 4 โ€” Error Case Analysis
  • Deliberately send malformed requests to an MCP server
  • Observe how it handles: missing required fields, wrong types, out-of-range values, invalid URIs
  • Study the error codes and messages returned
  • Use this to improve your own server's error handling
Step 5 โ€” Performance Profiling
  • Use MCP Inspector's timing features to measure tool latency
  • Profile which operations in a reference server are most expensive
  • Identify caching opportunities by analyzing repeated identical requests
Step 6 โ€” Security Audit Approach
  • Review how each reference server handles authentication
  • Check what environment variables are required and how they're validated at startup
  • Trace the permission model: what can a caller do without authentication? What requires auth?
  • Study how the server prevents path traversal (filesystem server), SQL injection (database server), etc.

4. WORKING PRINCIPLES, ARCHITECTURE & HARDWARE REQUIREMENTS

4.1 โ€” How MCP Works End-to-End (Working Principle)

COMPLETE END-TO-END FLOW USER: "Search GitHub for open issues labeled 'bug' in my repo" โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ HOST APPLICATION (e.g., Claude Desktop) โ”‚ โ”‚ - Receives user message โ”‚ โ”‚ - Passes to LLM with conversation history โ”‚ โ”‚ - LLM decides it needs to use a tool โ”‚ โ”‚ - Host enforces user consent if required โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP CLIENT (inside Host) โ”‚ โ”‚ - Serializes tool call to JSON-RPC 2.0 message โ”‚ โ”‚ - Routes to the correct server connection โ”‚ โ”‚ - Sends: tools/call { name: "search_issues", โ”‚ โ”‚ args: { repo: "myrepo", label: "bug" } } โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ [STDIO or HTTP Transport] โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP SERVER (GitHub MCP Server) โ”‚ โ”‚ - Receives JSON-RPC request โ”‚ โ”‚ - Validates input against JSON Schema โ”‚ โ”‚ - Authenticates using GITHUB_TOKEN from environment โ”‚ โ”‚ - Calls GitHub REST API: GET /repos/{owner}/{repo}/issues โ”‚ โ”‚ - Filters results by label โ”‚ โ”‚ - Serializes results to MCP tool result format โ”‚ โ”‚ - Returns: { content: [{ type: "text", text: "..." }] } โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ [Response back through Transport] โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ HOST APPLICATION โ”‚ โ”‚ - Receives tool result โ”‚ โ”‚ - Adds result to LLM context window โ”‚ โ”‚ - LLM formulates response to user โ”‚ โ”‚ - User sees: "I found 7 open issues labeled 'bug'..." โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.2 โ€” Layered Architecture Model

FULL STACK ARCHITECTURE LAYERS โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ LAYER 7 โ€” USER INTERFACE LAYER โ”‚ โ”‚ Chat interfaces, IDE plugins, API consumers โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 6 โ€” HOST / LLM LAYER โ”‚ โ”‚ LLM inference, conversation management, consent UX โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 5 โ€” MCP CLIENT LAYER โ”‚ โ”‚ Session management, capability tracking, routing โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 4 โ€” PROTOCOL LAYER (JSON-RPC 2.0) โ”‚ โ”‚ Message framing, request/response matching, errors โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 3 โ€” TRANSPORT LAYER โ”‚ โ”‚ STDIO streams / Streamable HTTP / SSE / WebSocket โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 2 โ€” MCP SERVER LAYER โ”‚ โ”‚ Tool handlers, resource providers, prompt templates โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ LAYER 1 โ€” BACKEND / DATA LAYER โ”‚ โ”‚ Databases, filesystems, external APIs, cloud services โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.3 โ€” MCP Server Internal Architecture

INTERNAL MCP SERVER ARCHITECTURE โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP SERVER โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ TRANSPORT โ”‚ โ”‚ CORE SERVER โ”‚ โ”‚ โ”‚ โ”‚ HANDLER โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ - STDIO โ”‚โ”€โ”€โ–บโ”‚ โ”‚ Request โ”‚ โ”‚ Capability โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ - HTTP โ”‚ โ”‚ โ”‚ Router โ”‚ โ”‚ Registry โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ - SSE โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Handler โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Dispatch โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ–ผ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ PRIMITIVE HANDLERS โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Tools โ”‚ โ”‚Resources โ”‚ โ”‚ Prompts โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Handler โ”‚ โ”‚ Handler โ”‚ โ”‚ Handler โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ SECURITY & CROSS-CUTTING โ”‚ โ”‚ โ”‚ โ”‚ Auth | Rate Limiting | Validation | Audit Logging โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4.4 โ€” Hardware and Infrastructure Requirements

For Development (Local STDIO servers):
  • CPU: Any modern CPU (2+ cores recommended for running LLM host + MCP server simultaneously)
  • RAM: Minimum 8 GB (16 GB recommended when running local LLMs)
  • Storage: SSD recommended for fast file system tool operations
  • OS: macOS, Linux, or Windows (all supported)
  • Runtime: Python 3.10+ or Node.js 18+
For Production (Remote HTTP servers):
Single-instance baseline:
  • CPU: 2 vCPUs
  • RAM: 512 MB to 2 GB depending on in-memory caching requirements
  • Network: Low latency connection to backing data stores
  • Storage: Minimal (stateless servers store nothing locally)
Scaling reference points from the MCP best practices documentation:
  • Memory request: 256 MB minimum, 512 MB limit per container
  • CPU request: 0.25 cores minimum, 0.5 cores limit per container
  • Horizontal scaling: minimum 3 replicas for high availability
  • Rolling update strategy for zero-downtime deployments
Database-backed MCP Servers:
  • Connection pool: minimum 5, maximum 20 database connections per server instance
  • Caching: Redis instance with sufficient memory for your hot dataset
  • Consider read replicas for read-heavy resource servers
GPU Considerations:
  • MCP servers themselves do not require GPUs
  • If your MCP server exposes ML inference as a tool, the inference backend requires GPU
  • The MCP layer adds negligible overhead โ€” performance is dominated by the tool's backend

5. SECURITY: COMPREHENSIVE GUIDE

5.1 โ€” The Security Threat Landscape

A series of real-world security incidents involving MCP servers have been observed:

  • Asana's MCP implementation contained a bug resulting in data exposure across different customer instances
  • Microsoft 365 Copilot was vulnerable to hidden prompts that exfiltrated sensitive data (CVE-2025-32711)
  • The 'mcp-remote' package with over 437k downloads was susceptible to remote code execution (CVE-2025-6514)

Authentication mechanisms were absent from the early MCP specification, with OAuth support only added in March 2025. Research found over 1,800 MCP servers on the public internet without authentication enabled.

5.2 โ€” Attack Vectors to Defend Against

Prompt Injection via Tool Descriptions

When an MCP server is installed, its tool names and descriptions are automatically added to the agent's base prompt. This integration creates an attack vector: malicious instructions embedded in tool descriptions may be interpreted as legitimate usage directives.

Defense: Only install MCP servers from trusted sources. Review tool descriptions before connecting. Hosts should sanitize tool descriptions before including them in prompts.

Tool Poisoning / Rug Pull Attack

In September 2025, an unofficial Postmark MCP server with 1,500 weekly downloads was modified to add a BCC field to its send_email function, silently copying all emails to the attacker's address. Users running this MCP server began leaking email content without awareness.

Defense: Pin MCP server versions in configuration. Review changelog before updating. Use signed packages from trusted registries.

Over-Privileged Tools

MCP tools often possess ambient authority exceeding necessary privileges. Network isolation provides limited protection when an agent can communicate with multiple MCP servers, ultimately bridging network boundaries.

Defense: Scope each tool to the minimum required permissions. Use read-only database connections for resource servers. Scope filesystem servers to specific root directories.

DNS Rebinding Attacks
  • Attackers use DNS rebinding to trick a web page into communicating with a locally running MCP server
  • Defense: Validate Origin headers on all local HTTP MCP servers, bind to localhost only, implement CORS restrictions
Cross-Server Contamination
  • A compromised MCP server can attempt to inject instructions that affect the behavior of tools in other servers within the same host session
  • Defense: Hosts must implement strict isolation between server contexts; tool results from one server should not influence trust evaluation for another

5.3 โ€” Security Implementation Checklist

SECURITY LAYER ARCHITECTURE

AUTHENTICATION LAYER
  • OAuth 2.1 + PKCE for remote servers
  • Environment variable secrets for STDIO servers
  • API key validation in HTTP headers
  • Token rotation and expiration policies
AUTHORIZATION LAYER
  • Per-tool permission checks
  • User identity propagation through tool calls
  • Role-based access control on resources
  • Consent UI for sensitive tool operations
INPUT VALIDATION LAYER
  • JSON Schema validation on every tool call
  • Path traversal prevention for filesystem tools
  • SQL injection prevention for database tools
  • Maximum input size limits
TRANSPORT SECURITY LAYER
  • TLS for all remote connections
  • Origin header validation
  • Localhost-only binding for local development
  • Rate limiting per client/tool/time window
AUDIT AND MONITORING LAYER
  • Structured logs of every tool call and result
  • Anomaly detection on usage patterns
  • Real-time alerting on security policy violations
  • Immutable audit log storage

Fine-grained permission controls allow organizations to specify exactly what resources an AI system can access, what actions it can perform, and under what conditions these accesses are permitted. These controls can be based on user identity, AI system identity, request context, or complex policy rules that consider multiple factors.

6. CUTTING-EDGE DEVELOPMENTS

6.1 โ€” Latest Protocol Updates (2025 Spec โ€” v2025-11-25)

MCP's current spec release came out in November 2025. Over the past year MCP has moved well past its origins as a way to wire up local tools. It now runs in production at companies large and small, powers agent workflows, and is shaped by a growing community through Working Groups, Spec Enhancement Proposals (SEPs), and a formal governance process.

Major additions in the 2025 spec:
  • Streamable HTTP transport (replacing SSE as the primary HTTP method)
  • OAuth 2.1 + PKCE authorization framework (added March 2025)
  • Elicitation โ€” servers can request additional information from users mid-session
  • Server Instructions โ€” servers can provide LLMs with a "user manual" explaining how to use them optimally
  • MCP Bundle Format (.mcpb) โ€” portable packaging format for distributing local MCP servers

6.2 โ€” MCP Apps (UI in Conversations)

MCP Apps are now live as an official MCP extension. Tools can now return interactive UI components that render directly in the conversation: dashboards, forms, visualizations, and multi-step workflows. This is the first official MCP extension and is ready for production. Anthropic partnered with OpenAI and MCP-UI to create a shared open standard for providing affordances for developers to include UI components in MCP clients.

6.3 โ€” Multi-Agent MCP Architectures

MCP servers can themselves be MCP clients to other servers, enabling multi-agent pipelines:

  • Orchestrator agents that delegate specialized tasks to tool agents
  • Chains of MCP servers where output of one becomes input to the next
  • Parallel execution across multiple MCP servers simultaneously
  • Hierarchical agent trees with supervisor agents and worker agents
  • MCP as the communication backbone for autonomous agent swarms
MULTI-AGENT MCP ARCHITECTURE User Prompt โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Orchestrator โ”‚ (LLM-powered planner) โ”‚ Agent (Host) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ Delegates via MCP โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ–ผ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚Researchโ”‚ โ”‚ Code โ”‚ โ”‚ Data โ”‚ โ”‚ Agent โ”‚ โ”‚ Agent โ”‚ โ”‚ Agent โ”‚ โ”‚(MCP โ”‚ โ”‚(MCP โ”‚ โ”‚(MCP โ”‚ โ”‚Client) โ”‚ โ”‚Client) โ”‚ โ”‚Client) โ”‚ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ–ผ โ–ผ โ–ผ [Web MCP] [GitHub MCP] [DB MCP]

6.4 โ€” MCP Registry and Discovery

  • Official MCP server registry at registry.mcp.run โ€” allows servers to be discovered by name
  • Servers submit metadata: name, version, capabilities, trust level, required credentials
  • Clients can search the registry to discover servers for new use cases
  • Enables an "app store" model for AI capabilities

6.5 โ€” Emerging Patterns

Stateful Long-Running Tools
  • Tools that can pause and resume across turns
  • Progress notifications for multi-minute operations
  • Checkpoint and recovery for long-running agent tasks
MCP + RAG Integration
  • MCP resources as the retrieval layer for Retrieval-Augmented Generation
  • Hybrid retrieval: vector search + structured database + real-time API via unified MCP interface
  • Resources that return embedding-ready chunks of text
MCP for Edge AI
  • Lightweight MCP servers running on edge devices (phones, IoT sensors, embedded systems)
  • Local inference with MCP for privacy-preserving AI that never leaves the device
  • WASM-based MCP servers for browser-native deployment
MCP in Enterprise Workflows
  • Integration with enterprise software (SAP, Salesforce, ServiceNow) via MCP
  • MCP as middleware in enterprise service buses
  • Compliance-aware MCP proxies that enforce data residency rules

7. BUILD IDEAS: BEGINNER TO ADVANCED

๐ŸŸข BEGINNER LEVEL (Build confidence, master fundamentals)

Project 1 โ€” Echo Tool Server Beginner

Goal: Understand the full lifecycle from server startup to tool call

  • Single tool: echo that returns whatever text you send it
  • Transport: STDIO
  • Teaches: project setup, server initialization, basic tool definition, JSON Schema

Project 2 โ€” File Reader Server Beginner

Goal: Connect an AI to the local filesystem

  • Tools: read_file, list_directory
  • Roots: restrict to a specific directory
  • Teaches: resource URIs, input validation, path safety, error handling

Project 3 โ€” Weather API Server Beginner

Goal: Wrap an external HTTP API in an MCP tool

  • Tool: get_weather that calls OpenWeatherMap API
  • Teaches: async HTTP calls, API key management via environment variables, result formatting

Project 4 โ€” Calculator / Math Tool Server Beginner

Goal: Implement tools with pure computational logic

  • Tools: calculate, convert_units, solve_equation
  • Teaches: JSON Schema parameter types, complex input structures, return value formatting

Project 5 โ€” Note Taking Server Beginner

Goal: CRUD operations via MCP

  • Tools: create_note, read_note, list_notes, delete_note
  • Resources: expose all notes as MCP resources
  • Storage: simple JSON file
  • Teaches: CRUD operations via MCP, resource exposure alongside tools, state persistence

๐ŸŸก INTERMEDIATE LEVEL (Build real utility, learn integration patterns)

Project 6 โ€” GitHub Integration Server Intermediate

  • Tools: search_repos, list_issues, create_issue, get_file_content, list_pull_requests
  • Resources: repos and issues as readable resources
  • Authentication: GitHub personal access token from environment
  • Teaches: OAuth token handling, pagination, nested data structures, rate limit handling

Project 7 โ€” SQLite / PostgreSQL Database Server Intermediate

  • Tools: query, insert, update, delete, list_tables, describe_table
  • Resources: expose table data as paginated resources
  • Security: read-only mode option, SQL injection prevention
  • Teaches: database connection pooling, query parameterization, schema introspection

Project 8 โ€” Slack Integration Server Intermediate

  • Tools: send_message, list_channels, search_messages, create_channel
  • Resources: recent messages as readable resources
  • Teaches: OAuth flow integration, Slack API rate limits, message formatting

Project 9 โ€” Local Code Execution Server Intermediate

  • Tools: run_python, run_javascript, run_bash
  • Security: subprocess sandboxing, timeout enforcement, output size limits
  • Teaches: subprocess management, security sandboxing, streaming output via SSE

Project 10 โ€” Semantic Search Server Intermediate

  • Tools: search_documents, index_document, find_similar
  • Resources: indexed document collection
  • Backend: ChromaDB or FAISS for vector storage
  • Teaches: vector embeddings integration, similarity search, async indexing

๐Ÿ”ด ADVANCED LEVEL (Production-grade, complex systems)

Project 11 โ€” Multi-Source Knowledge Aggregator Advanced

  • Aggregates from: internal wikis, Google Drive, Notion, GitHub, Confluence
  • Implements unified semantic search across all sources
  • Returns ranked, source-attributed results
  • Teaches: federated search, result ranking, source attribution, OAuth for multiple providers

Project 12 โ€” Production HTTP MCP Server with Auth Advanced

  • Full OAuth 2.1 + PKCE authorization server
  • Multi-tenant user isolation
  • Rate limiting, audit logging, metrics
  • Kubernetes deployment with horizontal pod autoscaling
  • Teaches: production deployment, OAuth server implementation, multi-tenancy

Project 13 โ€” AI-Powered Code Review Server Advanced

  • Integrates with GitHub webhooks
  • Tools: review_pull_request, check_code_style, suggest_improvements, run_tests
  • Uses sampling to call LLM for review logic within the server itself
  • Teaches: MCP sampling feature, webhook integration, agentic server patterns

Project 14 โ€” Real-Time Data Streaming Server Advanced

  • Resources that stream live data (stock prices, sensor readings, logs)
  • Implements resource subscriptions and change notifications
  • SSE-based streaming to clients
  • Teaches: resource subscription protocol, server-sent events, real-time data patterns

Project 15 โ€” Multi-Agent Orchestration Framework Advanced

  • Build an MCP server that itself spawns and manages other MCP server connections
  • Implements task decomposition, parallel execution, result aggregation
  • Full observability stack with distributed tracing across agent hops
  • Teaches: recursive MCP patterns, multi-agent coordination, distributed system design

Project 16 โ€” Enterprise MCP Gateway Advanced

  • A proxy server that sits between AI hosts and internal enterprise systems
  • Implements centralized authentication, authorization, audit logging
  • Policy engine for fine-grained access control (who can call which tool with what arguments)
  • Compliance logging for regulated industries
  • Teaches: gateway patterns, policy engines, enterprise security requirements

8. FULL TOPIC & SUBTOPIC REFERENCE MAP

MCP COMPLETE KNOWLEDGE TREE MCP โ”œโ”€โ”€ 1. FOUNDATIONS โ”‚ โ”œโ”€โ”€ 1.1 Protocol Concepts โ”‚ โ”‚ โ”œโ”€โ”€ What is a protocol โ”‚ โ”‚ โ”œโ”€โ”€ JSON-RPC 2.0 specification โ”‚ โ”‚ โ”œโ”€โ”€ Language Server Protocol (LSP) comparison โ”‚ โ”‚ โ””โ”€โ”€ Nร—M integration problem โ”‚ โ”œโ”€โ”€ 1.2 Prerequisites โ”‚ โ”‚ โ”œโ”€โ”€ Python 3.10+ / Node.js 18+ โ”‚ โ”‚ โ”œโ”€โ”€ Async programming โ”‚ โ”‚ โ”œโ”€โ”€ HTTP and REST fundamentals โ”‚ โ”‚ โ””โ”€โ”€ JSON and JSON Schema โ”‚ โ””โ”€โ”€ 1.3 Ecosystem โ”‚ โ”œโ”€โ”€ Official SDKs (Python, TypeScript, Java, C#, Kotlin) โ”‚ โ”œโ”€โ”€ Reference server implementations โ”‚ โ””โ”€โ”€ Supported host applications โ”œโ”€โ”€ 2. ARCHITECTURE โ”‚ โ”œโ”€โ”€ 2.1 Three-Role Model โ”‚ โ”‚ โ”œโ”€โ”€ Host (orchestrator + consent layer) โ”‚ โ”‚ โ”œโ”€โ”€ Client (1:1 protocol bridge) โ”‚ โ”‚ โ””โ”€โ”€ Server (capability provider) โ”‚ โ”œโ”€โ”€ 2.2 Core Primitives โ”‚ โ”‚ โ”œโ”€โ”€ Tools (executable, side-effecting) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Name and description โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Input JSON Schema โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Output content types โ”‚ โ”‚ โ”œโ”€โ”€ Resources (read-only context) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Static resources โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Resource templates (URI patterns) โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Resource subscriptions โ”‚ โ”‚ โ””โ”€โ”€ Prompts (reusable templates) โ”‚ โ”‚ โ”œโ”€โ”€ Argument definitions โ”‚ โ”‚ โ””โ”€โ”€ Message sequence templates โ”‚ โ””โ”€โ”€ 2.3 Supporting Features โ”‚ โ”œโ”€โ”€ Sampling (server โ†’ LLM calls) โ”‚ โ”œโ”€โ”€ Roots (filesystem boundaries) โ”‚ โ””โ”€โ”€ Capability Discovery โ”œโ”€โ”€ 3. PROTOCOL LAYER โ”‚ โ”œโ”€โ”€ 3.1 JSON-RPC 2.0 โ”‚ โ”‚ โ”œโ”€โ”€ Request format โ”‚ โ”‚ โ”œโ”€โ”€ Response format (success + error) โ”‚ โ”‚ โ””โ”€โ”€ Notification format โ”‚ โ”œโ”€โ”€ 3.2 Transport Mechanisms โ”‚ โ”‚ โ”œโ”€โ”€ STDIO (local subprocess) โ”‚ โ”‚ โ”œโ”€โ”€ Streamable HTTP (remote modern) โ”‚ โ”‚ โ”œโ”€โ”€ HTTP+SSE (legacy, deprecated) โ”‚ โ”‚ โ””โ”€โ”€ WebSocket (custom, full-duplex) โ”‚ โ”œโ”€โ”€ 3.3 Connection Lifecycle โ”‚ โ”‚ โ”œโ”€โ”€ Initialize handshake โ”‚ โ”‚ โ”œโ”€โ”€ Capability negotiation โ”‚ โ”‚ โ”œโ”€โ”€ Active session โ”‚ โ”‚ โ””โ”€โ”€ Graceful shutdown โ”‚ โ””โ”€โ”€ 3.4 Utilities โ”‚ โ”œโ”€โ”€ Ping / Heartbeat โ”‚ โ”œโ”€โ”€ Cancellation โ”‚ โ”œโ”€โ”€ Progress notifications โ”‚ โ”œโ”€โ”€ Logging levels โ”‚ โ”œโ”€โ”€ Pagination (cursor-based) โ”‚ โ””โ”€โ”€ Completion (autocomplete) โ”œโ”€โ”€ 4. DEVELOPMENT โ”‚ โ”œโ”€โ”€ 4.1 Server Development โ”‚ โ”‚ โ”œโ”€โ”€ SDK installation and setup โ”‚ โ”‚ โ”œโ”€โ”€ Server configuration โ”‚ โ”‚ โ”œโ”€โ”€ Tool implementation โ”‚ โ”‚ โ”œโ”€โ”€ Resource implementation โ”‚ โ”‚ โ”œโ”€โ”€ Prompt template implementation โ”‚ โ”‚ โ””โ”€โ”€ Error handling patterns โ”‚ โ”œโ”€โ”€ 4.2 Client Development โ”‚ โ”‚ โ”œโ”€โ”€ Connection management โ”‚ โ”‚ โ”œโ”€โ”€ Capability tracking โ”‚ โ”‚ โ”œโ”€โ”€ Tool invocation patterns โ”‚ โ”‚ โ””โ”€โ”€ Multi-server management โ”‚ โ””โ”€โ”€ 4.3 Testing โ”‚ โ”œโ”€โ”€ MCP Inspector usage โ”‚ โ”œโ”€โ”€ Unit testing handlers โ”‚ โ”œโ”€โ”€ Integration testing โ”‚ โ””โ”€โ”€ Conformance test suite โ”œโ”€โ”€ 5. SECURITY โ”‚ โ”œโ”€โ”€ 5.1 Authentication โ”‚ โ”‚ โ”œโ”€โ”€ OAuth 2.1 + PKCE โ”‚ โ”‚ โ”œโ”€โ”€ API key management โ”‚ โ”‚ โ””โ”€โ”€ Environment variable secrets โ”‚ โ”œโ”€โ”€ 5.2 Authorization โ”‚ โ”‚ โ”œโ”€โ”€ Per-tool permission checks โ”‚ โ”‚ โ”œโ”€โ”€ User consent flows โ”‚ โ”‚ โ””โ”€โ”€ Role-based access control โ”‚ โ”œโ”€โ”€ 5.3 Input Security โ”‚ โ”‚ โ”œโ”€โ”€ JSON Schema validation โ”‚ โ”‚ โ”œโ”€โ”€ Path traversal prevention โ”‚ โ”‚ โ”œโ”€โ”€ SQL injection prevention โ”‚ โ”‚ โ””โ”€โ”€ Input size limits โ”‚ โ”œโ”€โ”€ 5.4 Transport Security โ”‚ โ”‚ โ”œโ”€โ”€ TLS/HTTPS enforcement โ”‚ โ”‚ โ”œโ”€โ”€ Origin header validation โ”‚ โ”‚ โ””โ”€โ”€ DNS rebinding protection โ”‚ โ”œโ”€โ”€ 5.5 Threat Modeling โ”‚ โ”‚ โ”œโ”€โ”€ Prompt injection โ”‚ โ”‚ โ”œโ”€โ”€ Tool poisoning / rug pull โ”‚ โ”‚ โ”œโ”€โ”€ Over-privileged tools โ”‚ โ”‚ โ””โ”€โ”€ Cross-server contamination โ”‚ โ””โ”€โ”€ 5.6 Compliance โ”‚ โ”œโ”€โ”€ Audit logging โ”‚ โ”œโ”€โ”€ Data residency controls โ”‚ โ””โ”€โ”€ Regulatory requirements โ”œโ”€โ”€ 6. PRODUCTION OPERATIONS โ”‚ โ”œโ”€โ”€ 6.1 Deployment โ”‚ โ”‚ โ”œโ”€โ”€ Docker containerization โ”‚ โ”‚ โ”œโ”€โ”€ Kubernetes orchestration โ”‚ โ”‚ โ”œโ”€โ”€ Cloudflare Workers (serverless) โ”‚ โ”‚ โ””โ”€โ”€ CI/CD pipeline integration โ”‚ โ”œโ”€โ”€ 6.2 Performance โ”‚ โ”‚ โ”œโ”€โ”€ Connection pooling โ”‚ โ”‚ โ”œโ”€โ”€ Multi-level caching โ”‚ โ”‚ โ”œโ”€โ”€ Async I/O optimization โ”‚ โ”‚ โ””โ”€โ”€ Horizontal scaling โ”‚ โ””โ”€โ”€ 6.3 Observability โ”‚ โ”œโ”€โ”€ Structured logging โ”‚ โ”œโ”€โ”€ OpenTelemetry tracing โ”‚ โ”œโ”€โ”€ Prometheus metrics โ”‚ โ””โ”€โ”€ Grafana dashboards โ””โ”€โ”€ 7. ADVANCED TOPICS โ”œโ”€โ”€ 7.1 Multi-Agent Architectures โ”‚ โ”œโ”€โ”€ Agent orchestration via MCP โ”‚ โ”œโ”€โ”€ Recursive MCP (servers as clients) โ”‚ โ””โ”€โ”€ Parallel task execution โ”œโ”€โ”€ 7.2 Latest Features (2025 Spec) โ”‚ โ”œโ”€โ”€ Elicitation โ”‚ โ”œโ”€โ”€ Server Instructions โ”‚ โ”œโ”€โ”€ MCP Apps (interactive UI) โ”‚ โ””โ”€โ”€ MCP Bundle Format (.mcpb) โ”œโ”€โ”€ 7.3 Ecosystem Integration โ”‚ โ”œโ”€โ”€ MCP Registry โ”‚ โ”œโ”€โ”€ RAG + MCP hybrid โ”‚ โ””โ”€โ”€ Enterprise gateway patterns โ””โ”€โ”€ 7.4 Emerging Frontiers โ”œโ”€โ”€ Edge AI with MCP โ”œโ”€โ”€ WASM-based servers โ””โ”€โ”€ Autonomous agent frameworks

9. RECOMMENDED RESOURCES

Official Sources

SDKs and Reference Implementations

Community and Learning

Related Standards to Study

10. WEEKLY STUDY SCHEDULE

WEEK-BY-WEEK ROADMAP Week 1 โ”‚ Foundations: What is MCP, why it exists, Nร—M problem, LSP analogy Week 2 โ”‚ JSON-RPC 2.0 deep dive, async programming patterns, SDK install, echo server Week 3 โ”‚ Host/Client/Server model, Tool primitive, basic tool server with 2-3 tools Week 4 โ”‚ Resource primitive, resource URIs, file-reading server with resources exposed Week 5 โ”‚ Transport layers: STDIO in depth, Streamable HTTP, SSE, lifecycle & handshake Week 6 โ”‚ Prompt templates, capability discovery, sampling feature, roots concept Week 7 โ”‚ Security fundamentals: OAuth 2.1, input validation, prompt injection threats Week 8 โ”‚ Build intermediate project: GitHub or Database MCP server from scratch Week 9 โ”‚ Testing with MCP Inspector, unit tests, conformance tests, error handling Week 10 โ”‚ Production: Docker, env variables, structured logging, health checks Week 11 โ”‚ Observability: OpenTelemetry, Prometheus, Grafana, performance profiling Week 12 โ”‚ Advanced: multi-agent architectures, MCP Registry, MCP Apps, .mcpb format Week 13 โ”‚ Build advanced project: multi-source aggregator or enterprise gateway Week 14 โ”‚ Reverse engineering: study reference servers, contribute to open source

KEY MENTAL MODELS TO INTERNALIZE

  1. MCP is a protocol, not a library โ€” the spec defines behavior, SDKs implement it
  2. Think of tools as functions for the LLM, resources as the LLM's reading list, prompts as its instruction templates
  3. The LLM doesn't call tools โ€” the host does, based on the LLM's expressed intent
  4. Every tool is a potential security boundary โ€” treat it as such from day one
  5. Write tool descriptions for an LLM, not for a human โ€” the description IS the interface
  6. Prefer many small focused servers over one large monolithic server
  7. MCP reduces Nร—M integrations to N+M โ€” always remember this when designing architecture