learn-typescript-mcp
A monorepo for learning the Model Context Protocol with TypeScript, featuring example MCP servers for weather data and tax calculation.
README
learn TypeScript MCP
Learning monorepo for the Model Context Protocol TypeScript SDK, built on Bun workspaces. Each learning topic lives in its own app under apps/ — new topics get a new apps/<topic> workspace.
| App | What it is |
|---|---|
| apps/weather/ | The MCP weather tutorial, restructured as a NestJS application (running on the Bun runtime) |
| apps/tax-assistant/ | A minimal plain-TypeScript stdio MCP server (VAT calculator) |
To install dependencies for all workspaces:
bun install
Weather app (apps/weather/) — NestJS + MCP
Follows the official MCP TypeScript SDK "Build your first server" / "Build your first client" tutorials, using the real NWS weather API — hosted inside a NestJS app.
- apps/weather/src/main.ts — Nest HTTP bootstrap (port 3000,
bodyParser: false) - apps/weather/src/stdio.ts — stdio entry point (Nest application context, logger disabled so stdout stays protocol-only)
- apps/weather/src/weather/weather.service.ts — NWS API calls (
getActiveAlertHeadlines,getForecastPeriods) - apps/weather/src/weather/weather-mcp.service.ts — builds the
McpServer, registersget-alerts/get-forecast, owns the shared HTTP transport - apps/weather/src/weather/mcp.controller.ts — routes every method on
/mcpinto the MCP transport - apps/weather/src/weather/express-web-bridge.ts — converts Express req/res ↔ web-standard Request/Response (the SDK's v2 transport is web-standard only)
- apps/weather/client.ts — example client (spawns the stdio server itself)
- apps/weather/test/mcp-http.test.ts —
bun testboots the Nest app on an ephemeral port and connects a real streamable-HTTP MCP client - tutorial/weather-server.ts — compatibility shim for clients still pointing at the old pre-monorepo path (e.g. a saved MCP Inspector connection); safe to delete once nothing references it
Both tools declare default values in their input schemas for development convenience — Inspector pre-fills its form with them (state: CA, latitude/longitude: San Francisco), so you can hit "Run Tool" without typing. Callers that pass their own arguments override them; the defaults only apply when an argument is omitted.
Run the stdio server
Each client that connects (Claude Code, Inspector, client.ts) spawns its own private copy of this process — it's not a shared server.
bun run weather:stdio
Run the HTTP server
One shared process that clients connect to over the network. Kill this terminal and every connected client loses the connection immediately.
bun run weather:http
Run the example client
bun run weather:client
Run the tests / typecheck
bun test # from apps/weather/ (or the repo root)
bun run typecheck # from the repo root — tsc over both apps
Tax assistant (apps/tax-assistant/)
Minimal stdio MCP server with a single calculate-vat tool (Thai VAT 7%):
bun run tax:stdio
Inspect/test with MCP Inspector
bunx @modelcontextprotocol/inspector
Opens a browser UI (proxy on port 6277, UI on port 6274). In the sidebar, connect it either way:
- stdio: Transport Type
STDIO, Commandbun, Argsapps/weather/src/stdio.ts - HTTP: Transport Type
Streamable HTTP, URLhttp://localhost:3000/mcp— requires the HTTP server (bun run weather:http) to already be running
Inspector remembers your last-used connection in the browser and auto-reconnects with it on load/refresh — always check the sidebar's Transport Type/URL before assuming what it's actually connected to.
If you get PORT IS IN USE on 6274/6277, a previous Inspector instance didn't shut down cleanly (it can leave its proxy process orphaned even after reporting failure). Find and kill it before retrying:
lsof -nP -iTCP:6274,6277 -sTCP:LISTEN
kill <PID>
Connect to Claude Code
.mcp.json registers the weather server, pointed at the HTTP transport — start the Nest server (bun run weather:http) yourself before opening a Claude Code session here, or /mcp will show it disconnected.
NestJS-on-Bun notes
- No
nest-cli/webpack build step — Bun runs the TypeScript entrypoints directly (bun src/main.ts). - tsconfig.json enables
experimentalDecorators+emitDecoratorMetadata; Bun's transpiler honors both, which is what makes Nest constructor injection work. - Nest still uses its Express adapter internally; only the runtime and package manager are Bun.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.