Series 8 parts

Build an MCP Server in Python

An 8-part hands-on track that takes you from the raw MCP protocol to a tested, secured, deployed server that Claude and other agents can actually use.

This series builds one real MCP server, end to end. You start with the protocol itself so nothing feels like magic, then build tools, resources, and prompts with the official Python SDK, move the server from stdio to the web, lock it down, test it properly, and ship it where agents can find it. Every part has runnable code, interactive checkpoints, and a protocol walkthrough or live schema designer where seeing beats reading.

In this series

  1. 1 MCP From the Ground Up: Architecture, JSON-RPC, and Why It Won What MCP actually is before you write any code: hosts, clients, and servers, JSON-RPC on the wire, the initialize handshake, and the three primitives, with an interactive protocol walkthrough.
  2. 2 Your First MCP Server with FastMCP and uv Stand up a real MCP server with the official Python SDK: uv setup, FastMCP tools, how type hints become schemas, the Inspector loop, and connecting to Claude Code and Claude Desktop.
  3. 3 MCP Resources and Prompts: Giving Models Context, Not Just Actions Stop building everything as a tool. Add resources, resource templates, and prompts to your Python MCP server, with URI design guidance and a decision framework for choosing primitives.
  4. 4 MCP Tool Design Agents Get Right: Schemas, Errors, and Structured Output The craft that decides whether agents succeed with your server: choosable descriptions, constrained schemas, the isError contract, structured output, and honest tool annotations.
  5. 5 From stdio to the Web: Streamable HTTP and Mounting MCP in FastAPI Move your MCP server from stdio to the web: how Streamable HTTP sessions and SSE streams work, flipping the transport in FastMCP, and mounting the server inside a FastAPI app.
  6. 6 Securing MCP Servers: OAuth 2.1, Scopes, and Prompt Injection Defenses Lock down a remote MCP server: OAuth 2.1 resource server duties, audience-bound tokens, scope enforcement inside tools, and real defenses against prompt injection and tool poisoning.
  7. 7 Testing and Debugging MCP Servers: Inspector, pytest, and In-Memory Clients Make your MCP server provably correct: the Inspector as a debugging instrument, pytest suites with in-memory client sessions, schema snapshot tests, and the debugging playbook.
  8. 8 Shipping Your MCP Server: Docker, Deployment, and the MCP Registry The last mile: typed settings, a uv-based multi-stage Dockerfile, proxy rules that keep SSE alive, publishing to the MCP registry, semantic versioning, and connecting every client.