CourseModel Context Protocol · Module 11: Capstone · part 75 of 83
Part 75 · Module 11: Capstone

Topic 2: The assembled repository

5 min read·22 Sept 2026

The final tree

A capstone is the project that proves you can combine everything, not just each piece on its own. For us that means one repository where the server, the host, security, tests, and documentation agree with each other. Here is the tree at the end of the course. Files marked "Module 11" are new in this module; everything else was presented in full earlier and is imported, not rewritten.

text
notes-assistant/
  README.md                       one-page quick start                          (Module 11)
  requirements.txt                mcp==2.2.0, openai==3.16.2, pyjwt==2.14.0, pytest==9.1.1
  pytest.ini                      pythonpath = . and testpaths = tests          (Module 11)
  .gitignore                      .venv, caches, .pins/, demo-notes/            (Module 11)
  docs/
    WHAT_BROKE.md                 what broke and how it was fixed               (Module 11)
  notes/                          8 sample notes: Nare's lab notebook
  notes_assistant/
    store.py                      NoteStore, business logic, no MCP             (Module 1)
    llm.py                        chat() for groq / gemini / ollama             (Module 1)
    config.py                     Settings from environment variables           (Module 5)
    server.py                     build_server(), main(); auth added            (Modules 5 and 7)
    host.py                       Host agent loop, approval; pinning added      (Modules 6 and 8)
    auth.py                       JWTTokenVerifier, mint_dev_token              (Module 7)
    pinning.py                    fingerprint, check_pins, diff_pins            (Module 8)
  examples/
    m01_*.py ... m10_*.py         one folder of scripts per earlier module
    m11_cli.py                    ask one question from the command line        (Module 11)
    m11_dev_token.py              print a development bearer token              (Module 11)
    m11_scripted_model.py         scripted stand-in model for tests             (Module 11)
    m11_eval_real.py              six-question evaluation against a real model  (Module 11)
    m11_validation.py             every validation message the model can see    (Module 11)
    m11_loop_limits.py            the two loop guards firing                    (Module 11)
    m11_measure.py                tool-definition size and transport latency    (Module 11)
    m11_print_breaks_stdio.py     reproduces the stdout bug from WHAT_BROKE     (Module 11)
    m11_lab.py                    the Module Lab scorecard                      (Module 11)
  tests/
    test_*.py                     unit and in-memory tests from Modules 5 to 10
    test_capstone.py              the capstone acceptance tests                 (Module 11)

Code explained

  • In simple words: a map of the finished project, with each file labelled by the module that introduced it.
  • What happens: the layout keeps three layers apart. store.py is plain Python that knows nothing about MCP. server.py turns it into an MCP server. host.py connects any MCP server to a model. Security (auth.py, pinning.py) sits beside the layer it protects: token checks belong to the server, pinning belongs to the host. The capstone adds entry points, tests, and documents, but no new library code.
  • Comes out: nothing to run. Compare it with find . -type f | sort in your copy; if a file is missing, the module that introduced it lists it in its Project Milestone.
The finished assistant. A CLI drives the host agent loop, which uses an LLM, a console approval prompt and a pin store, and reaches the notes server either as a stdio subprocess or over Streamable HTTP through a JWT verifier. The server exposes two tools, a resource template and a prompt over the note store, which reads the notes folder.
Everything the capstone assembles, in one picture.

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.