CourseAgentic AI Engineer: The Complete Course · Module 4: Model Context Protocol · part 26 of 97
Part 26 · Module 4: Model Context Protocol

Lab: The returns desk served and used over MCP

37 min read·13 Oct 2026
Module 4 · Lab · About 75 minutes · Needs: the Module 3 lab's tools.py, and lessons 1, 2 and 3 (hosts, clients and servers; build_server, who and the in-memory Client; pinned definitions and the allow-list)

What you are building

RETURNS-DESK/ AFTER THIS LAB model Groq or Gemini mcp_client.py the host stdio mcp_server.py 8 tools, policy, prompt mcp_pins.json what Sam approved tools.py, data.py Dev's rules mcp_runs/ trail per request tests/ 5 tests, no key
The finished piece: your code (blue) on both sides of the protocol, the model (amber) only talking to the host, and pins and tests (green) guarding the joins.

This lab puts Lesson 2's server and Lesson 3's host-side pins into the returns-desk/ repository. returns_desk/mcp_server.py serves Module 3's eight tools, the policy resource and the work_request prompt, with identity from the launcher or a verified token. returns_desk/mcp_client.py starts it over stdio, offers the model only tools matching Sam's pins, and stops at 12 steps. Tests pin the rules; then a real model works Aisha's R-1001 and Mei's R-1007 from a terminal command. Everything at BrightCart is simulated.

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.