CourseModel Context Protocol · Module 5: Building Servers · part 29 of 83
Part 29 · Module 5: Building Servers

Topic 2: The Python SDK v2

17 min read·22 Sept 2026

Setting up the working copy

We start from the course repository. It already contains notes_assistant/store.py (the NoteStore from Module 1) and the eight sample notes Nare, Priya, and Tomas keep for their sleep and memory lab. This module adds config.py, server.py, the tests/ folder, and a handful of examples/m05_*.py scripts.

bash
cd notes-assistant
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt inline-snapshot
export PYTHONPATH=.
python -c "import importlib.metadata as m; print('mcp', m.version('mcp'), '| pytest', m.version('pytest'))"

Code explained

  • In simple words: create an isolated Python environment, install the pinned packages, and tell Python to import from the repository root.
  • What happens: requirements.txt pins mcp==2.2.0, openai==3.16.2, pyjwt==2.14.0, and pytest==9.1.1; mcp pulls in mcp-types, anyio, pydantic, starlette, uvicorn, and httpx2. inline-snapshot is optional (the SDK's testing docs use it; our tests do not need it). PYTHONPATH=. lets every script do from notes_assistant.server import build_server and lets the tests import examples.m05_reindex_server without installing the package.
  • Comes out: mcp 2.2.0 | pytest 9.1.1. If you see a 1.x version of mcp, an older pin is winning; recreate the virtual environment.

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.