[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73446":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},73446,"typescript-sdk","modelcontextprotocol\u002Ftypescript-sdk","modelcontextprotocol","The official TypeScript SDK for Model Context Protocol servers and clients","https:\u002F\u002Fmodelcontextprotocol.io",null,"TypeScript",12642,1918,99,252,0,21,66,239,63,44.85,"Other",false,"main",true,[],"2026-06-12 02:03:13","# MCP TypeScript SDK\n\n> [!IMPORTANT] **This is the `main` branch which contains v2 of the SDK (currently in development, pre-alpha).**\n>\n> We anticipate a stable v2 release in Q1 2026. Until then, **v1.x remains the recommended version** for production use. v1.x will continue to receive bug fixes and security updates for at least 6 months after v2 ships to give people time to upgrade.\n>\n> For v1 documentation, see the [V1 API docs](https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002F). For v2 API docs, see [`\u002Fv2\u002F`](https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002Fv2\u002F).\n\n![NPM Version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F%40modelcontextprotocol%2Fserver) ![NPM Version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F%40modelcontextprotocol%2Fclient) ![MIT licensed](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fl\u002F%40modelcontextprotocol%2Fserver)\n\n\u003Cdetails>\n\u003Csummary>Table of Contents\u003C\u002Fsummary>\n\n- [Overview](#overview)\n- [Packages](#packages)\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n- [License](#license)\n\n\u003C\u002Fdetails>\n\n## Overview\n\nThe Model Context Protocol (MCP) allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction.\n\nThis repository contains the TypeScript SDK implementation of the MCP specification. It runs on **Node.js**, **Bun**, and **Deno**, and ships:\n\n- MCP **server** libraries (tools\u002Fresources\u002Fprompts, Streamable HTTP, stdio, auth helpers)\n- MCP **client** libraries (transports, high-level helpers, OAuth helpers)\n- Optional **middleware packages** for specific runtimes\u002Fframeworks (Express, Hono, Node.js HTTP)\n- Runnable **examples** (under [`examples\u002F`](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\u002Ftree\u002Fmain\u002Fexamples))\n\n## Packages\n\nThis monorepo publishes split packages:\n\n- **`@modelcontextprotocol\u002Fserver`**: build MCP servers\n- **`@modelcontextprotocol\u002Fclient`**: build MCP clients\n\nTool and prompt schemas use [Standard Schema](https:\u002F\u002Fstandardschema.dev\u002F) — bring Zod v4, Valibot, ArkType, or any compatible library.\n\n### Middleware packages (optional)\n\nThe SDK also publishes small \"middleware\" packages under [`packages\u002Fmiddleware\u002F`](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\u002Ftree\u002Fmain\u002Fpackages\u002Fmiddleware) that help you **wire MCP into a specific runtime or web framework**.\n\nThey are intentionally thin adapters: they should not introduce new MCP functionality or business logic. See [`packages\u002Fmiddleware\u002FREADME.md`](packages\u002Fmiddleware\u002FREADME.md) for details.\n\n- **`@modelcontextprotocol\u002Fnode`**: Node.js Streamable HTTP transport wrapper for `IncomingMessage` \u002F `ServerResponse`\n- **`@modelcontextprotocol\u002Fexpress`**: Express helpers (app defaults + Host header validation)\n- **`@modelcontextprotocol\u002Fhono`**: Hono helpers (app defaults + JSON body parsing hook + Host header validation)\n\n## Installation\n\n### Server\n\n```bash\nnpm install @modelcontextprotocol\u002Fserver\n# or\nbun add @modelcontextprotocol\u002Fserver\n# or\ndeno add npm:@modelcontextprotocol\u002Fserver\n```\n\n### Client\n\n```bash\nnpm install @modelcontextprotocol\u002Fclient\n# or\nbun add @modelcontextprotocol\u002Fclient\n# or\ndeno add npm:@modelcontextprotocol\u002Fclient\n```\n\n### Optional middleware packages\n\nThe SDK also publishes optional “middleware” packages that help you **wire MCP into a specific runtime or web framework** (for example Express, Hono, or Node.js `http`).\n\nThese packages are intentionally thin adapters and should not introduce additional MCP features or business logic. See [`packages\u002Fmiddleware\u002FREADME.md`](packages\u002Fmiddleware\u002FREADME.md) for details.\n\n```bash\n# Node.js HTTP (IncomingMessage\u002FServerResponse) Streamable HTTP transport:\nnpm install @modelcontextprotocol\u002Fnode\n\n# Express integration:\nnpm install @modelcontextprotocol\u002Fexpress express\n\n# Hono integration:\nnpm install @modelcontextprotocol\u002Fhono hono\n```\n\n## Getting Started\n\nHere is what an MCP server looks like. This minimal example exposes a single `greet` tool over stdio:\n\n```typescript\nimport { McpServer } from '@modelcontextprotocol\u002Fserver';\nimport { StdioServerTransport } from '@modelcontextprotocol\u002Fserver\u002Fstdio';\nimport * as z from 'zod\u002Fv4';\n\nconst server = new McpServer({ name: 'greeting-server', version: '1.0.0' });\n\nserver.registerTool(\n  'greet',\n  {\n    description: 'Greet someone by name',\n    inputSchema: z.object({ name: z.string() }),\n  },\n  async ({ name }) => ({\n    content: [{ type: 'text', text: `Hello, ${name}!` }],\n  }),\n);\n\nasync function main() {\n  const transport = new StdioServerTransport();\n  await server.connect(transport);\n}\n\nmain();\n```\n\nReady to build something real? Follow the step-by-step quickstart tutorials:\n\n- [Build a weather server](docs\u002Fserver-quickstart.md) — server quickstart\n- [Build an LLM-powered chatbot](docs\u002Fclient-quickstart.md) — client quickstart\n\nThe complete code for each tutorial is in [`examples\u002Fserver-quickstart\u002F`](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\u002Ftree\u002Fmain\u002Fexamples\u002Fserver-quickstart\u002F) and [`examples\u002Fclient-quickstart\u002F`](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\u002Ftree\u002Fmain\u002Fexamples\u002Fclient-quickstart\u002F). For more advanced runnable examples, see:\n\n- [`examples\u002Fserver\u002FREADME.md`](examples\u002Fserver\u002FREADME.md) — server examples index\n- [`examples\u002Fclient\u002FREADME.md`](examples\u002Fclient\u002FREADME.md) — client examples index\n\n## Documentation\n\n- [Server Guide](docs\u002Fserver.md) — building MCP servers: transports, tools, resources, prompts, server-initiated requests, and deployment\n- [Client Guide](docs\u002Fclient.md) — building MCP clients: connecting, tools, resources, prompts, server-initiated requests, and error handling\n- [FAQ](docs\u002Ffaq.md) — frequently asked questions and troubleshooting\n- [API docs](https:\u002F\u002Fmodelcontextprotocol.github.io\u002Ftypescript-sdk\u002F)\n- [MCP documentation](https:\u002F\u002Fmodelcontextprotocol.io\u002Fdocs)\n- [MCP specification](https:\u002F\u002Fmodelcontextprotocol.io\u002Fspecification\u002Flatest)\n\n### Building docs locally\n\nTo generate the API reference documentation locally:\n\n```bash\npnpm docs          # Generate V2 docs only (output: tmp\u002Fdocs\u002F)\npnpm docs:multi    # Generate combined V1 + V2 docs (output: tmp\u002Fdocs-combined\u002F)\n```\n\nThe `docs:multi` script checks out both the `v1.x` and `main` branches via git worktrees, builds each, and produces a combined site with V1 docs at the root and V2 docs under `\u002Fv2\u002F`.\n\n## v1 (legacy) documentation and fixes\n\nIf you are using the **v1** generation of the SDK, the **v1 API documentation** is available at [`https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002F`](https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002F). The v1 source code and any v1-specific fixes live on the long-lived\n[`v1.x` branch](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\u002Ftree\u002Fv1.x). V2 API docs are at [`\u002Fv2\u002F`](https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002Fv2\u002F).\n\n## Contributing\n\nIssues and pull requests are welcome on GitHub at \u003Chttps:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk>.\n\n## License\n\nThis project is licensed under the Apache License 2.0 for new contributions, with existing code under MIT. See the [LICENSE](LICENSE) file for details.\n","Model Context Protocol (MCP) TypeScript SDK 是用于构建MCP服务器和客户端的官方库，支持Node.js、Bun和Deno环境。该项目提供了包括工具\u002F资源\u002F提示管理、流式HTTP处理及认证辅助在内的服务器端库，以及传输层、高级助手函数和OAuth支持等客户端库，并且还为特定运行时或框架（如Express、Hono）准备了可选的中间件包。适用于需要在应用程序与大语言模型之间以标准化方式传递上下文信息的各种场景，例如开发聊天机器人、智能助手等AI驱动的应用程序。当前版本v1.x适合生产使用，而正在开发中的v2预计将在2026年第一季度发布稳定版。",2,"2026-06-11 03:45:35","high_star"]