MCP TypeScript SDK

RAG & Memory 💻 TypeScript ⚖️ Other 🟢 Actively maintained
13.3k stars

The MCP TypeScript SDK is the official TypeScript implementation of the Model Context Protocol (MCP), enabling applications to provide context to LLMs in a standardized way. It provides server and client libraries for building MCP servers and clients, running on Node.js, Bun, and Deno. This SDK is for developers who want to integrate MCP into their applications or build MCP-compatible tools.

✨ Key features

  • Server libraries for tools, resources, prompts, and auth
  • Client libraries with transports and high-level helpers
  • Supports Streamable HTTP and stdio transports
  • Optional middleware for Express, Fastify, Hono, Node.js
  • Schema validation via Standard Schema (Zod, Valibot, etc.)
  • Runnable examples included in the repository

🎯 Use cases

  • Build an MCP server that exposes tools to LLM clients
  • Create an MCP client to connect and call tools on servers
  • Integrate MCP into web frameworks like Express or Fastify
  • Develop custom MCP servers for internal tools or data access

📦 Installation

🧰 Requirements: Requires Node.js, Bun, or Deno runtime. No API keys or accounts needed.

Server

npm install @modelcontextprotocol/server
or
bun add @modelcontextprotocol/server
or
deno add npm:@modelcontextprotocol/server

Client

npm install @modelcontextprotocol/client
or
bun add @modelcontextprotocol/client
or
deno add npm:@modelcontextprotocol/client

Optional middleware packages

Node.js HTTP (IncomingMessage/ServerResponse) Streamable HTTP transport:
npm install @modelcontextprotocol/node
Express integration:
npm install @modelcontextprotocol/express express
Fastify integration:
npm install @modelcontextprotocol/fastify fastify
Hono integration:
npm install @modelcontextprotocol/hono hono

🚀 Usage

import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';

const server = new McpServer({ name: 'greeting-server', version: '1.0.0' });

server.registerTool(
    'greet',
    {
        description: 'Greet someone by name',
        inputSchema: z.object({ name: z.string() })
    },
    async ({ name }) => ({
        content: [{ type: 'text', text: `Hello, ${name}!` }]
    })
);

async function main() {
    const transport = new StdioServerTransport();
    await server.connect(transport);
}

main();

⚠️ Good to know

This is the main branch for v2 of the SDK, which is the stable release line, but pull requests are limited to 1 per new contributor while v2 settles after the 2026-07-28 spec release.

❓ FAQ

What runtimes are supported?

The SDK runs on Node.js, Bun, and Deno.

What is the difference between the server and client packages?

The server package is for building MCP servers, while the client package is for building MCP clients that connect to servers.

Can I use Zod for schema validation?

Yes, the SDK uses Standard Schema, so you can bring Zod v4, Valibot, ArkType, or any compatible library.

Is there a v1 version available?

Yes, v1.x continues to receive bug fixes and security updates for at least 6 months after v2's release, with documentation at ts.sdk.modelcontextprotocol.io.

📊 Repository

Stars★ 13,330
Forks🍴 2,142
Open issues🐛 593
Last commit🕒 Sep 4, 2026
Created📅 Sep 2024
Language💻 TypeScript
License⚖️ Other

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.