Lesson 11 Why TypeScript for Production MCP
Theme:
Lesson 11 · Slide 1

Lesson 11 — Why TypeScript for Production MCP

We learned MCP in Python. We ship it in TypeScript. Here is why — and where Python still wins.

MCP Servers Module 5

Lesson 11 · Slide 2

The Module-5 pivot

Where we are

Modules 1–4 built a 7-tool PKB in Python. It tests, it logs, it handles auth — but it ships as a single-tenant stdio process on your laptop.

This module

Module 5 productionizes the same shape in TypeScript: HTTP+SSE transport, Docker, multi-tenant isolation, hardening.

"Same protocol. Different deployment substrate."

Lesson 11 · Slide 3

The 2026 MCP ecosystem reality

Lesson 11 · Slide 4

Perf and deploy ergonomics

TS on Node 20+ has stable async I/O, a sub-200 ms cold start in a container, and a 50–80 MB base image with node:20-alpine. Python equivalents are 200–500 MB unless you Distroless+slim, and cold-start under gunicorn/uvicorn is heavier. For burst HTTP traffic with many short-lived MCP sessions, that matters.

Headline: TS Docker image: ~80 MB, ~150 ms cold. Python equivalent: ~250 MB, ~800 ms. (Orders of magnitude, not benchmarks.)

Lesson 11 · Slide 5

The TS SDK feature lead

Lesson 11 · Slide 6

When to stay in Python

Stay in Python when:

  • The server is personal (one user, your laptop).
  • The tools wrap scientific Python (NumPy, PyTorch, transformers) and porting them would mean re-implementing math.
  • The server is a prototype you want to throw away in a week.
  • Your audit / compliance shop only signs off on Python.

Don't rewrite a working personal Python server just because this lesson exists.

Lesson 11 · Slide 7

What we'll carry over from Python

Lesson 11 · Slide 8

What we'll add in TS-land

Lesson 11 · Slide 9

A pre-requisite check

Lesson 11 assumes:

  • You can read TypeScript (async, interface, import).
  • You know what a package.json is.
  • You've run npm install at least once.
  • You have Node 20+ and Docker installed locally.

If any of those is "no" — pause the course, run through 30 minutes of the Node.js docs, then come back. The TS lessons do not re-teach Node.

Lesson 11 · Slide 10

Project layout we're heading toward

sample-server/typescript/
  package.json
  tsconfig.json
  src/
    server.ts        # entry
    tools.ts         # PKB tool handlers
    schemas.ts       # Zod schemas
    logger.ts        # pino setup
  Dockerfile         # added in L13
  docker-compose.yml # added in L13
  Caddyfile          # added in L13
  RUNBOOK.md         # added in L15
Lesson 11 · Slide 11

The lesson 11 lab

This is a no-code lesson. The "lab" is:

Lesson 11 · Slide 12

Recap & what's next

Coming up: Lesson 12 — Port PKB's first tool to TypeScript with the official SDK, Zod schemas, and the tsx dev loop.
1 / ?