MCP TypeScript SDK

The official TypeScript SDK for building Model Context Protocol servers and clients.

SDK
npm
v1.32.1
13,543 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 96
Maintenance 100
Community 76
Maturity 44
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 87
Code Quality 88
Innovation 85
Learning Curve 90

The MCP TypeScript SDK is the official, reference implementation of the Model Context Protocol (MCP) for Node.js, Bun, and Deno. It gives developers a single package for building both MCP servers that expose tools, resources, and prompts to LLM applications, and MCP clients that can connect to any compliant server over stdio or Streamable HTTP transports.

Under the hood the SDK layers a high-level McpServer/client API for common cases over a low-level Protocol/Server implementation for advanced control, all built on JSON-RPC 2.0 messaging with Zod-based schema validation. With tens of millions of weekly downloads, it is the reference implementation most MCP servers and clients in the wild are built on.

What You Get

  • A high-level McpServer class for registering tools, resources, and prompts with a few lines of code
  • A full-featured MCP client with support for stdio, Streamable HTTP, and legacy HTTP+SSE transports
  • Built-in OAuth 2.0 client and server auth helpers (via jose and pkce-challenge) for remote server authentication
  • Zod-based (v3 or v4) schema validation for tool inputs/outputs, resource templates, and prompt arguments
  • Experimental support for long-running tasks, sampling, and elicitation capabilities from the latest MCP spec

Common Use Cases

  • Exposing an internal API, database, or SaaS product as tools an LLM agent (e.g. Claude, an IDE assistant) can call
  • Building a remote MCP server that AI clients connect to over Streamable HTTP with OAuth-protected access
  • Writing an MCP client inside an agent framework or IDE plugin to discover and invoke tools from any compliant server
  • Bridging existing REST/GraphQL services into the MCP tool/resource/prompt model for LLM consumption

Under The Hood

Architecture — The SDK layers a high-level API over a low-level protocol core. src/shared/protocol.ts (~1700 lines) implements a Protocol base class handling JSON-RPC request/response correlation, progress notifications, cancellation, and an optional task-tracking layer (experimental/tasks) for long-running operations; both Client (src/client/index.ts) and Server (src/server/index.ts) extend it. On top of that, McpServer (src/server/mcp.ts, ~1550 lines) provides the ergonomic surface most users touch — registerTool/registerResource/registerPrompt — internally translating registrations into the low-level request handlers and delegating transport I/O to pluggable Transport implementations (stdio.ts, streamableHttp.ts, sse.ts, webStandardStreamableHttp.ts). This separation means advanced users can drop to the Server/Protocol layer for custom notification handling while most consumers never leave the McpServer façade.

Tech Stack — Pure TypeScript (Node >=18, also runs on Bun/Deno), built to dual ESM/CJS output via separate tsc passes (tsconfig.json/tsconfig.cjs.json) and type-checked with tsgo. Runtime dependencies are deliberately small and mostly server-transport related: express and hono route helpers, cors, express-rate-limit, eventsource/eventsource-parser for SSE, jose and pkce-challenge for OAuth, ajv/ajv-formats/json-schema-typed for JSON Schema handling, and zod-to-json-schema for converting Zod schemas to the wire format. zod (v3.25+ or v4) is a required peer dependency, with a compatibility shim (zod-compat.ts, zod-json-schema-compat.ts) so both major versions interoperate.

Code Quality — 48 *.test.ts files sit alongside ~87 source files, run through Vitest (npm test), plus a dedicated conformance test suite (test/conformance/) that runs generated server/client behavior against a spec baseline (conformance-baseline.yml) — an unusually rigorous check for a protocol SDK. Linting is ESLint + Prettier (npm run lint), typechecking is a separate tsgo --noEmit step, and a check script chains both. Errors are represented as typed McpError instances with protocol-defined ErrorCodes rather than thrown strings, and Zod’s safeParse/safeParseAsync are used throughout instead of exception-driven validation.

API Design — The two-tier design (low-level Server/Protocol vs. high-level McpServer) is deliberately reminiscent of how Express separates raw http handling from route sugar, and it pays off in a genuinely low-boilerplate quick start: a working tool-serving server is a handful of registerTool calls plus a transport connect(). Documentation is split into task-oriented guides (docs/server.md, docs/client.md) rather than pure API reference, and runnable examples under src/examples/ (stdio, Streamable HTTP, OAuth) are exercised as part of docs:examples — so the docs can’t silently drift from working code.

Used by 120 apps in this directory

TypeScript
96%
Apache 2.0

Next AI Draw.io

AI Design Tools · Design Tools · Developer Tools

36,155

Turn natural language into professional draw.io diagrams with AI, cloud icons, and an MCP server for your IDE.

View details
89
Repo Health
80
Technical
68
Dependency
Built with
TypeScript 96%
Updated today
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,512

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated today
TypeScript
64%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,233

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
62
Dependency
Built with
TypeScript 64%
Vue 31%
Updated today
TypeScript
59%
MIT

oh-my-claudecode

AI Agents

39,747

Multi-agent orchestration for Claude Code with zero learning curve — install as a plugin or npm CLI and coordinate parallel Claude Code agents through pre-built workflows instead of managing them by hand.

View details
84
Repo Health
70
Technical
73
Dependency
Built with
TypeScript 59%
JavaScript 40%
Updated 2 days ago
TypeScript
95%
MIT

OmniRoute

AI Agents

74,725

A free, open-source AI gateway connecting Claude Code, Codex, Cursor, Cline, and Copilot to 237 AI providers (90+ free) through one endpoint, with automatic fallback and token-compression to stretch free-tier limits further.

View details
86
Repo Health
70
Technical
70
Dependency
Built with
TypeScript 95%
Updated today
TypeScript
96%
Apache 2.0

OneUptime

Monitoring

7,719

The complete open-source observability platform that replaces PagerDuty, Datadog, Sentry, and StatusPage with a single self-hostable system.

View details
91
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 96%
Updated today
TypeScript
71%
Apache 2.0

open-design

Design Tools

100,256

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript 71%
HTML 22%
Updated today
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,485

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
79
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated today
TypeScript
90%
MIT

open-pencil

AI Design Tools · Design Tools

8,840

An open-source design editor that reads native Figma files, ships a built-in AI assistant with 100+ design tools, and offers real-time serverless collaboration — all without giving up your files.

View details
84
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 90%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers