Your first MCP server
One server, six steps. Each step adds one thing and is a complete program you can run on its own.
Foundations6 lessons30 min
- 1Start the Server — and Write Nothing to stdoutFirst in the mcp_server course. No tools, no resources — just a server standing up. There is one thing to confirm here: does a client connect and get an answer to initialize. And one rule that has to be set now or it breaks later.5 min
- 2One Tool — the Description Matters More Than the CodeSecond in the mcp_server course. One tool gets registered. It is four pieces — name, description, input schema, handler — and three of them are read not by us but by whoever calls. So writing the description well is worth more than writing the handler well.5 min
- 3A Tool That Refuses — a Schema Is a Promise, Not a GuaranteeThird in the mcp_server course. An input schema goes on, and a handler that does not trust it. Including why "admit 0" and "admit 99" are refused for two different reasons.5 min
- 4The Screen as a Resource — a Document the Server Hands Out, Not CodeFourth in the mcp_server course. The server holds the screen as a file and hands it over. Edit the file and the next connection is different, with no rebuild and no reinstall — as long as it is read on every request.5 min
- 5It Survives the Process — by the Least Clever MethodFifth in the mcp_server course. A waiting count in a variable dies with the process. It gets written to a file — the whole file, every time. Slower than a partial update, and it never leaves a half-written record.5 min
- 6Say Only That It Changed — Why the Value Must Not Ride AlongLast in the mcp_server course. The screen stops asking every second. The server tells it, and the notification carries the uri and no value. And nothing at all goes to a client that did not subscribe.5 min