Lab 05. Tools and MCP as API contracts
Part 2 · Scheduled 6 Dec 2026 · 2-hour lab
Upcoming course outline. This class has not been recorded as studied.
Lab brief
Build an MCP server that exposes the class 4 retriever and one open REST API, with inbound token, read-only default and contract tests; add a minimal MCP client to the agent and connect the same server to a coding agent; audit the staff 'community' MCP server before connecting it.
What to build and measure
- Build: wrap an open REST API from its OpenAPI spec as an MCP server with an inbound token, read-only default and contract tests.
- Integrate: add a minimal MCP client to the class 3 agent over stdio; list tools and call one; connect the same server to a coding agent.
- Audit: inspect the staff 'community' MCP server before you connect it; find the injected tool description; cite file and line.
- Pass check: contract tests pass in CI; a bad token and a write call are refused; the audit cites the injection.
Why this class matters
- Industry: Students have shipped an MCP server with tests and connected a client to it, the exact task in current job ads.
- Academic: The audit exercise gives a labelled example of an injected tool for later security experiments (class 9).
- Elsewhere: Students can expose any team API to an agent in an afternoon and know when not to.
In-room pass check
Contract tests pass in CI; a bad token and a write call are refused; the agent and the coding agent both call the server; the audit cites the injected file and line.
Required materials
- Staff 'community' MCP server with a planted injection (ready by 22 Nov).
- An open REST API with an OpenAPI spec; the MCP Python SDK and MCP Inspector.
- The class 3 agent (part1-ref) to host the client.
These are materials the draft assigns to the course team. They are not bundled with these notes. See the course guide for the test-first verification log and the deliverables for part boundaries.
Results ledger
[Measurements, test output, run-record paths, and verification log]
Sources
- MCP Python SDK
- Google/Kaggle 2026, Day 2: Agent Tools & Interoperability