πŸ”Œ Learn MCP the school way

The Model Context Protocol β€” the standard plug between AI apps and the world β€” taught with a difference: the protocol is IN the repo. A real MCP server and a real host/client, ~200 lines of pure Python, zero dependencies. You read every byte that moves.

🀝 the handshake🧰 tools/resources/prompts πŸ”¬ real server codeπŸ”Œ real client code 🌍 5 use cases🎼 sequence diagrams

πŸ“– Part 1 β€” THE PROTOCOL (1–5)

  • the adapter drawer 🍝 β†’ the standard socket πŸ”Œ
  • rooms, sockets, instruments β€” who talks to whom
  • three shelves; three verbs and a handshake 🀝
  • stdio vs HTTP + the three trust rules 🚧

πŸ”§ Part 2 β€” BUILD & DEPLOY (6–8)

  • read a real server: 110 honest lines πŸ”¬
  • read a real host β€” where the power lives πŸ”Œ
  • 5 production-shaped use cases, drawn twice 🌍
  • --drive mode: YOU play the model 🧠
# the 60-second wow β€” the ENTIRE protocol, live:
git clone https://github.com/BaluRaut/learn-mcp-school.git && cd learn-mcp-school
python3 client/mini_client.py          # watch every JSON-RPC message
python3 client/mini_client.py --drive  # YOU pick the tool calls

πŸ—ΊοΈ The big picture β€” one diagram, both worlds

Click for the 4K version.

The big picture: the MCP protocol, then building servers and clients and deploying five real-world use cases

πŸŽ“ The 8 lessons

One git branch = one idea; branch 05 contains lessons 01–05. Deep-dive companion to the AI course's bonus lesson 13.

1

🍝 Why MCP

The adapter drawer (NΓ—M) β†’ the standard socket (N+M).lesson-01-why-mcpRead lesson β†’See the diagram β†—
2

🏫 Architecture

Room (host) Β· wall socket (client) Β· instrument (server).lesson-02-architectureRead lesson β†’See the diagram β†—
3

🧰 The three shelves

Tools, resources, prompts β€” model, app and user each decide one.lesson-03-primitivesRead lesson β†’See the diagram β†—
4

🀝 The wire

Three verbs and a handshake β€” the whole protocol, message by message.lesson-04-the-wireRead lesson β†’See the diagram β†—
5

🚧 Transports & trust

Direct plug vs extension cord β€” and the three rules of not getting burned.lesson-05-transports-securityRead lesson β†’See the diagram β†—
6

πŸ”¬ Build a server

110 honest lines: the wrapped thing, the shelf, the dispatcher, the plumbing.lesson-06-build-a-serverRead lesson β†’See the diagram β†—
7

πŸ”Œ Build a client

The side with the power β€” the model asks, the HOST does.lesson-07-build-a-clientRead lesson β†’See the diagram β†—
8

🌍 Real-world use cases

Coding, support, data, meetings, reports β€” with sequence diagrams.lesson-08-use-casesRead lesson β†’See the diagram β†—
🌍 The showcase: 5 real-world use cases β€” coding assistant, support desk, data analyst, meeting-prep butler, report robot β€” each with a numbered flow diagram AND a full sequence diagram.

πŸ“ The lesson diagrams β€” follow the numbers

Purple = the protocol, orange = build & deploy. Lessons 02, 04 and 07 are drawn as sequence diagrams β€” the natural language of protocols. Also on a standalone page.

1 🍝 Why MCP

The adapter drawer (NΓ—M) β†’ the standard socket (N+M).

🍝 before: NΓ—M adaptersIDEΓ—GitHub Β· chatbotΓ—GitHub Β·agentΓ—GitHub Β· every pair,hand-built, none reusable🏫 hosts - standard socketsIDE Β· chatbot Β· agentπŸ”¬ servers - standard plugsGitHub Β· files Β· your DB12πŸ”Œ N+Mwrite once,plug in everywhere3

Read full lesson 01 β†’

2 🏫 Architecture

Room (host) Β· wall socket (client) Β· instrument (server).

