@cloudflare/codemode
0.5.5 · 20 Oct 2026MIT456.9k / weekRepositorynpmAtom feed
Latest releases
All 34 releases- 0.5.x · latest line
0.5.5
20 Oct 2026Release tool calls left pending when an execution settles, so unawaited calls no longer leak Dynamic Worker concurrency slots. See Unawaited tool calls.
0.5.4
13 Oct 2026ToolSetConnectornow forwards each AI SDK tool'soutputSchemainto its connector descriptors, so durablecodemode.describe()shows the output type instead ofunknown, asMcpConnectoralready does. Input and output schemas that convert asynchronously (jsonSchema(promise)) are now awaited instead of being dropped.Output types, in both
generateTypesand connector descriptors, now describe the value a tool returns rather than the input side of its schema. A.default()field is now required and a.pipe()field has the piped type. A.transform(), which JSON Schema can't express, shows asunknowninstead of the pre-transform type.
0.5.2
11 Sep 2026Truncate structured results structurally instead of slicing their JSON.
truncateResult(the defaulttransformResultin Think's execute tool and the browser tools) and thecodeMcpServer/openApiMcpServerresponse path used to pretty-print an oversized object and cut it at a character count, leaving the model with half a JSON document. Oversized values are now shrunk in place, largest values first: strings are clipped with a--- TRUNCATED --- <n> charssuffix, arrays keep their leading items and end with a--- TRUNCATED --- <n> more itemselement, and an object only loses entries (largest first, named in a"--- TRUNCATED ---"entry) when its values cannot share the budget. The output is always valid JSON of the original shape and small values pass through untouched.The Code Mode tool now carries a
toModelOutputthat projectscallsout of what the model sees and bounds the sandboxlogsthe same way a result is bounded. The durable call log — every connector call's args and result — stays on the persisted tool part for UIs and audit, but no longer rides into the model's context uncapped alongside the transformedresult. The projection never throws: a BigInt or cyclic value is rendered rather than failing a completed run at model assembly.The MCP servers apply the response budget to the text they emit, pretty-printing only while that still fits.
0.5.1
27 Jul 2026Add MCP SDK v2 client and server support.
MCPClientConnectionnow uses the exact-pinned@modelcontextprotocol/client@2.0.0-beta.5. It probes for stateless MCP withserver/discover, then falls back to the legacyinitializehandshake on the same connection when needed. The SDK auto-fulfills stateless elicitationinput_requiredresults through the existing form and URL elicitation handlers whilecallTool,getPrompt, andreadResourceremain pending. OAuth reauthorization discards redirect-scoped discovery after token issuance and preserves discovery-triggered authentication, allowing a changed authorization server to be rediscovered and registered without reusing the prior issuer's credentials. Legacy pushed elicitation, Streamable HTTP, SSE, RPC, OAuth, and hibernation recovery remain supported. Codemode's MCP connector now uses an SDK-neutral structural boundary compatible with both MCP client generations.Add MCP SDK v2 support to
createMcpHandler. Pass a factory returningMcpServerorServerfrom the exact-pinned@modelcontextprotocol/server@2.0.0-beta.5peer dependency to serve stateless MCP with legacy compatibility by default. The newagents/mcp/serverentry exports the stateless Agents handler without retainingMcpAgent,WorkerTransport, MCP client transports, PartyServer, or SDK v1 modules. The returned handler remains callable for Worker dispatch and exposes the lower-level SDKfetch(request, options?)method plus typednotifymethods; upstreamcloseand event-bus internals are not part of the Agents surface. The retained v1 server APIs use the exact-pinned@modelcontextprotocol/sdk@1.29.0peer dependency.The legacy compatibility fallback now uses SDK v2's web-standard transport, including fail-fast handling for unsupported server-to-client requests, active-request teardown, and the same 25-second Cloudflare SSE keepalive previously supplied by
WorkerTransport. It returns405for session-only GET and DELETE requests without constructing an application server.createLegacyMcpHandlerremains an explicit public API for SDK v1 servers and complete WorkerTransport options.The MCP client storage codec now preserves stateless discovery data with resumed HTTP sessions and preserves the binding name and props required to restore RPC servers. Stored HTTP session IDs from older Agents versions have no associated protocol version. The upgraded client discards those IDs and reconnects instead of sending an unsafe resumed request, so in-flight work tied to an old remote session does not resume.
The v2 callable handler maps verified provider-issued metadata from compatible
@cloudflare/workers-oauth-providerreleases to standard MCPAuthInfowhile preservinggetMcpAuthContext().props.The Workers handler rejects malformed, opaque, and non-HTTP browser Origins. Its default allowlist includes localhost-class Origins, the endpoint's
workers.devhostname, and a concretecorsOptions.originhostname. It applies matching Host checks to localhost andworkers.devendpoints. Custom-domain deployments with wildcard CORS can setallowedHostnamesandallowedOriginHostnamesexplicitly, or setallowedOriginHostnames: "*"when trusted upstream middleware already enforces the required Origin policy. Requests without Origin remain valid for non-browser MCP clients. Default CORS preflights allow the statelessMcp-MethodandMcp-Namerequest headers.@cloudflare/codemodeis now an optional peer. Applications that importagents/skillsoragents/browserinstall Codemode explicitly; MCP-only applications no longer install it transitively.Deprecations in this release:
experimental_createMcpHandlerwas already deprecated and remains scheduled for removal in the next major release. Its warning now directs users to an SDK v2 factory first and namescreateLegacyMcpHandleronly as a temporary bridge for sessionful SDK v1 behavior.
Dependency tracking · free for 3 projects
Know when your own dependencies move
@cloudflare/codemode published 34 releases in the last 12 months. Inlinr folds the routine ones into a line and keeps the few that need you.
Advisories reach you
An email when a critical or high advisory affects a project, before the next install.
Upgrades checked first
Peer ranges, Node, ESM-only and types changes read before you bump.
Only what matters
Majors and breaking notes stay; patches and sibling bumps fold into one line.
Registry facts last checked 22 Oct 2026. Releases and advisories last read 22 Oct 2026.