Model Context Protocol (MCP)

One standard way to plug AI apps into tools and data, like USB for AI.

🟡 intermediate5 min readagents
Model Context Protocol, or MCP, is an open standard from Anthropic for connecting AI apps to tools and data. Without it, every app needs its own custom code for every service, like GitHub, a database or Slack. With MCP, each service is wrapped once as an MCP server that offers its data, actions and prompt templates in a standard way. Any MCP-aware app, such as Claude Desktop or a code editor, can then use any server. Think of it as a USB port for AI tools.

The N×M Integration Problem vs MCP Standard

  BEFORE MCP (Custom N × M Matrix):
  Claude Desktop ──► Custom Github Code ──► GitHub API
  VS Code Copilot──► Custom Github Code ──► GitHub API
  Custom Agent   ──► Custom Postgres Code ─► Postgres DB

  AFTER MCP (Universal Standard Interface):
  [ MCP CLIENTS ]                        [ MCP SERVERS ]
  - Claude Desktop ─────── (JSON-RPC) ──────► GitHub MCP Server ──► GitHub API
  - Cursor / VS Code ───── (Over stdio/SSE) ──► Postgres MCP Server ──► Postgres DB
  - Custom AI Agents ────────────────────────► Slack MCP Server ────► Slack API

Three Core MCP Primitives

                                    MCP PRIMITIVES
┌──────────────────────────┬──────────────────────────┬──────────────────────────┐
│  1. RESOURCES            │  2. TOOLS                │  3. PROMPTS              │
├──────────────────────────┼──────────────────────────┼──────────────────────────┤
│ Read-only data sources   │ Executable functions     │ Parameterized prompt     │
│ (File contents, database │ (API calls, SQL queries, │ templates exposed to the │
│ rows, API responses).    │ file operations).        │ client UI.               │
│ URI: `file:///log.txt`   │ Schema: JSON Schema      │ Args: `{"repo": "vllm"}` │
└──────────────────────────┴──────────────────────────┴──────────────────────────┘

Transport Architecture

  1. Local Process Transport (stdio): Client launches MCP Server sub-process locally, communicating via standard input/output streams. Ideal for Desktop apps and IDE extensions.
  2. Remote Network Transport (SSE): Client connects over HTTP using Server-Sent Events (SSE) for server-to-client streaming, and POST endpoints for client-to-server JSON-RPC requests.

Example MCP Tool Registration (Python SDK)

python
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("Database Explorer")

@mcp.tool()
def execute_sql_query(query: str) -> str:
    """Executes a read-only SQL query against the SQLite database."""
    # MCP automatically generates JSON Schema from docstrings & type hints!
    return db.execute(query).fetchall()

if __name__ == "__main__":
    mcp.run(transport="stdio")

Say this out loud

"Model Context Protocol (MCP) is Anthropic's open standard unifying how AI models connect to tools and data sources. MCP Servers expose Resources (data), Tools (functions), and Prompts (templates) over JSON-RPC 2.0 via stdio or SSE. MCP eliminates N×M custom API integrations, enabling any AI client to interact with any MCP server seamlessly."

Follow-ups to expect

Check yourself

Question 1 of 3

What core problem does the Model Context Protocol (MCP) solve for AI developers?

More in LLMs & GenAI

See all →
Pretraining → SFT → RLHF5 minFine-Tune vs RAG vs Prompt: Choosing5 minRetrieval-Augmented Generation5 min