🧠 model🏫 hostπŸ”Œ clientπŸ”¬ serverthe model only ever ASKS Β· the host does Β· the server answers'I want lookup_grade(sita)' β€” in words1the host DECIDES β€” permission checks live here 🚧approved β†’ forward2tools/call over the socket3result4β†’ lands on the model's desk πŸ“„5

Read full lesson 02 β†’

3 🧰 The three shelves

Tools, resources, prompts β€” model, app and user each decide one.

🧰 TOOLSactions with inputs:lookup_grade Β· add_homeworkWHO decides: the MODEL(host permitting)πŸ“ RESOURCESreadable context:file:// Β· db://students/3AWHO decides: the APP(what goes on the desk)πŸ“œ PROMPTSsuggested recipes:/summarize-ticketWHO decides: the USER(menus, slash-commands)123three shelves, three deciders β€” say it twice and you know more MCP than most πŸ˜„

Read full lesson 03 β†’

4 🀝 The wire

Three verbs and a handshake β€” the whole protocol, message by message.

πŸ”Œ clientπŸ”¬ serverthree verbs and a handshake β€” run python3 client/mini_client.py and watch these exact linesinitialize {protocolVersion, clientInfo}1{protocolVersion, capabilities:{tools}, serverInfo}2notifications/initialized β€” no id, no reply3tools/list4{tools:[{name, description, inputSchema}…]}5tools/call {name:"lookup_grade", arguments:{student:"sita"}}6{content:[{type:"text", text:"Sita (3A) has grade A+."}]}7

Read full lesson 04 β†’

5 🚧 Transports & trust

Direct plug vs extension cord β€” and the three rules of not getting burned.

πŸ”Œ stdio - the direct plughost launches server as child process;JSON per line on stdin/stdout Β· local things1πŸ“‘ HTTP - the extension cordsame messages over HTTP + auth (OAuth);remote/shared things Β· team DB, SaaS2🚧 rule 1: a server =installed software withYOUR permissions🚧 rule 2: tool results maycarry prompt injection β€”treat as data, not commands🚧 rule 3: WRITES get ahuman gate β€” reads may flow,add_homework waits for a click3

Read full lesson 05 β†’

6 πŸ”¬ Build a server

110 honest lines: the wrapped thing, the shelf, the dispatcher, the plumbing.

1 πŸ—„οΈ the wrapped thingtoy DB here β€” YOUR Postgres/API in real life;MCP is just the plug on the front12 πŸ“‹ the shelf: TOOLSname Β· description (FOR THE MODEL!) Β·inputSchema β€” rich schemas steer behavior23 πŸ”€ run_tool() dispatcherplain Python if-ladder β€” unit-testable,no protocol in sight34 πŸ”§ main() plumbingline in β†’ JSON-RPC β†’ line out Β· flush=True!errors = polite isError content, never a crash4server/school_server.py β€” 110 lines, all four parts visible Β· the official SDKs automate exactly this

Read full lesson 06 β†’

7 πŸ”Œ Build a client

The side with the power β€” the model asks, the HOST does.

πŸ§‘ you (--drive)🏫 MiniHostπŸ”¬ school_serverclient/mini_client.py β€” swap the input() for a model API call and you have a real agent host"call lookup_grade {student: sita}"1⚑ the POWER moment: the host decides (real hosts: permission prompt here 🚧)tools/call {…, id:4}2{id:4, content:[…grade A+…]}3πŸ“„ lands on the desk4

Read full lesson 07 β†’

8 🌍 Real-world use cases

Coding, support, data, meetings, reports β€” with sequence diagrams.

πŸ™ coding assistantissue β†’ code β†’ tests β†’ PR(PR waits for your click 🚧)1🎧 support deskorders DB (read-only!) + docsβ†’ grounded answer + receipts2πŸ“Š data analystquery_db β†’ make_chartSELECT-only via scoped account3πŸ“… meeting-prep butlercalendar + CRM + email β€”3 servers, one desk (N+M!)4πŸ“ report robotread folder β†’ summarize β†’slack_post gated by a click 🚧5each drawn twice on the use-cases page: numbered flow + full sequence diagram β†’

Read full lesson 08 β†’

Start Lesson 01 β†’ 🌍 The 5 use cases πŸ“ All 8 lesson diagrams πŸ§ͺ Quiz πŸ—“οΈ Study plan 🧠 The AI course