MCP TypeScript SDK 2.1.0 发布:新增 OAuth scope 挑战与请求体大小限制
原标题:@modelcontextprotocol/node@2.1.0
AI 摘要
MCP TypeScript SDK 发布 @modelcontextprotocol/node@2.1.0,新增请求时 OAuth scope 挑战机制,允许 tools、resources、resource templates 和 prompts 通过 scopeChallenge 回调返回 insufficient_scope 响应,并在处理器执行前以 HTTP 403 拦截。同时为 Streamable HTTP 请求体读取增加默认 4 MiB 大小限制,超限返回 413,JSON-RPC 批量数组限制为 100 条消息,超限返回 400。
正文节选
### 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