CourseModel Context Protocol: The Complete Course · Module 7: Authorization · part 50 of 77
Part 50 · Module 7: Authorization

Lesson 2: The authorization flow, from 401 to token

28 min read·13 Oct 2026
Module 7 · Lesson 2 · About 55 minutes · Needs: Lesson 1 of this module (the stand-in provider, auth.py, build_server with a token verifier, the 401 and discovery); Module 5 Lesson 1 (the packaged server). No model calls and no keys.

The situation

Monday 28 September 2026, week 4. Priya wants to search Nare's notes from her own computer. Lesson 1 locked the HTTP server: a request without a token gets 401 and a pointer to the server's discovery document. Priya's host has no token yet. Today you run, end to end, every step her host takes to get one: from that 401 to a token that works only at the notes server and carries only notes:read. The identity provider is a stand-in on 127.0.0.1:9000, run inside the notebook, so nothing leaves your machine. The running question is Priya's: search_notes(query="nap study participants").

MONDAY 28 SEPTEMBER: PRIYA CONNECTS FROM HER COMPUTER Priya's host no token yet notes server 127.0.0.1:8071 search_notes 401 + where to sign in stand-in provider 127.0.0.1:9000 token today: every step between the 401 and the answer
Priya's host (blue, your system) gets a 401 (red), signs her in at the stand-in provider (grey, background) on port 9000, and returns with a token (green) the notes server accepts.

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.