MCP TypeScript SDK 2.3.0
MCP TypeScript SDK 2.3.0 shifts server instances to a per-request lifecycle model, restricts HTTP client redirects to the same origin by default, and dramatically optimizes SSE parser performance for large payloads.
原始内容为英文;当前页面提供中文导航与来源说明,具体事实请以原文为准。
为什么值得关注
MCP TypeScript SDK version 2.3.0 introduces architectural changes and performance improvements across its packages. Key changes include: - Per-request server lifecycle: McpServer.connect() now rejects when already connected, requiring servers and Streamable HTTP transports to be instantiated inside request handlers rather than shared globally. - Strict redirect policy: HTTP client transports follow redirects only to the same origin (same scheme/host/port, with HTTP-to-HTTPS upgrades allowed) unless redirectPolicy: 'follow' is explicitly configured. - New configuration options: maxToolInputElements limits array elements and object keys in tool arguments; expectedResource validates the token audience in requireBearerAuth / verifyBearerToken . - Origin validation updates: validateOriginHeader and helper allowedOrigins now support URI scheme formats like moz-extension:// for browser extensions. - Schema handling and bug fixes: prompts/get without arguments now validates against {} to properly support top-level .optional() or .default() schema definitions. registerTool defers schema conversions to optimize per-request server builds. SSEClientTransport now attempts only one refresh following a 401 response on connect.
可执行摘要
MCP TypeScript SDK 2.3.0 changes server execution to one instance per request, rejecting concurrent connects on McpServer. HTTP client transports now enforce same-origin redirects unless configured with redirectPolicy: 'follow'. It introduces maxToolInputElements, expectedResource token audience validation, browser extension origin support, and updates eventsource-parser dependency to =3.0.8 for faster SSE…
- Agent 实用度
- 94/100
- 可信度
- 96%
- 机器格式
- JSON + Markdown
开发者应核对什么
- Refactor server setups to instantiate McpServer and its transport inside request handlers or createMcpHandler rather than reusing a shared instance across requests.
- Configure redirectPolicy: 'follow' on HTTP client transports if connections must follow cross-origin or cross-port redirects (including in browser environments).
- Upgrade @modelcontextprotocol/express alongside @modelcontextprotocol/server if using expectedResource bearer auth options.
- Ensure eventsource-parser is updated to version 3.0.8 or later to benefit from SSE performance improvements on large payloads.