typescript-sdk

The official TypeScript SDK for Model Context Protocol servers and clients

Visit WebsiteView on GitHub
12.0k
Stars
+1001
Stars/month
10
Releases (6m)

Overview

The official TypeScript SDK for implementing Model Context Protocol (MCP), which enables applications to provide standardized context to Large Language Models. MCP separates the concerns of providing context from actual LLM interactions, creating a cleaner architecture for AI applications. This SDK supports building both MCP servers (that provide tools, resources, and prompts) and clients (that consume them), running across Node.js, Bun, and Deno environments. It includes comprehensive libraries for authentication, transport protocols, and streamable HTTP connections. The SDK also provides optional middleware packages for popular frameworks like Express and Hono, making integration straightforward. With over 12,000 GitHub stars, it represents the standard implementation for MCP in the TypeScript ecosystem. Currently, v1.x is recommended for production use while v2 is in pre-alpha development with a stable release planned for Q1 2026.

Pros

  • + Official SDK with comprehensive server and client libraries supporting multiple runtimes (Node.js, Bun, Deno)
  • + Includes middleware packages for popular frameworks (Express, Hono) enabling easy integration
  • + Strong community adoption with 12,000+ GitHub stars and active development

Cons

  • - Version 2 is currently in pre-alpha development, making it unstable for production use
  • - Requires peer dependency on Zod v4 for schema validation, adding complexity to setup
  • - May be over-engineered for simple context provision scenarios that don't need full MCP protocol

Use Cases

Getting Started

1. Install the SDK with `npm install @modelcontextprotocol/server zod` for servers or `@modelcontextprotocol/client zod` for clients. 2. Import the library and create your first MCP server or client using the provided APIs and examples. 3. Test your implementation with the runnable examples provided in the repository's examples directory.