MCP TypeScript SDK
A toolkit for building Model Context Protocol servers and clients that provide standardized context for LLMs, allowing applications to expose resources, tools, and prompts through stdio or Streamable HTTP transports.
What is MCP TypeScript SDK?
MCP TypeScript SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to toolkit for building model context protocol servers and clients that provide standardized context for llms, allowing applications to expose resources, tools, and prompts through stdio or streamable ht...
A toolkit for building Model Context Protocol servers and clients that provide standardized context for LLMs, allowing applications to expose resources, tools, and prompts through stdio or Streamable HTTP transports.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A toolkit for building Model Context Protocol servers and cl
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-typescript-sdkConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP TypeScript SDK
The MCP TypeScript SDK is the official reference implementation of the Model Context Protocol, enabling developers to build both MCP servers and clients in TypeScript. It provides all the building blocks needed to expose resources, tools, and prompts to LLM applications through standardized stdio or Streamable HTTP transports. Whether you are creating a new MCP server that surfaces data and actions to AI assistants or writing a client that consumes MCP services, this SDK handles protocol compliance, message routing, and lifecycle management so you can focus on your application logic.
Prerequisites
- Node.js 18 or later installed
- npm, yarn, or pnpm package manager
- Basic TypeScript knowledge
- An MCP-compatible client such as Claude Desktop or Claude Code to test your server
Install the SDK
Add the official MCP TypeScript SDK package to your project using your preferred package manager.
npm install @modelcontextprotocol/sdkCreate an MCP server instance
Import McpServer and create a named server instance. The name and version are sent to clients during the MCP handshake.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({
name: "my-server",
version: "1.0.0"
});Register tools
Use server.registerTool() to expose callable functions to AI assistants. Each tool has a name, description, typed input schema (via Zod), and an async handler that returns content.
server.registerTool(
"add",
{
title: "Addition Tool",
description: "Add two numbers",
inputSchema: { a: z.number(), b: z.number() }
},
async ({ a, b }) => ({
content: [{ type: "text", text: String(a + b) }]
})
);Register resources
Expose data to LLMs through resources. Static resources serve fixed URIs; ResourceTemplate enables dynamic URIs with named parameters.
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
server.registerResource(
"greeting",
new ResourceTemplate("greeting://{name}", { list: undefined }),
{ title: "Greeting Resource", description: "Dynamic greeting" },
async (uri, { name }) => ({
contents: [{ uri: uri.href, text: `Hello, ${name}!` }]
})
);Connect a transport and start the server
For local stdio usage (Claude Desktop, Claude Code), use StdioServerTransport. For HTTP deployments, use the Streamable HTTP transport. Call server.connect() to begin handling messages.
const transport = new StdioServerTransport();
await server.connect(transport);Configure your MCP client
Add the compiled server to your MCP client configuration. Build your TypeScript project first with tsc or a bundler, then point the client at the output JS file.
MCP TypeScript SDK Examples
Client configuration
Claude Desktop config referencing a compiled MCP server built with the TypeScript SDK. Replace the path with the actual output location of your compiled index.js.
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"]
}
}
}Prompts to try
Once your server is connected to an MCP client, try asking your AI assistant to use the tools and resources you registered.
- "Use the add tool to calculate 142 plus 858"
- "Read the greeting resource for the name Alice"
- "List all available tools on the connected MCP server"
- "What resources does this server expose?"Troubleshooting MCP TypeScript SDK
Server exits immediately with no output
Make sure you await server.connect(transport) and that the entry point file is being run with Node.js 18+. For stdio transport the process must stay alive; avoid process.exit() or unhandled promise rejections.
Client reports 'tool not found' even though you registered it
Ensure registerTool() is called before server.connect(). Tools registered after connect() may not appear in the initial capability negotiation with some clients.
TypeScript compilation errors with Zod schemas in inputSchema
The SDK expects plain Zod schemas, not z.object() wrappers, for the inputSchema field. Pass { fieldName: z.type() } directly rather than wrapping in z.object().
Frequently Asked Questions about MCP TypeScript SDK
What is MCP TypeScript SDK?
MCP TypeScript SDK is a Model Context Protocol (MCP) server that toolkit for building model context protocol servers and clients that provide standardized context for llms, allowing applications to expose resources, tools, and prompts through stdio or streamable http transports. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP TypeScript SDK?
Follow the installation instructions on the MCP TypeScript SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP TypeScript SDK?
MCP TypeScript SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP TypeScript SDK free to use?
Yes, MCP TypeScript SDK is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MCP TypeScript SDK Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP TypeScript SDK? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP TypeScript SDK in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP TypeScript SDK?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.