My notes and code for Model Context Protocol (MCP).
Model Context Protocol — open standard by Anthropic for connecting AI apps to external tools & data.
USB-C for AI — one protocol, many integrations.
Without MCP → every AI app needs custom integration for each tool → M×N problem. With MCP → standard interface → M+N solution.
WITHOUT MCP: WITH MCP:
┌─────────┐ ┌─────────┐
│ Claude │──┐ │ Claude │──┐
│ ChatGPT │──┼── custom ──┐ │ ChatGPT │ ├── MCP ──┐
│ Cursor │──┘ APIs │ │ Cursor │──┘ │
└─────────┘ │ └─────────┘ │
↕ M×N connections │ ↕ M+N │
┌──────────┐ │ ┌──────────────┐ │
│ Slack │──────────────┘ │ MCP Server │───────┘
│ GitHub │ │ (Slack, │
│ Database │ │ GitHub, │
└──────────┘ │ DB, etc.) │
└──────────────┘
┌─────────────────────────────────────────────────┐
│ HOST (e.g. Claude Desktop) │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ MCP Client │ │ MCP Client │ ... │
│ └──────┬───────┘ └──────┬───────┘ │
└─────────┼───────────────────┼───────────────────┘
│ (transport) │ (transport)
┌─────▼──────┐ ┌────-▼──────┐
│ MCP Server │ │ MCP Server │
│ (local) │ │ (remote) │
└────────────┘ └────────────┘
| Component | Role |
|---|---|
| Host | AI app that wants to use external tools/data |
| Client | Lives inside host, 1:1 connection to a server |
| Server | Exposes tools, resources, prompts via MCP |
| Transport | How client ↔ server talk (stdio, HTTP+SSE) |
| Primitive | What it does | Think of it as |
|---|---|---|
| 🔧 Tools | Functions AI can call | POST endpoints |
| 📄 Resources | Data AI can read | GET endpoints |
| 💬 Prompts | Templates AI can use | Reusable prompt snippets |
Tools = actions, Resources = data, Prompts = templates
| Folder | Concept |
|---|---|
hello-mcp-server/ |
First MCP server + tool |
tools/ |
Tools deep dive |
resources/ |
Resources |
prompts/ |
Prompt templates |
transport/ |
stdio vs SSE vs Streamable HTTP |
client/ |
MCP client |
real-world-server/ |
Full-featured server |
cd hello-mcp-server
uv run server.pyPython + mcp SDK + uv