gitmyhub

typescript-sdk

TypeScript ★ 13k updated 5h ago

The official TypeScript SDK for Model Context Protocol servers and clients

The official TypeScript SDK for building Model Context Protocol servers and clients, letting AI applications share tools, resources, and context with language models in a standardized way.

TypeScriptNode.jsBunDenoExpressHonosetup: moderatecomplexity 3/5

This repository contains the official TypeScript SDK for the Model Context Protocol, commonly abbreviated as MCP. MCP is a standard that lets AI applications pass context, tools, and resources to large language models in a consistent way. Rather than each AI app inventing its own approach for connecting external data or actions to a model, MCP defines a shared format so different pieces of software can work together predictably. This SDK implements that standard for developers writing TypeScript or JavaScript.

The SDK is split into two main packages. One is for building MCP servers, which are the pieces of software that expose tools, resources, or prompts to an AI model. The other is for building MCP clients, which are the applications that connect to those servers and use what they offer. Both packages run on Node.js, Bun, and Deno. There are also optional thin adapter packages for wiring MCP servers into popular web frameworks like Express or Hono, if you are already using one of those.

A simple MCP server created with this SDK registers named tools with defined input shapes, then listens for requests over a transport such as standard input/output or HTTP. The README includes a short working example of a greeting server to illustrate the pattern, as well as pointers to quickstart tutorials for building a weather server and an AI-powered chatbot client.

The main branch at this time contains version 2 of the SDK, which is still in pre-release development. Version 1 remains the recommended choice for production use and will continue receiving bug fixes for at least six months after version 2 reaches a stable release. Documentation for both versions is hosted separately, with the v1 source living on a dedicated branch.

The project is open to contributions via GitHub issues and pull requests. Existing code is licensed under MIT; new contributions fall under the Apache License 2.0.

Where it fits