Capstone — Brief
MCP Engineering course · M5
The printable brief for lesson L17: build, connect, test and secure one working MCP integration. You complete a small server from a starter project, connect it to a host, run an automated self-check against it, and review it against the L14 security checklist.
What changed in V2: the earlier brief let you choose a domain and a stack ("Python (FastMCP) or TypeScript"), pointed at Spanish, unpinned skill packs, and used an unpinned Inspector. V2 uses one fixed, synthetic domain, the official Python SDK mcp==2.3.0 (spec 2026-07-28), exact pins and a lock file, transport protections in the base requirements, and an automated self-check.
How this capstone works
- You complete it on your own. There is no human evaluator; nobody grades or reviews your work.
- The self-check is a pytest suite that drives your server with the official MCP client and prints a status per rubric criterion. A full green run means the listed behaviours were observed on your machine in that run.
- It is a self-assessment, not an accredited or verified assessment of competence. It is not a certificate, and it does not judge code quality or your security reasoning.
What you need
- The L17 Lab files (ZIP) (
starter/,selfcheck/,RUBRIC.md,run.sh, recorded runs) and uv. - Python 3.12; the self-check environment pins
mcp2.3.0,httpx22.16.2,pytest9.2.0 inuv.lock. - Optional: an MCP host (for example Claude Code) for the connect step.
- The reference solution is a separate download ("Reference solution (ZIP)"). Open it only after a real attempt.
The brief
The domain is a synthetic greenhouse plant-care tracker. All data is invented and already sits in starter/server.py. Do not change it.
- Build. Complete TODOs 1 to 7 in
starter/server.pyandstarter/pyproject.toml:
- three tools:
list_plants(done for you as the worked example),get_plantandlog_watering; - the resource
garden://care-guide; - DNS-rebinding protection on (foreign
Origin→ 403, foreignHost→ 421), loopback binding only; - every dependency pinned with
==(includingmcp==2.3.0) and auv.lockcreated withuv lock.
- Connect. Run your server and add it to a host.
- Test. Run the self-check until every criterion you can reach shows Demonstrated.
- Secure. Review your server against the L14 checklist. The self-check covers only part of it.
The contract (what the self-check tests)
| Area | Requirement |
|---|---|
| Discovery (C1) | A 2026-07-28 client negotiates through server/discover; a legacy client (mode="legacy") still negotiates 2025-11-25. The SDK does both when you use MCPServer with Streamable HTTP. |
| Tools (C2) | Exactly three, each with a description and an outputSchema (return a pydantic model). list_plants(location?) with location one of north-bench, south-bench, propagation; get_plant(plant_id) with schema pattern ^PLT-\d{3}$; log_watering(plant_id, ml), both required, ml an integer from 10 to 2000 expressed in the schema. |
| Behaviour (C3) | Listing returns 4 plants; south-bench returns PLT-001 and PLT-003; get_plant("PLT-002") returns the fern; log_watering adds ml to watered_ml and returns the updated plant. |
| Errors (C4) | Unknown id → tool error containing "No plant"; invalid input rejected by the SDK's schema validation (message contains validation error); watering the dormant PLT-003 → tool error mentioning "dormant". Raise ToolError(...) so the client gets isError: true. |
| Annotations (C5) | list_plants and get_plant set read_only_hint=True; log_watering sets read_only_hint=False. |
| Resource (C6) | garden://care-guide is listed and readable. |
| Transport security (C7) | Binds 127.0.0.1 only (never 0.0.0.0) and does not answer on your LAN address; foreign Origin → 403, foreign Host → 421. |
| Supply chain (C8) | Every dependency pinned with ==, including mcp==2.3.0; uv.lock present; uv lock --check passes (may contact PyPI). |
The worked example (copy its pattern)
@mcp.tool(name="list_plants", title="List plants",
annotations=ToolAnnotations(read_only_hint=True, open_world_hint=False))
async def list_plants(
location: Annotated[Location | None, Field(description="Optional bench filter")] = None,
) -> PlantList:
"""List plants, optionally filtered by location."""
plants = [Plant(plant_id=pid, **p) for pid, p in PLANTS.items() if location is None or p["location"] == location]
return PlantList(plants=plants, count=len(plants))
The docstring becomes the description; Annotated[..., Field(...)] puts constraints in the input schema; a pydantic return type gives an outputSchema; annotations are untrusted hints that help a host decide when to ask the user.
Commands
./run.sh check # check starter/ (the untouched starter gives 14 failed, 4 passed)
./run.sh serve starter # run your server on http://127.0.0.1:8765/mcp (set CAPSTONE_PORT if busy)
Connect it to a host while it runs (host-specific; this changes the host's configuration, so remove it afterwards with claude mcp remove greenhouse):
claude mcp add --transport http greenhouse http://127.0.0.1:8765/mcp
If you use the Inspector instead, pin it (npx @modelcontextprotocol/inspector@2.16.0) and keep its defaults: 127.0.0.1 only, token on, no DANGEROUSLY_* variables.
Secrets and security (not machine-checked)
- No secrets in the repository, in a committed
.mcp.json, in client config JSON, in tool arguments, or on parameters markedx-mcp-header. Credentials come from environment variables;.envis in.gitignore. - Least privilege per tool; tool output treated as untrusted data; pinned versions you can reproduce.
- Do not edit
selfcheck/. A green run produced by changing the tests shows nothing.
Optional remote track: OAuth (outside the rubric)
Run the L13 lab (./run.sh verify → ALL CHECKS PASSED (49)), then apply to your server: AuthSettings(resource_server_url=..., validate_token_resource=True) (in mcp 2.3.0 the audience gate is off by default and only warns); a TokenVerifier checking signature, iss, aud and exp; RFC 9728 metadata and a 401 with resource_metadata; 403 insufficient_scope; PKCE S256 and the resource parameter on the client side; no token passthrough. A real deployment also needs TLS and a real authorization server.
Deliverable checklist
- [ ] All eight rubric rows read Demonstrated (or Not observed only where the lab explains why), and the run ends with
18 passed. - [ ] The last line before the count is
Self-assessment only: this is not an accredited assessment of competence. - [ ] I connected the server to a host and kept my own evidence (or recorded the step as Not observed).
- [ ] I reviewed the server against the L14 checklist.
- [ ]
starter/pyproject.tomlpinsmcp==2.3.0andstarter/uv.lockexists.
Turning Point Academy · MCP Engineering course · Module 5 · Lesson 17 (L17) · V2, spec 2026-07-28