MCP TypeScript SDK 发布 1.32.0:重定向同源限制与工具输入限制
原标题:1.32.0
AI 摘要
MCP TypeScript SDK 发布 1.32.0 版本,主要变更包括:HTTP 客户端传输现在仅在同源(同协议、主机、端口,允许同主机 http 到 https)时跟随重定向,跨源重定向需显式配置 redirectPolicy: 'follow';新增默认关闭的 maxToolInputElements 选项以限制工具调用参数中的数组元素和对象成员数量,以及 requireBearerAuth 的 expectedResource 选项用于校验令牌受众。此外还修复了任务存储会话隔离、支持省略 arguments 的 tools/call 和 prompts/get 请求等问题。
正文节选
## Upgrade notes - Redirects: the HTTP client transports now follow a redirect only when it stays on the same origin (same scheme, host and port; http to https on the same host is allowed). A deployment whose endpoint redirects to another host or port either configures the final URL or sets redirectPolicy: 'follow' on StreamableHTTPClientTransport or SSEClientTransport. In browsers, a redirected request fails unless that option is set. - New options, both off unless you set them: maxToolInputE