Lesson 11 Why TypeScript for Production MCP
Theme:

Solutions — Lesson 11

Reference answers for Lesson 11's three homework tasks · ecosystem audit, cold-start measurement, migration trigger list

This is a no-code lesson, so the "solutions" are example findings and worked reasoning rather than runnable code. Your numbers and your trigger list will differ — what matters is that the shape of the answer matches and that you can defend each entry against the self-check criteria from the homework. Read the "common mistake" note after each solution; they capture the failure modes that tripped up reviewers of earlier drafts.

Solution to Task 1 — Ecosystem audit

Example findings table (these are illustrative — the homework expects your own findings from a current GitHub / registry sweep). The important property is the distribution across the three columns, not the specific server names.

| Server                       | Language    | Transport      | Deploy             |
|------------------------------|-------------|----------------|--------------------|
| filesystem-mcp (official)    | TypeScript  | stdio          | npx package        |
| github-mcp (hypothetical)    | TypeScript  | HTTP+SSE       | npx / Docker image |
| local-jupyter-mcp (research) | Python      | stdio          | pip install        |

Reading the row distribution:

Common mistake

Counting Claude-Desktop-bundled servers as "the ecosystem". The bundled set is a curated demo, not a representative sample. Look at third-party servers in the public MCP registry, on GitHub topic mcp-server, and on vendor blogs (Cloudflare, Vercel, Linear, GitHub, Sentry). That is where the real language and transport distribution shows up — and where the 2026 TS dominance becomes obvious.

Solution to Task 2 — Cold-start measurement

The two commands and their expected ranges on a modern laptop (M2 / Ryzen 7000 class, SSD, no power-save throttling):

# Python cold import — loads mcp, Pydantic, anyio, the PKB modules:
$ time python -c "import pkb.server"
real    0m0.742s
user    0m0.621s
sys     0m0.094s

# Node cold import — loads the MCP SDK entry point only:
$ time node -e "import('@modelcontextprotocol/sdk/server/index.js').then(()=>{})"
real    0m0.187s
user    0m0.158s
sys     0m0.041s

Reading these numbers:

Common mistake

Measuring mcp dev startup instead of the bare import. The Inspector spins up a browser-facing WebSocket server and a separate inspector process before your server is reachable — that overhead (several hundred ms on its own) dwarfs the language-level import cost and invalidates the comparison. Use the bare python -c "import ..." / node -e "import(...)" form. If you really want to compare server-ready latency, instrument the entry point itself, not the Inspector tooling around it.

Solution to Task 3 — Migration trigger list

A worked example. Yours should be shorter, more personal, and unambiguously about your server — not a generic "TypeScript good, Python bad" essay. Each bullet should name a concrete event a future you could recognise.

Part A — Triggers toward TypeScript

# When I would port my PKB to TS

1. The first non-self user connects from a different machine.
2. I want zero-config TLS in front of the server (Caddy or Cloudflare).
3. I want sub-200 ms cold-start so I can scale-from-zero on Workers / Fly.
4. I want to deploy to a managed JS runtime (Cloudflare Workers, Vercel
   Functions, Deno Deploy) where Python is a second-class citizen.
5. I want today's transport features (Streamable HTTP, resumable sessions)
   without waiting a quarter for the Python SDK to catch up.

Part B — Triggers back toward Python

# When I would stay (or move back) to Python

1. I add a tool that calls torch / transformers / numpy with custom
   kernels — subprocess overhead per call would kill latency.
2. The server's main consumer is a research notebook on the same machine
   (Jupyter, VS Code, Cursor on localhost). There is no "remote".
3. The team that will maintain it is a data-science team that does not
   write JavaScript and would never pass code review on the TS port.

Reading the lists:

Common mistake

Picking abstract triggers ("scalability!", "performance!", "modern stack!") instead of concrete ones tied to your actual project. Abstract triggers always sound good and never fire, because there's no measurable event behind them. The list is only useful if a future you can re-read it and immediately go "yes, that thing happened" or "no, still not relevant". Tie every bullet to either a specific deployment target, a specific user/team event, or a specific measurable threshold (latency, image size, user count).

What you learned

Lesson 12 starts where this lesson ends — you will replace the thrown Error in src/server.ts with a real echo tool wired through the TS SDK's Server and setRequestHandler API, with a Zod schema and a pino child logger. Same tool shape you built in Python; new wire format and new build pipeline around it.