MCP TypeScript SDK 2.1.0 发布:新增 OAuth scope 挑战与请求体限制
原标题:@modelcontextprotocol/server@2.1.0
AI 摘要
MCP TypeScript SDK 发布 @modelcontextprotocol/server@2.1.0 版本,新增请求时 OAuth scope 挑战机制,允许工具、资源、资源模板和提示通过 scopeChallenge 回调返回 insufficient_scope 响应,并在处理器执行前返回 HTTP 403。同时修复了多个问题,包括将请求 id 0 视为合法 id、停止为 initialize 握手发送 notifications/cancelled、为 Streamable HTTP 请求体增加 4 MiB 大小限制及批量消息上限 100 条。
正文节选
### Minor Changes - [#1624](https://github.com/modelcontextprotocol/typescript-sdk/pull/1624) [`6032170`](https://github.com/modelcontextprotocol/typescript-sdk/commit/60321700871029401a2e3bed8fdf4f02c9ec3331) Thanks [@SamMorrowDrums](https://github.com/SamMorrowDrums)! - Add request-time OAuth scope challenges for tools, resources, resource templates, and prompts. Each primitive's `scopeChallenge` callback receives the parsed request and verified authentication info, then either continues