Building an MCP Server — Python + TypeScript SDKs

Most MCP tutorials show only stdio hello-worlds. A real server exposes tools plus resources plus prompts, handles capability negotiation, emits structured errors, and works the same across SDKs. This lesson builds a notes server end-to-end: stdlib stdio transport, JSON-RPC dispatch, the three server primitives, and a pure-function style that drops into either the Python SDK's FastMCP or the TypeScript SDK when you graduate.

Build 1.3 hr Python (stdlib, stdio MCP server)

Prerequisites: Phase 13 · 06 (MCP fundamentals)

#Learning Objectives

  • Implement initialize, tools/list, tools/call, resources/list, resources/read, prompts/list, and prompts/get methods.
  • Write a dispatch loop that reads JSON-RPC messages from stdin and writes responses to stdout.
  • Emit structured error responses per the JSON-RPC 2.0 spec and MCP's additional codes.
  • Graduate a stdlib implementation to FastMCP (Python SDK) or the TypeScript SDK without rewriting tool logic.
Full Access lesson

Keep going. The rest of this lesson is one step away.

Unlock all 503 lessons, video, code, quizzes and every future update. Pay in your own currency with Paystack.

The text and code of this lesson are based on AI Engineering from Scratch by Rohit Ghumare, MIT licensed.