Topic 1: Module 5 at a glance
By the end of this module, you'll have:
- A packaged notes server:
notes_assistant/config.pyandnotes_assistant/server.py, replacing the prototypes from Modules 1 to 4, runnable withpython -m notes_assistant.serverover stdio or streamable HTTP. - A working map of what changed from MCP Python SDK v1 to v2 (
FastMCPtoMCPServer, snake_case fields,MCPError,Contextinjection,httpx2, transport options onrun()), each item checked against the installed SDK. - A long-running tool that reports progress with
ctx.report_progressand stops cleanly when the caller cancels, with the realnotifications/progressandnotifications/cancelledmessages captured off the wire. - Error handling that gives the model messages it can act on and never leaks internals, with the exact text a client sees for each kind of failure.
- A pytest suite (unit tests for
NoteStore, in-memory client tests run against both protocol eras, progress and cancellation tests) plus the MCP Inspector for interactive debugging. - Measured numbers: about 6 ms per in-memory test cycle against about 1.2 s when each test spawns a stdio server, and a 22-test suite that takes about 1.5 s in memory and about 30 s over stdio.
Prerequisites: Modules 1 to 4 (roles, JSON-RPC, transports, tools, resources, prompts). Python 3.11, basic async/await, and pytest basics.
Where we are: In Modules 3 and 4 you grew the server as single-file prototypes (examples/m03_server.py, examples/m04_server.py) that converged on two tools (search_notes, create_note), a resource template (notes://{note_id}), a static resource (notes://index), and a prompt (summarise_topic). This module turns that prototype into a proper package with configuration, clean error handling, long-running work, and tests, so Module 6 can build a host on top of something solid.