Homework
Lesson 03 · MCP Servers · Three short exercises to internalise the SDK landscape
The lab gave you an empty PKB server. The homework pushes you outward: run a reference server you didn't write, translate between the two SDK styles in your own code, and read someone else's server end-to-end. Each task should take 20–30 minutes. Capture your answers in a single writeup (markdown, doc, whatever) — Lesson 04 will reference back to this.
Task 1 — Run the reference mcp-server-everything
The everything server is the canonical “kitchen-sink” reference: it exposes a
deliberately varied set of tools, prompts, and resources designed to exercise every corner of the
protocol. Running it under Inspector is the fastest way to feel what a fully-populated MCP server
looks like — useful context before you start growing your own from zero.
Launch it under mcp dev via npx:
npx -y @modelcontextprotocol/server-everything
Then point Inspector at that stdio process (the easiest way is to run
npx @modelcontextprotocol/inspector npx -y @modelcontextprotocol/server-everything so
Inspector spawns the server itself). In the Inspector UI, open the Tools tab and read
through the list. Pick one that looks interesting — for example a math tool or one that returns a
formatted resource — and call it with sensible arguments. Note the JSON the server returns.
- You can list at least 10 tool names exposed by the server.
- You captured a screenshot (or copy of the Inspector output) of one successful tool call — arguments in, result out.
Task 2 — Side-by-side rewrite: low-level ↔ FastMCP
Slide 3 of the Lesson 03 deck shows the hello tool implemented in the low-level
Server style — explicit list_tools /call_tool
handlers, manual JSON schema, manual TextContent wrapping. Your job: rewrite the same
tool in FastMCP (the decorator-driven high-level wrapper) — or, if you prefer,
do it the other direction (start from the FastMCP version and write the low-level equivalent). Either
direction is fine; the point is to feel the difference.
Drop both versions into your writeup side by side — literally two code blocks next to each other,
or a two-column table. Then run each one separately through mcp dev and confirm both
show a tool named hello with the same input shape and output behaviour.
Skeleton to start from (FastMCP side):
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("hello-demo")
@mcp.tool()
def hello(name: str) -> str:
"""Say hello to NAME."""
return f"Hello, {name}!"
if __name__ == "__main__":
mcp.run()
- Both versions, when launched under Inspector, expose a tool named exactly
hellowith one string argumentname. - Calling
hello(name="world")on either server returns"Hello, world!"(or your chosen greeting — just keep it identical between the two).
Task 3 — Read one reference server end-to-end
Pick one of the official Python reference servers from
modelcontextprotocol/servers
— either fetch (HTTP requests) or
sqlite (local database queries). Find its server.py (or
whatever the equivalent entry point is — check pyproject.toml for the
[project.scripts] table if you're not sure) and read it top to bottom.
In exactly ~100 words, write a short writeup covering:
- What tools the server exposes (name them).
- What each tool does, in one sentence.
- One design choice in the source that surprised you — an idiom, an abstraction, a defensive check, anything you wouldn't have written yourself the first time.
- The 100-word writeup names at least one tool verbatim — the exact string as it appears in the source (e.g.
fetch,read_query, etc., copy-pasted not paraphrased). - The “surprised me” sentence points at a concrete line or symbol in the source, not a vague impression.
pkb/server.py. Keep your venv active.