Build a Real MCP Server
Thirteen lessons. End up with a production-shaped MCP server you understand top to bottom.
What you'll build
- 01 An MCP server with tools, resources, and prompts — the three primitives.
- 02 API-key + OAuth (PKCE) authentication, both layered on the same server.
- 03 An HTTP transport so the server runs over the wire, not just stdio.
- 04 A CDK deploy that puts the whole thing on AWS with persistent data.
13 lessons across 3 phases.
- 01 Setup lesson_setup
Get the workspace running. The first verify script you'll see — and pass.
- 02 Tracks lesson_tracks
Define an MCP tool with a typed schema. Watch your agent call it.
- 03 Schemas lesson_schemas
Tighten input validation with Zod. Why your agent's inputs matter more than you think.
- 04 Resources lesson_resources
Resources are how a server hands the agent files it can read. Implement one.
- 05 Prompts lesson_prompts
Server-side prompt templates. The least-used MCP primitive — and the most powerful.
- 06 Testing lesson_testing
Unit-test tool handlers without spinning up a real client. The shared test-client helper.
- 07 API keys lesson_api-keys
The simplest auth that ships. Hash, store, rotate.
- 08 OAuth lesson_oauth
Why MCP needs OAuth, why password is wrong, and how the dance actually works.
- 09 HTTP transport lesson_http
Move the server off stdio. Same handlers, new wiring.
- 10 PKCE lesson_pkce
Public clients, code verifiers, and the bit OAuth got right in the second draft.
- 11 AWS deploy I lesson_aws-deploy
Get your server live behind a real URL. Lambda + API Gateway via CDK.
- 12 AWS deploy II lesson_aws-data
DynamoDB for sessions and per-user state. Single-table for now; lessons learned later.
- 13 Shipping it lesson_shipping
Wire it all together. A real agent talking to a real server you deployed.
What you need before you start.
- Comfort with TypeScript
- You don't need to be fluent. You should be able to read a function signature without running away.
- Node.js 20+
- The repo is a pnpm-workspace monorepo. If you're set up for one Node project, you're set up for this.
- An AWS account (Phase C only)
- Free-tier is fine. You only need it for lessons 11–13. The first ten lessons run entirely locally.
- A coding agent that supports MCP
- Claude Code is what we test against. Cursor and Codex also work.
Two lines to start.
Run the first in your shell. Run the second from inside Claude Code, in plain English.
First time here?
You'll need the lwc CLI and the Claude Code plugin
installed once before the two lines below will work.
Full walkthrough →