CourseModel Context Protocol: The Complete Course · Module 5: Building Servers · part 36 of 77
Part 36 · Module 5: Building Servers

Lesson 2: Structuring a server: layers, settings, checks and logs

24 min read·13 Oct 2026
Module 5 · Lesson 2 · About 45 minutes · Needs: Lesson 1 of this module (the package); Module 3 Lesson 3 (ToolError, leaks())

The situation

Monday 21 September 2026, week 3. Lesson 1 turned the notes server into the package notes_assistant/. This week it runs three ways: in memory in your tests, over stdio when Nare's desktop host starts it, and over HTTP on 127.0.0.1:8050. Nare's host gives it a command and a few environment variables, nothing else.

What lives where decides whether that works. This lesson traces one call, search_notes("nap study participants", limit=3), and one launch, through the package's parts, and fixes what breaks.

tests in memory Nare's host stdio, NOTES_DIR lab computers HTTP :8050 the same package notes_assistant/ only the environment differs
The running example: on 21 September one server (blue) starts three ways, in memory, over stdio and over HTTP, and only the environment differs.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.