@modelcontextprotocol/server@2.3.0
MCP Server 2.3.0 introduces a breaking lifecycle change where servers and stateless transports serve only one connection/request at a time, along with audience verification for bearer tokens and input element limits.
原始内容为英文;当前页面提供中文导航与来源说明,具体事实请以原文为准。
为什么值得关注
@modelcontextprotocol/server@2.3.0 enforces a strict 1:1 lifecycle: a Server or McpServer now serves only one connection at a time, and stateless Streamable HTTP transports (sessionIdGenerator: undefined) serve only a single request. Reusing instances across requests or sessions causes ALREADY CONNECTED errors or 500 Internal Server Errors, requiring applications to construct servers and stateless transports per-request or per-session. Minor features include: 1) expectedResource option in requireBearerAuth and verifyBearerToken to validate audience claims (requires upgrading @modelcontextprotocol/express to match); 2) maxToolInputElements option on McpServer to limit array/object counts in tool inputs before schema validation; 3) scheme-level origin matching (e.g. moz-extension://) in allowedOrigins/validateOriginHeader; 4) tasks/get and tasks/cancel support for the Tasks extension (SEP-2663) under 2026-07-28 connections; and 5) fix for prompts/get calls without arguments.
可执行摘要
BREAKING: McpServer/Server instances and stateless Streamable HTTP server transports can no longer be reused across requests or sessions; reuse throws SdkError ALREADY CONNECTED or HTTP 500. Additionally adds expectedResource bearer auth verification, maxToolInputElements limits, and support for browser extension schemes in allowedOrigins.
- Agent 实用度
- 89/100
- 可信度
- 96%
- 机器格式
- JSON + Markdown
开发者应核对什么
- Refactor stateless HTTP server setups to instantiate Server / McpServer and transports per request inside handler functions rather than globally.
- Ensure createMcpHandler receives a factory function that constructs a new server on each invocation instead of returning a singleton.
- If using Express with expectedResource , upgrade @modelcontextprotocol/express in tandem to support the forwarded option.
- Optionally set maxToolInputElements in McpServerOptions if protection against oversized tool input payloads is needed.