{"id":21999926,"url":"https://github.com/modelcontextprotocol/typescript-sdk","last_synced_at":"2026-02-04T21:01:36.669Z","repository":{"id":264668157,"uuid":"862578138","full_name":"modelcontextprotocol/typescript-sdk","owner":"modelcontextprotocol","description":"The official Typescript SDK for Model Context Protocol servers and clients","archived":false,"fork":false,"pushed_at":"2025-05-01T18:03:22.000Z","size":1076,"stargazers_count":6200,"open_issues_count":191,"forks_count":710,"subscribers_count":57,"default_branch":"main","last_synced_at":"2025-05-05T22:27:37.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://modelcontextprotocol.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modelcontextprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-24T20:45:31.000Z","updated_at":"2025-05-05T20:59:41.000Z","dependencies_parsed_at":"2024-11-25T17:31:25.552Z","dependency_job_id":"f224f1e3-d24a-4e8a-8459-dac741a779dc","html_url":"https://github.com/modelcontextprotocol/typescript-sdk","commit_stats":null,"previous_names":["modelcontextprotocol/typescript-sdk"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Ftypescript-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Ftypescript-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Ftypescript-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Ftypescript-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modelcontextprotocol","download_url":"https://codeload.github.com/modelcontextprotocol/typescript-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253133131,"owners_count":21859109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T23:08:59.705Z","updated_at":"2026-02-04T21:01:36.647Z","avatar_url":"https://github.com/modelcontextprotocol.png","language":"TypeScript","readme":"# MCP TypeScript SDK\n\n\u003e [!IMPORTANT] **This is the `main` branch which contains v2 of the SDK (currently in development, pre-alpha).**\n\u003e\n\u003e 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\u003e\n\u003e For v1 documentation and code, see the [`v1.x` branch](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x).\n\n![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fserver) ![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fclient) ![MIT licensed](https://img.shields.io/npm/l/%40modelcontextprotocol%2Fserver)\n\n\u003cdetails\u003e\n\u003csummary\u003eTable of Contents\u003c/summary\u003e\n\n- [Overview](#overview)\n- [Packages](#packages)\n- [Installation](#installation)\n- [Quick Start (runnable examples)](#quick-start-runnable-examples)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n- [License](#license)\n\n\u003c/details\u003e\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 and ships:\n\n- MCP **server** libraries (tools/resources/prompts, Streamable HTTP, stdio, auth helpers)\n- MCP **client** libraries (transports, high-level helpers, OAuth helpers)\n- Optional **middleware packages** for specific runtimes/frameworks (Express, Hono, Node.js HTTP)\n- Runnable **examples** (under [`examples/`](examples/))\n\n## Packages\n\nThis monorepo publishes split packages:\n\n- **`@modelcontextprotocol/server`**: build MCP servers\n- **`@modelcontextprotocol/client`**: build MCP clients\n\nBoth packages have a **required peer dependency** on `zod` for schema validation. The SDK uses Zod v4.\n\n### Middleware packages (optional)\n\nThe SDK also publishes small “middleware” packages under [`packages/middleware/`](packages/middleware/) 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/middleware/README.md`](packages/middleware/README.md) for details.\n\n- **`@modelcontextprotocol/node`**: Node.js Streamable HTTP transport wrapper for `IncomingMessage` / `ServerResponse`\n- **`@modelcontextprotocol/express`**: Express helpers (app defaults + Host header validation)\n- **`@modelcontextprotocol/hono`**: Hono helpers (app defaults + JSON body parsing hook + Host header validation)\n\n## Installation\n\n### Server\n\n```bash\nnpm install @modelcontextprotocol/server zod\n```\n\n### Client\n\n```bash\nnpm install @modelcontextprotocol/client zod\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/middleware/README.md`](packages/middleware/README.md) for details.\n\n```bash\n# Node.js HTTP (IncomingMessage/ServerResponse) Streamable HTTP transport:\nnpm install @modelcontextprotocol/node\n\n# Express integration:\nnpm install @modelcontextprotocol/express express\n\n# Hono integration:\nnpm install @modelcontextprotocol/hono hono\n```\n\n## Quick Start (runnable examples)\n\nThe runnable examples live under `examples/` and are kept in sync with the docs.\n\n1. **Install dependencies** (from repo root):\n\n```bash\npnpm install\n```\n\n2. **Run a Streamable HTTP example server**:\n\n```bash\npnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts\n```\n\nAlternatively, from within the example package:\n\n```bash\ncd examples/server\npnpm tsx src/simpleStreamableHttp.ts\n```\n\n3. **Run the interactive client in another terminal**:\n\n```bash\npnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts\n```\n\nAlternatively, from within the example package:\n\n```bash\ncd examples/client\npnpm tsx src/simpleStreamableHttp.ts\n```\n\nNext steps:\n\n- Server examples index: [`examples/server/README.md`](examples/server/README.md)\n- Client examples index: [`examples/client/README.md`](examples/client/README.md)\n- Guided walkthroughs: [`docs/server.md`](docs/server.md) and [`docs/client.md`](docs/client.md)\n\n## Documentation\n\n- Local SDK docs:\n    - [docs/server.md](docs/server.md) – building MCP servers, transports, tools/resources/prompts, CORS, DNS rebinding, and deployment patterns.\n    - [docs/client.md](docs/client.md) – using the high-level client, transports, backwards compatibility, and OAuth helpers.\n    - [docs/capabilities.md](docs/capabilities.md) – sampling, elicitation (form and URL), and experimental task-based execution.\n    - [docs/faq.md](docs/faq.md) – environment and troubleshooting FAQs (including Node.js Web Crypto support).\n- External references:\n    - [SDK API documentation](https://modelcontextprotocol.github.io/typescript-sdk/)\n    - [Model Context Protocol documentation](https://modelcontextprotocol.io)\n    - [MCP Specification](https://spec.modelcontextprotocol.io)\n    - [Example Servers](https://github.com/modelcontextprotocol/servers)\n\n## v1 (legacy) documentation and fixes\n\nIf you are using the **v1** generation of the SDK, the **v1 documentation** (and any v1-specific fixes) live on the long-lived [`v1.x` branch](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x). See:\n[`https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x`](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x).\n\n## Contributing\n\nIssues and pull requests are welcome on GitHub at \u003chttps://github.com/modelcontextprotocol/typescript-sdk\u003e.\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","funding_links":[],"categories":["TypeScript","Tools \u0026 Integrations","📚 Projects (1974 total)","Reference Servers","SDKs","A01_文本生成_文本对话","MCP Server 开发","Repos","Mcp Server Directories \u0026 Lists","Official Resources","📦 Other","MCP Ecosystem","🔩 MCP SDKs \u0026 Building Blocks","MCP Frameworks and libraries","📚 참조 링크","MCP \u0026 Model Context Protocol","🔗 MCP (Model Context Protocol)","Table of Contents","🔌 MCP (Model Context Protocol)"],"sub_categories":["MCP Ecosystem","MCP Servers","Offcial","大语言对话模型及数据","**1. 使用 LLM 构建 MCP 服务器**","Core \u0026 Frameworks","TypeScript","공식 저장소","Official MCP Resources","Codex Resources","Core Protocol","Developer Tools","Core MCP Resources"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelcontextprotocol%2Ftypescript-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodelcontextprotocol%2Ftypescript-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelcontextprotocol%2Ftypescript-sdk/lists"}