typescript-sdk  by modelcontextprotocol

TypeScript SDK for Model Context Protocol servers and clients

Created 11 months ago
9,761 stars

Top 5.2% on SourcePulse

GitHubView on GitHub
Project Summary

This TypeScript SDK provides a comprehensive framework for building servers and clients that adhere to the Model Context Protocol (MCP). It enables developers to standardize how applications provide context, tools, and prompts to Large Language Models (LLMs), abstracting away LLM interaction details.

How It Works

The SDK implements the MCP specification, allowing developers to define Resources (data endpoints) and Tools (executable functions) that LLM applications can consume. It supports various communication transports, including stdio for command-line interfaces and Streamable HTTP for network-based interactions, with options for stateful session management or stateless request handling. The core McpServer class manages protocol compliance and message routing, while ResourceTemplate aids in defining dynamic resources.

Quick Start & Requirements

  • Install: npm install @modelcontextprotocol/sdk
  • Prerequisites: Node.js, npm/yarn.
  • Quickstart: The README provides a basic server example using stdio transport and zod for schema validation.

Highlighted Details

  • Supports defining static and dynamic resources with URI templating.
  • Enables creation of tools with input validation using zod.
  • Offers Prompt templates for structured LLM interactions.
  • Implements both stateful and stateless Streamable HTTP server transports.
  • Includes a ProxyOAuthServerProvider for integrating external OAuth providers.
  • Provides client-side and server-side compatibility layers for deprecated HTTP+SSE transport.

Maintenance & Community

Licensing & Compatibility

  • Licensed under the MIT License.
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

The README notes that the SSE transport is deprecated in favor of Streamable HTTP, recommending migration for existing SSE implementations.

Health Check
Last Commit

1 day ago

Responsiveness

1 week

Pull Requests (30d)
30
Issues (30d)
36
Star History
510 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.