@modelcontextprotocol/node@2.1.1
@modelcontextprotocol/node@2.1.1 restricts Server/McpServer and stateless HTTP transports to handling a single connection or request at a time, requiring servers and transports to be instantiated per request or session.
原始内容为英文;当前页面提供中文导航与来源说明,具体事实请以原文为准。
为什么值得关注
The @modelcontextprotocol/node@2.1.1 release introduces a breaking behavioral change regarding server and transport lifecycles. A Server or McpServer now only serves one connection at a time, and a Streamable HTTP server transport without sessions ( sessionIdGenerator: undefined ) serves only one request. Reusing a single server object or stateless transport across requests will cause subsequent requests to fail with ALREADY CONNECTED SdkErrors or HTTP 500 status codes. Applications must now construct a new server and transport per request, or build them per session when session IDs are used. Additionally, hono was transitioned to a regular dependency to resolve peer-dependency installation issues, and package manifests were updated to reflect the Apache-2.0 license.
可执行摘要
Patch @modelcontextprotocol/node@2.1.1 enforces single-connection lifecycle on Server/McpServer instances and single-request lifecycle on stateless Streamable HTTP transports (sessionIdGenerator: undefined). Reusing instances across requests/sessions causes ALREADY CONNECTED errors or HTTP 500 rejections.
- Agent 实用度
- 89/100
- 可信度
- 96%
- 机器格式
- JSON + Markdown
开发者应核对什么
- Refactor HTTP request handlers to instantiate McpServer / Server and stateless streamable transports inside the request handler instead of reusing global instances.
- Ensure createMcpHandler receives a factory function that creates a new server per invocation rather than returning a static pre-built server reference.
- Instantiate dedicated server objects per session if session management is enabled via sessionIdGenerator .