What You Will Build
The Model Context Protocol (MCP) is a way for an AI application to reach things it cannot do on its own: run a function you wrote, read a document you hold, or offer a user a prepared request. An application that speaks MCP is called a host; the program you write that offers the functions, documents and requests is a server; the host talks to each server through a client it keeps for that purpose (S05). The protocol itself is a set of JSON messages with agreed names and shapes, defined by a specification whose current revision is dated 2026-07-28 (S39).
In this course you build one server, step by step, for a fictional workshop that keeps parts in bins: bolts, nuts, washers and cables with quantities and reorder levels. The server starts as a few read-only functions and grows to a program that other people could install: it reads a database, reports progress, asks the user a question mid-call, runs over the network with access tokens, tells clients when its data changes, and ships as a command. Along the way you write the other side too: clients that call the server, a loop that drives tools from a scripted stand-in for a model, and a small host that reads a configuration file the way real hosts do. The course ends with a bounded challenge on a second dataset, a meeting-room booking system, using only what the lessons taught.
The diagram is the map. The eleven modules run in order because each depends on the one before it; the last module is optional and is the only one that needs an account.

The course journey. Every module builds on the server from the module before it.
Three Ways to Study Each Lesson
Every lesson has three views of the same material.
- Full Course is the lesson itself: the explanation, the exercise with every command and file, the expected output, what to do when it goes wrong, an independent task, and a separate section with the answers. Study this view first.
- Revision is a short restatement for the second pass: the idea, what maps to what, common mistakes and recall questions. It assumes you have done the exercise.
- Quick Reference is a page to keep open while you work: the code shapes, the tables of options and the error messages, with pointers back to the Full Course view for the explanations.
The three views agree with each other; if you find a difference, the Full Course view is the one the exercises were tested against.
What Is in the Core and What Is Not
No language model takes part in the core course. That is deliberate. MCP is a protocol between an application and a server, and every message, error and security boundary in it can be observed without a model: the SDK's own client, hand-written JSON lines and a scripted stand-in for a model show exactly what happens, the same way every time, on any laptop. What a real host adds is a model that decides which tool to call and what to pass; each lesson says where that decision would happen and what the host does with the server's reply. The host lesson gives the configuration entries for Claude Code, Claude Desktop and Visual Studio Code, so a learner who has one of them can connect the same server to it; nothing in the course depends on having one.
The core needs a computer with Python 3.12 to 3.15, two pinned libraries that the next lesson installs, a terminal and a text editor. There is no account, key, payment, cloud resource or download beyond those.
Where Files Go
The setup lesson creates one folder for the whole course:
~/mcp-practice/
.venv/ the course environment: Python and the libraries
data/inventory.db the generated parts database, shared by every lesson
course-environment/ one folder per exercise, named in each lesson
server-tour/
first-tools/
...
~ is your home folder: /Users/<name> on macOS, /home/<name> on
Linux and C:\Users\<name> on Windows, where PowerShell writes it as
$HOME. Each exercise works in its own folder under ~/mcp-practice/.
Lessons give every command for macOS and Linux first and then for Windows
PowerShell; where a command is identical, it appears once. Every file you
need is printed in full in the lesson with the words "Save this as", and
you save it in your editor under that exact name. Scripts that change data
work on their own copy of the database, never on the shared one.
The Two-Terminal Convention
From the transports module on, some lessons run a server in one terminal and talk to it from another. The lesson says which terminal each command belongs in, and a server started in a lesson is stopped in the same lesson with Ctrl+C before the cleanup step. If a later lesson's server refuses to start because its port is already taken, the setup lesson's diagnosis table shows how to find the process that still holds it. Until then, every exercise runs in one terminal.
Cleanup Rules
Each lesson ends with a reset and cleanup section. Rerunning an exercise
always starts from the same state, so you can repeat one safely. Cleanup
removes only that lesson's folder, after a command that shows what is about
to be removed; it never removes .venv or data, which the whole course
shares. Some folders are kept on purpose because a later lesson extends
the file in them; the lesson says so when that is the case. The final
lesson explains how to remove everything, including any entry the optional
module added to a host's configuration.
Safety Rules You Will Meet
Three rules recur, and it helps to know why before they appear.
- Standard output belongs to the protocol. A server that runs over
standard input and output speaks JSON on those streams, so a stray
printcorrupts the conversation. Lessons log to standard error and show what happens otherwise. - Development tokens are not credentials. The authorization lessons use course-written token strings held in a dictionary or an environment variable, labelled as development values. They prove the mechanism; a production server verifies tokens against an authorization server, as those lessons explain. No real secret, personal data or real organisation appears anywhere in the course, and none should appear in your files.
- Servers run only on your machine. HTTP servers in the course bind to
127.0.0.1, the address only your own computer can reach, and keep the SDK's protection against other hosts' names switched on. The course runs only servers you wrote; it does not install anyone else's.
How Checks Are Judged
Every exercise states what success looks like: the exact lines a script prints, a file that exists, or a count that matches. Compare your output with the lesson's; where output varies from machine to machine (a path, a timestamp, a version string in a log line), the lesson labels it illustrative and says which parts vary. The checks are for you: nobody grades them, and the course makes no claim that passing them certifies anything. If an exercise does not match, the "When It Goes Wrong" section of that lesson lists the likely causes in the order to try them.
Check Your Understanding
- You are in the lesson that builds the first tools. In which folder do its files belong, and which two folders must its cleanup leave alone?
- A lesson in the transports module says "start the server, then in the other terminal run the client". Which terminal runs the server, and when is it stopped?
- A lesson's expected output shows
[10/21/26 15:44:17] INFO ...and your line shows a different date. Is the exercise failing? - The authorization lesson has you put the string
dev-token-readerin a dictionary. Why is that not a credential, and what would make it one?
Answer and Reasoning
Understanding check
- In
~/mcp-practice/first-tools, the folder that lesson names. Cleanup leaves~/mcp-practice/.venvand~/mcp-practice/dataalone: the environment and the shared database serve every lesson. - The first terminal runs the server and stays busy while it runs; the second runs the client. The server is stopped with Ctrl+C in its own terminal before the lesson's cleanup step, in the same lesson that started it.
- No. The lesson labels log lines illustrative because the timestamp
varies; only the parts the lesson names as fixed (here the level
INFOand the message) need to match. - It is a course-written value that grants nothing outside the exercise's own server, which checks it against a dictionary on the same machine. It would become a credential if a real service issued it or accepted it, and then it would belong in that service's secret store, never in a file in a lesson.