MCP TypeScript SDK

MCP TypeScript SDK
Suited to web teams working with Node.js.
The official library for writing MCP servers and clients in TypeScript / Node.js.
Overview
The MCP TypeScript SDK is the official set of libraries for building MCP servers and clients in TypeScript. From v2, the SDK is split into separate packages: @modelcontextprotocol/server for building servers and @modelcontextprotocol/client for building clients, plus optional middleware packages for Node, Express, Fastify and Hono.
The main branch is currently v2, the stable release implementing the MCP 2026-07-28 specification. The SDK runs on Node.js, Bun and Deno; servers support stdio and Streamable HTTP, with authentication helpers. Schemas for tools and prompts use the Standard Schema spec, so you can choose Zod v4, Valibot or ArkType.
The v1.x branch (the @modelcontextprotocol/sdk package) continues to receive bug and security fixes for at least six months after the v2 release date, so existing projects have time to migrate.
Highlights
Clearly separated packages
server and client are independent packages; install only what you need.
Middleware for web frameworks
Ready-made integration packages for Node, Express, Fastify and Hono.
Multi-runtime
Supports Node.js, Bun and Deno.
Flexible schema library
Uses Standard Schema, compatible with Zod v4, Valibot and ArkType.
Authentication support
Includes server-side auth helpers and client-side OAuth.
Clear upgrade path
A guide for moving from v1 to v2; v1.x remains supported for a while.
What it's for
Add MCP to an existing backend
Businesses using Express or Hono attach an MCP server to their current API.
Expose web app data to AI
Let an AI assistant read orders and appointments from a system written in Node.js.
Build tools for the engineering team
Write a local stdio server so AI can help with operations on a project.
Be a client inside a product
Your application connects on its own to external MCP servers.
Run on edge or Deno
Deploy lightweight servers on modern runtimes.
How to use it
- 1
Install the server package
Install the server package with npm (or the equivalent bun add, deno add).
$npm install @modelcontextprotocol/server - 2
Install the client package if needed
Only install it when your application needs to connect to other MCP servers.
$npm install @modelcontextprotocol/client - 3
Choose middleware
If you use Express, install the integration package along with express.
$npm install @modelcontextprotocol/express express - 4
Write your first server
Follow the first-server guide in the repo's docs folder or the v2 documentation.
- 5
Upgrade from v1
Projects using @modelcontextprotocol/sdk should read the migration guide to v2.
Video guides
The Ultimate MCP Crash Course - Build From Scratch
Web Dev Simplified
Build your first MCP Server in TypeScript
Roy Derks
Build a Real-world MCP Server with One TypeScript File Full Tutorial
Nader Dabit
Real-world example
A spa services company in Hanoi has a booking system written in Node.js and Express. The developer installs @modelcontextprotocol/server with the Express middleware package, and creates a tool to look up free slots and a resource describing the service list. Receptionists use an AI assistant to check open time slots when customers phone in, instead of opening several screens.
Tips & notes
Use v2 for new projects
v2 is the stable branch on main and follows the latest specification.
Install only the packages you need
Splitting server, client and middleware keeps the application lean.
Standardize on one schema library
Pick one library such as Zod v4 for the whole project for easier maintenance.
Plan to leave v1
v1.x is guaranteed fixes for only a minimum of six months after the v2 release date.
FAQ
Can the old @modelcontextprotocol/sdk package still be used?
That is v1.x, which still receives bug and security fixes for at least six months after v2 launched.
Is Zod required?
No. The SDK uses Standard Schema, so Zod v4, Valibot or ArkType all work.
Does it run on Bun or Deno?
Yes, the README states support for Node.js, Bun and Deno.
What is the license?
New contributions are under the Apache License 2.0; existing code is under MIT.
Useful links
Want to apply this in your business?
2dm looks at your workflows, picks the right tools and sets them up with your team. The first call is free.
Same topic

Model Context Protocol
4.5
The official MCP documentation site, an open standard for connecting AI assistants to external data and tools.

MCP Servers
4.5
A repository of reference MCP servers and a list of community-built servers.

MCP specification
3.5
The full technical specification of the protocol: tools, resources, prompts and how clients and servers communicate.


