RPC Transport for MCP Connections
Agents can now connect to MCP servers using Durable Object bindings instead of HTTP URLs, eliminating network round-trips and serialization overhead. Connections stay entirely within the Cloudflare runtime, improving performance and reducing latency for agent-to-server communication.
Key features include:
- Hibernation support — RPC connections automatically survive Durable Object hibernation, with binding names and props persisted and restored
- Deduplication — Multiple calls to
addMcpServer()with the same server name return the existing connection instead of creating duplicates - Smaller footprint — Transport internals reduced from 609 to 245 lines, now using
JSONRPCMessageSchemafrom the MCP SDK for validation
Simplified OAuth Configuration
OAuth is now optional for MCP connections. Servers that don't require authentication can be configured with a single line of code. If a server requires authentication, the SDK returns a clear error message guiding developers to enable the OAuth flow via the callbackHost option.
Enhanced Schema Conversion and Reliability
The JSON Schema to TypeScript converter now handles edge cases that previously caused crashes:
- Circular reference and depth guards to prevent stack overflows
- Internal JSON Pointer resolution (
#/definitions/,#/$defs/,#) - Tuple support for both JSON Schema 2020-12 (
prefixItems) and draft-07 - OpenAPI 3.0
nullable: truesupport - Per-tool error isolation so one malformed schema doesn't crash the entire pipeline
AI Chat Improvements
The @cloudflare/ai-chat library receives multiple reliability fixes:
- Tool denial flow — Properly handles denied tool approvals with Anthropic provider compatibility
- Streaming improvements — Abort signal support and proper reader cleanup
- Message persistence — Deduplication of assistant messages prevents duplicate rows when clients resend history
- Anthropic compatibility —
redacted_thinkingblocks are now preserved during sanitization - Error handling — Added
requestIdsupport inOnChatMessageOptionsfor pre-stream failures - Restored client tool APIs — Previously deprecated methods are back for runtime-defined tools
Getting Started
Update to the latest version with:
npm i agents@latest @cloudflare/ai-chat@latest