Lesson 11 Why TypeScript for Production MCP
Theme:

Lab 11 — Environment check and decision memo

Lesson 11 · MCP Servers · ~30 min, no code change

This lesson has no code change. The lab is three things, in order: (a) verify your Node and Docker environment so the next four lessons do not bounce off a missing tool, (b) trace the existing TypeScript skeleton that is already sitting in the repo so you know what L12 is going to extend, and (c) write a one-page decision memo answering the only question this lesson really cares about: would you port your PKB to TypeScript, or is the Python version good enough? Either answer is legitimate. The point is to have the argument with yourself in writing before you spend four lessons learning the TS path.

Prereqs

Step 1 — Verify Node and Docker

Run all four commands. The expected outputs are below each — exact version numbers will differ, but the major version must match.

node --version    # v20.x or v22.x
npm --version     # 10.x
docker --version  # Docker version 24+ or 25+
docker run --rm hello-world

The docker run --rm hello-world line is the critical one: it confirms the daemon is actually running and that your user can talk to it, not just that the CLI is installed. A common failure mode on Linux is "docker is installed but the daemon is stopped" — that produces a confusing Cannot connect to the Docker daemon error rather than command not found.

What to do if one of these fails:

Step 2 — Locate the TS skeleton

The TypeScript sample-server tree was committed back in Plan A as a stub. Find it and read each file.

cd mcp-servers/sample-server/typescript
ls

Expected output:

package.json
tsconfig.json
src/

Inside src/ you should see server.ts. Open all three files and trace what each is doing:

Step 3 — Install deps and confirm tsc + tsx work

From inside mcp-servers/sample-server/typescript/:

npm install
npm run build       # tsc -> dist/server.js (compiles cleanly even though main() throws)
npm run dev || true # tsx will print the thrown error; that's expected

What to look for:

Step 4 — Write your decision memo

This is the actual deliverable of the lab. One page, four headings, no more than ten minutes of writing. The memo is for you — don't commit it to the repo unless you specifically want to.

  1. My use-case. One paragraph. Who connects to this server, from where, and how often? "Only me, on my laptop, a few times an hour while drafting" is a complete answer. So is "30 internal users on the company VPN, several times a minute during business hours". The shape of this paragraph predicts the rest of the memo.
  2. Three reasons I would port to TypeScript. Three bullets. Draw from the slides and theory: smaller / faster container images, SDK transport-feature lead, Node-friendly edge runtimes (Workers, Vercel, Deno Deploy), JS-shop hiring pool. Pick the three that are true for your project, not the three that sound most impressive.
  3. Three reasons I would stay in Python. Three bullets. Same discipline: which Python-side wins actually apply to your situation? Personal-only use? A tool that calls torch or transformers? A compliance shop that only signs off on Python? A prototype with a one-week lifetime?
  4. My decision. One sentence. "I will port" or "I will stay" are both correct answers. The value of the memo is the forcing function, not the answer.

Step 5 — If you decided to stay in Python

Module 5 still has value for you, but you can skip most of the hands-on work:

Step 6 — If you decided to port

Confirm a few things before you start L12:

What you should leave with

Troubleshooting

Common stumbles