modelcontextprotocol/typescript-sdk

The official TypeScript SDK for Model Context Protocol servers and clients

Model Context Protocol (MCP) TypeScript SDK – Quick Overview

What it is – A set of TypeScript libraries that let you build Model Context Protocol (MCP) servers and clients. MCP is a lightweight, language‑agnostic spec for feeding structured context (tools, resources, prompts, etc.) to large language models. The SDK implements the July 2026 spec and runs on Node.js, Bun, and Deno.

Key packages

  • @modelcontextprotocol/server – helpers for defining tools, resources, and exposing them over HTTP, stdio, or other transports.
  • @modelcontextprotocol/client – utilities for discovering a server’s capabilities and invoking its tools.
  • Optional middleware adapters (@modelcontextprotocol/express, fastify, hono, node) that make wiring MCP into popular web frameworks trivial.

How you use it

  1. Create a server – instantiate McpServer, register tools with Zod (or compatible) schemas, and attach a transport (e.g., StdioServerTransport).
  2. Create a client – use the client package to connect to the server, list available tools, and call them.
  3. Deploy – plug the server into any HTTP runtime via the thin middleware packages.

Why it matters – By separating context provision from the LLM call, MCP lets developers reuse the same tool definitions across different models, cloud providers, or on‑device runtimes. The SDK gives a ready‑made, type‑safe way to adopt the spec without rolling your own protocol handling.

Documentation & support – Full guides, API reference, and migration notes are hosted at https://ts.sdk.modelcontextprotocol.io/v2/. Issues can be opened on GitHub, and the project is Apache‑2.0 (new code) / MIT (legacy).


TL;DR

  • Purpose: Build and consume MCP‑compliant services that supply structured context to LLMs.
  • Languages: TypeScript (Node, Bun, Deno).
  • Core libs: @modelcontextprotocol/server & @modelcontextprotocol/client.
  • Extras: Tiny adapters for Express, Fastify, Hono, plain Node HTTP.
  • Get started: npm i @modelcontextprotocol/server @modelcontextprotocol/client then follow the “first server/client” tutorials.

Related

  • Project
  • Project
  • Project
  • Project
  • Project