Agents SDK v0.6.0 — RPC Durable Object transport for MCP, optional OAuth, hardened schema conversion, and ai-chat fixes
Key Points
- Durable Object RPC transport for MCP
- OAuth opt-in for MCP connections
- Hardened schema converter + ai-chat reliability fixes
Summary
Agents SDK v0.6.0 introduces an experimental RPC transport for MCP using Durable Object bindings (no HTTP/network round-trips), makes OAuth opt-in for MCP connections, hardens the JSON Schema→TypeScript converter, and ships multiple reliability fixes for @cloudflare/ai-chat.
Key Points
-
RPC transport (Durable Object binding)
- addMcpServer now accepts string | DurableObjectNamespace with TypeScript overloads; pass the DO namespace directly to connect without HTTP.
- Durable Object hibernation support: binding name and props persist to storage and restore on wake-up; connection IDs survive hibernation.
- Deduplication: repeated addMcpServer calls return the existing connection.
- Smaller RPC internals and validation using JSONRPCMessageSchema from the MCP SDK.
- Experimental API — may change; watch the tracking issue.
-
Optional OAuth for MCP
- addMcpServer no longer eagerly creates an OAuth provider; servers that don't require auth work without callbackHost.
- Clear error is thrown on 401s with guidance to provide callbackHost when OAuth is required.
- Restore-from-storage flow skips auth provider creation if callback URLs are missing.
-
Hardened JSON Schema → TypeScript converter
- Guards for recursion/depth and circular references to prevent stack overflows.
- Better $ref resolution (internal JSON Pointers), tuple/prefixItems support, and OpenAPI 3.0 nullable handling.
- Per-tool error isolation so a bad schema won't crash generateTypes() or getAITools().
- getAITools() now falls back to { type: "object" } when inputSchema is missing.
-
@cloudflare/ai-chat fixes
- Tool denial now transitions to output-denied and supports custom denial messages.
- Streaming responses respect abort/cancel signals and send done signals to clients.
- persistMessages() reconciles assistant messages to avoid duplicates; requestId support for pre-stream errors.
- redacted_thinking blocks preserved; endpoint reliability fixes; dynamic client tool APIs restored.
Upgrade
Run:
npm i agents@latest @cloudflare/ai-chat@latest
Notes for engineers: update Typescript types if you rely on addMcpServer overloads; treat RPC transport as experimental and validate hibernation/restore behavior in your Worker tests.