MCP server-legacy 2.3.1 为 requireBearerAuth 增加 expectedResource
原标题:@modelcontextprotocol/server-legacy@2.3.1
AI 摘要
MCP TypeScript SDK 发布 @modelcontextprotocol/server-legacy@2.3.1 补丁版本,为其 requireBearerAuth 增加了可选的 expectedResource 参数,用于校验令牌的签发受众(通常为服务器 URL)。该参数与 @modelcontextprotocol/server 2.3.0 和 @modelcontextprotocol/sdk 1.32.0 中新增的能力保持一致,使这个冻结包中的中间件与其所复制的 1.x 版本行为对齐。未设置该参数时行为不变,令牌受众不匹配或缺失时返回 401 invalid_token。
正文节选
### Patch Changes - [#2952](https://github.com/modelcontextprotocol/typescript-sdk/pull/2952) [`5a18673`](https://github.com/modelcontextprotocol/typescript-sdk/commit/5a1867390b91b8836f49af76c45427279f513325) Thanks [@claude](https://github.com/apps/claude)! - `requireBearerAuth` in `@modelcontextprotocol/server-legacy` takes the optional `expectedResource` that `@modelcontextprotocol/server` 2.3.0 and `@modelcontextprotocol/sdk` 1.32.0 added: the resource the token must be issued for (its aud