MCP — Model Context Protocol
“A USB-C port for AI applications.”
What Is MCP
MCP (Model Context Protocol) is an open standard protocol for connecting AI applications to external systems. It was created by Anthropic, inspired by Microsoft’s Language Server Protocol (LSP), and is now managed by the Linux Foundation. MCP follows the same design philosophy as LSP: through a standardized protocol layer, it reduces the N x M integration problem to N + M. Official Specification: modelcontextprotocol.io Specification Repository: github.com/modelcontextprotocol/specification Current Protocol Version:2025-11-25
In Plain Terms: USB-C lets your phone connect to chargers, displays, and flash drives. MCP lets AI applications connect to databases, APIs, file systems, and all kinds of tools. One standard interface to connect everything.
Broad Ecosystem Support
MCP is supported by the following AI applications and development tools:| Platform | Role | Description |
|---|---|---|
| Claude (Anthropic) | AI Assistant | Native MCP connector support |
| ChatGPT (OpenAI) | AI Assistant | MCP server connection support |
| VS Code (Microsoft) | Development Tool | Copilot supports MCP servers |
| Cursor | Development Tool | Native MCP support |
| Claude Code | CLI Tool | Native MCP support |
MCP Architecture
Three Participants
MCP is a stateful protocol using a client-server architecture with three core participants:| Participant | Role | Examples |
|---|---|---|
| MCP Host | AI application that manages one or more MCP clients | Claude Desktop, VS Code, ChatGPT |
| MCP Client | Internal component of the Host, maintains a 1:1 connection with one Server | Automatically created within the Host |
| MCP Server | Provides tools, data, and prompts to clients | Services you develop |
Two-Layer Architecture
| Layer | Responsibility | Protocols and Technologies |
|---|---|---|
| Data Layer | Defines message structure and semantics (lifecycle, tools, resources, prompts, sampling, elicitation, logging) | JSON-RPC 2.0 |
| Transport Layer | Defines communication channels and authentication | stdio / Streamable HTTP / Custom transport |
Transport Methods
| Transport | Description | Use Case |
|---|---|---|
| stdio | Server runs as a child process, communicating via stdin/stdout with newline-delimited messages | Local process, zero network overhead |
| Streamable HTTP | Single MCP endpoint; POST sends requests, GET subscribes to SSE streams. Mcp-Session-Id header manages sessions | Remote servers with OAuth authentication support |
MCP Core Capabilities (Primitives)
Server-Side Primitives
1. Tools — Model-Controlled Executable functions that AI models autonomously decide when to invoke. Discovered viatools/list, executed via tools/call. Supports inputSchema for defining input parameters, and optional outputSchema for defining structured output.
resources/list, read via resources/read, with subscription support via resources/subscribe. Resources carry Annotations (audience, priority, lastModified, and other metadata).
3. Prompts — User-Controlled
Reusable interaction templates. Discovered via prompts/list, retrieved via prompts/get (with parameterized arguments).
Client-Side Primitives
| Primitive | Purpose | Method |
|---|---|---|
| Sampling | Server requests LLM inference from the Host | sampling/createMessage |
| Roots | Informs the Server of filesystem boundaries | roots/list (returns file:// URIs) |
| Elicitation | Server requests information from the user | elicitation/request |
Content Types
MCP supports five content types, all of which can carry Annotations:| Type | Description |
|---|---|
text | Text content |
image | Images (Base64 or URI) |
audio | Audio content |
resource_link | Resource link reference |
embedded_resource | Embedded resource |
MCP in Commerce Applications
| Scenario | Tools Provided by MCP Server | Effect |
|---|---|---|
| Product Search | search_products(query, category) | AI agents can search your product catalog |
| Inventory Query | check_inventory(sku) | AI agents can check real-time inventory |
| Order Status | get_order_status(order_id) | Customers can check order progress via AI |
| Return Processing | create_return(order_id, reason) | AI agents can initiate returns for customers |
| Price Inquiry | get_price(sku, quantity) | AI agents get real-time quotes (including volume discounts) |
| Trust Query | otr_verify(domain) | AI agents query merchant trust scores |
MCP Server Development Workflow
1. Define Tools
Determine which tools your MCP Server will expose. Each tool needs:- A name and description (the description directly influences the AI model’s selection decisions)
- Input parameter JSON Schema (
inputSchema) - Optional output Schema (
outputSchema, defining structured return format) - Execution logic
2. Choose an SDK
MCP provides multi-language SDKs:- TypeScript/JavaScript:
@modelcontextprotocol/sdk - Python:
mcp - Other languages: Implement via JSON-RPC 2.0 directly
3. Implement the Server
4. Deploy
- Local Server: Use stdio transport, runs on the user’s machine
- Remote Server: Use Streamable HTTP transport, deployed on your server
5. User Connection
Users add your Server connection information in MCP-enabled applications such as Claude, ChatGPT, or VS Code to start using it.Protocol Lifecycle
An MCP connection has three phases:Table of Contents
- MCP Core Concepts — Architecture details, participant roles, protocol lifecycle
- Data Layer Protocol — JSON-RPC 2.0 message format, capability negotiation
- Transport Layer — stdio vs Streamable HTTP, OAuth 2.1 authentication
- Building an MCP Server — Complete TypeScript/Python development guide
- Commerce MCP Server — MCP Server design patterns for e-commerce
- Resources and Prompts — Working with Resources and Prompts
- Security and Authentication — OAuth 2.1 integration, PKCE, permission management
- Testing and Debugging — MCP Inspector usage guide
- Deployment Guide — Local deployment vs remote deployment
- Case Studies — MCP Server implementations for different scenarios
AI Prompt: Build a Commerce MCP Server
MCP is an actively evolving protocol with ongoing specification updates. This book is based on the official documentation as of April 2026 (protocol version
2025-11-25). Always refer to the latest version at modelcontextprotocol.io.