Patch Changes
-
#673
603b825Thanks @whoiskatrin! - added resumable streaming with minimal setup -
#665
4c0838aThanks @threepointone! - Add default JSON schema validator to MCP client -
#664
36d03e6Thanks @threepointone! - Refactor MCP server table management in Agent classMoved creation and deletion of the cf_agents_mcp_servers table from AgentMCPClientStorage to the Agent class. Removed redundant create and destroy methods from AgentMCPClientStorage and updated MCPClientManager to reflect these changes. Added comments to clarify usage in demo and test code.
-
#653
412321bThanks @deathbyknowledge! - Allowthis.destroyinside a schedule by including adestroyedflag and yieldingctx.abortinstead of calling it directly
Fix issue where schedules would not be able to run for more 30 seconds due toblockConccurencyWhile.alarm()isn't manually called anymore, getting rid of the bCW.
Fix an issue where immediate schedules (e.g.this.schedule(0, "foo"))) would not get immediately scheduled. -
#652
c07b2c0Thanks @mattzcarey! - ### New FeaturesMCPClientManagerAPI changes:- New
registerServer()method to register servers (replaces part ofconnect()) - New
connectToServer()method to establish connection (replaces part ofconnect()) connect()method deprecated (still works for backward compatibility)
- New
- Connection state observability: New
onServerStateChanged()event for tracking all server state changes - Improved reconnect logic:
restoreConnectionsFromStorage()handles failed connections
Bug Fixes
- Fixed failed connections not being recreated on restore
- Fixed redundant storage operations during connection restoration
- Fixed potential OAuth storage initialization issue by excluding non-serializable authProvider from stored server options
- Added defensive checks for storage initialization in MCPClientManager and DurableObjectOAuthClientProvider
- Fixed initialization order: MCPClientManager is now created AFTER database tables are created to prevent possible table-not-found errors during DO restart
-
#678
cccbd0fThanks @whoiskatrin! - convert internal AI SDK stream events to UIMessageStreamPart format -
#672
7c9f8b0Thanks @mattzcarey! - -MCPClientConnection.init()no longer triggers discovery automatically. Discovery should be done viadiscover()or throughMCPClientManager.discoverIfConnected()Features
- New
discover()method onMCPClientConnectionwith full lifecycle management:- Handles state transitions (CONNECTED → DISCOVERING → READY on success, CONNECTED on failure)
- Supports cancellation via AbortController (cancels previous in-flight discovery)
- Configurable timeout (default 15s)
- New
cancelDiscovery()method to abort in-flight discoveries - New
discoverIfConnected()onMCPClientManagerfor simpler capability discovery per server createConnection()now returns the connection object for immediate use- Created
MCPConnectionStateenum to formalize possible states:idle,connecting,authenticating,connected,discovering,ready,failed
Fixes
- Fixed discovery hanging on repeated requests - New discoveries now cancel previous in-flight ones via AbortController
- Fixed Durable Object crash-looping -
restoreConnectionsFromStorage()now starts connections in background (fire-and-forget) to avoid blockingonStartand causingblockConcurrencyWhiletimeouts - Fixed OAuth callback race condition - When
auth_urlexists in storage during restoration, state is set to AUTHENTICATING directly instead of callingconnectToServer()which was overwriting the state - Set discovery timeout to 15s
- MCP Client Discovery failures now throw errors immediately instead of continuing with empty arrays
- Added "connected" state to represent a connected server with no tools loaded yet
- New
-
#654
a315e86Thanks @mattzcarey! - When handling MCP server requests use relatedRequestId in TransportOptions to send the response down a POST stream if supported (streamable-http) -
#661
93589e5Thanks @naji247! - fix: add session ID and header support to SSE transportThe SSE transport now properly forwards session IDs and request headers to MCP message handlers, achieving closer header parity with StreamableHTTP transport. This allows MCP servers using SSE to access request headers for session management.
-
#659
48849beThanks @threepointone! - update dependencies