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.txtpinsmcp==2.2.0,openai==3.16.2,pyjwt==2.14.0, andpytest==9.1.1;mcppulls inmcp-types,anyio,pydantic,starlette,uvicorn, andhttpx2.inline-snapshotis optional (the SDK's testing docs use it; our tests do not need it).PYTHONPATH=.lets every script dofrom notes_assistant.server import build_serverand lets the tests importexamples.m05_reindex_serverwithout installing the package. - Comes out:
mcp 2.2.0 | pytest 9.1.1. If you see a 1.x version ofmcp, an older pin is winning; recreate the virtual environment.