MCP TypeScript SDK
The official TypeScript SDK for the Model Context Protocol, for building MCP servers and clients on Node.js, Bun and Deno. Version 2 targets the 2026-07-28 specification, ships split server and client packages, accepts Zod v4 schemas and adds thin adapters for Express, Fastify, Hono and Node HTTP.
13.5k
GitHub · Sept 2026
@modelcontextprotocol/server 2.1.0
npm · Sept 2026
GitHub repo
AI & Machine Learning
Model Context Protocol
A day for a first server
Intermediate
Free
What the SDK gives you
The MCP TypeScript SDK is the official way to build Model Context Protocol servers and clients in TypeScript. It runs on Node.js, Bun and Deno and ships server libraries for tools, resources and prompts, client libraries, OAuth helpers and runnable examples.
Version 2 publishes split packages:
@modelcontextprotocol/serverto build servers, withMcpServer,registerTooland a stdio transport at@modelcontextprotocol/server/stdio.@modelcontextprotocol/clientto build clients.- Optional middleware packages,
@modelcontextprotocol/node,/express,/fastifyand/hono, that wire Streamable HTTP into a web framework, including Host header validation.
Tool and prompt schemas use Standard Schema, so you can bring Zod v4 (the README imports zod/v4), Valibot or ArkType. A minimal server registers a greet tool with a description and an input schema, then connects a StdioServerTransport.
Version 1 or version 2?
Version 2 targets the 2026-07-28 specification, which removed the initialize handshake and protocol sessions. Older tutorials import from @modelcontextprotocol/sdk, the version 1 package, which still receives fixes on a long-lived branch with its own documentation. For new servers, start on version 2 and use the migration guide on the documentation site if you are upgrading.
Is it worth it?
If you ship web products in TypeScript and want your service usable from any MCP host, yes. The SDK takes care of the protocol while you write ordinary async handlers, and the framework adapters make it easy to add an MCP endpoint to an existing Express or Hono app.
Prerequisites and time
Modern TypeScript, async and await, and basic Zod. The step-by-step tutorials in the repository, build your first server and build your first client, take an afternoon each. A remote server with OAuth is a larger project covered in the guides.
Free or paid?
Free and open source. New contributions are licensed under Apache 2.0, with existing code under MIT.
What you can do after it
Build and test an MCP server over stdio or Streamable HTTP, add it to an existing Node.js web app, write a client for integration tests, and read the protocol traffic in the MCP Inspector.
Common questions
Where are the full docs? The version 2 documentation site at ts.sdk.modelcontextprotocol.io/v2/ covers tools, resources, prompts, transports, clients, OAuth and migration, plus a troubleshooting page.
Which runtimes are supported? The README lists Node.js, Bun and Deno for both packages, with install commands for npm, bun and deno.
Ready to start?
Opens on Model Context Protocol in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.