Turning Point Academy · MCP Engineering

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

What you need

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.

  1. Build. Complete TODOs 1 to 7 in starter/server.py and starter/pyproject.toml:
  1. Connect. Run your server and add it to a host.
  2. Test. Run the self-check until every criterion you can reach shows Demonstrated.
  3. Secure. Review your server against the L14 checklist. The self-check covers only part of it.

The contract (what the self-check tests)

AreaRequirement
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)

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


Turning Point Academy · MCP Engineering course · Module 5 · Lesson 17 (L17) · V2, spec 2026-07-28