Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/bright-browsers-recycle.md

This file was deleted.

26 changes: 0 additions & 26 deletions .changeset/mcp-sdk-v2-handler.md

This file was deleted.

8 changes: 8 additions & 0 deletions agent-think/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @cloudflare/agent-think

## 0.0.4

### Patch Changes

- Updated dependencies [[`6c01c8d`](https://github.com/cloudflare/agents/commit/6c01c8d8e5cdb3158d180a2a3cc2b69ec90b8e90), [`447013d`](https://github.com/cloudflare/agents/commit/447013d086d4f1728749bbca445c02d3dc5052c4)]:
- agents@0.20.0
- @cloudflare/think@0.15.0

## 0.0.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion agent-think/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudflare/agent-think",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"type": "module",
"description": "Think agent that reproduces and fixes cloudflare/agents GitHub issues in a container-backed Workspace. Invoked as `@agent-think repro|pr` via the gh-app webhook service; streams a live thread UI and reports back on the issue.",
Expand Down
30 changes: 30 additions & 0 deletions packages/agents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# @cloudflare/agents

## 0.20.0

### Minor Changes

- [#1557](https://github.com/cloudflare/agents/pull/1557) [`447013d`](https://github.com/cloudflare/agents/commit/447013d086d4f1728749bbca445c02d3dc5052c4) Thanks [@mattzcarey](https://github.com/mattzcarey)! - Add MCP SDK v2 client and server support. `MCPClientConnection` now uses the exact-pinned `@modelcontextprotocol/client@2.0.0-beta.5`. It probes for stateless MCP with `server/discover`, then falls back to the legacy `initialize` handshake on the same connection when needed. The SDK auto-fulfills stateless elicitation `input_required` results through the existing form and URL elicitation handlers while `callTool`, `getPrompt`, and `readResource` remain 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 returning `McpServer` or `Server` from the exact-pinned `@modelcontextprotocol/server@2.0.0-beta.5` peer dependency to serve stateless MCP with legacy compatibility by default. The new `agents/mcp/server` entry exports the stateless Agents handler without retaining `McpAgent`, `WorkerTransport`, MCP client transports, PartyServer, or SDK v1 modules. The returned handler remains callable for Worker dispatch and exposes the lower-level SDK `fetch(request, options?)` method plus typed `notify` methods; upstream `close` and event-bus internals are not part of the Agents surface. The retained v1 server APIs use the exact-pinned `@modelcontextprotocol/sdk@1.29.0` peer 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 returns `405` for session-only GET and DELETE requests without constructing an application server. `createLegacyMcpHandler` remains 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-provider` releases to standard MCP `AuthInfo` while preserving `getMcpAuthContext().props`.

The Workers handler rejects malformed, opaque, and non-HTTP browser Origins. Its default allowlist includes localhost-class Origins, the endpoint's `workers.dev` hostname, and a concrete `corsOptions.origin` hostname. It applies matching Host checks to localhost and `workers.dev` endpoints. Custom-domain deployments with wildcard CORS can set `allowedHostnames` and `allowedOriginHostnames` explicitly, or set `allowedOriginHostnames: "*"` 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 stateless `Mcp-Method` and `Mcp-Name` request headers.

`@cloudflare/codemode` is now an optional peer. Applications that import `agents/skills` or `agents/browser` install Codemode explicitly; MCP-only applications no longer install it transitively.

Deprecations in this release:

- `McpAgent` is deprecated and feature-frozen as a stateful SDK v1 path. New servers should use an SDK v2 factory with `createMcpHandler` from `agents/mcp/server`.
- Passing an SDK v1 server to the overloaded `createMcpHandler` is deprecated for removal in the next major release. Move the server to an SDK v2 factory. Use `createLegacyMcpHandler` only to temporarily retain sessionful SDK v1 behavior while migrating.
- The explicit result-schema overloads `MCPClientManager.callTool(params, resultSchema, options)` and `withX402Client(...).callTool(confirm, params, resultSchema, options)` are deprecated. Use `callTool(params, options)` or `callTool(confirm, params, options)` instead.

`experimental_createMcpHandler` was already deprecated and remains scheduled for removal in the next major release. Its warning now directs users to an SDK v2 factory first and names `createLegacyMcpHandler` only as a temporary bridge for sessionful SDK v1 behavior.

### Patch Changes

- [#1981](https://github.com/cloudflare/agents/pull/1981) [`6c01c8d`](https://github.com/cloudflare/agents/commit/6c01c8d8e5cdb3158d180a2a3cc2b69ec90b8e90) Thanks [@agent-think](https://github.com/apps/agent-think)! - Recycle reusable Browser Run sessions after the platform reports HTTP 410 for an expired session.

## 0.19.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"durable objects"
],
"type": "module",
"version": "0.19.0",
"version": "0.20.0",
"license": "MIT",
"repository": {
"directory": "packages/agents",
Expand Down
26 changes: 26 additions & 0 deletions packages/codemode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# @cloudflare/codemode

## 0.5.1

### Patch Changes

- [#1557](https://github.com/cloudflare/agents/pull/1557) [`447013d`](https://github.com/cloudflare/agents/commit/447013d086d4f1728749bbca445c02d3dc5052c4) Thanks [@mattzcarey](https://github.com/mattzcarey)! - Add MCP SDK v2 client and server support. `MCPClientConnection` now uses the exact-pinned `@modelcontextprotocol/client@2.0.0-beta.5`. It probes for stateless MCP with `server/discover`, then falls back to the legacy `initialize` handshake on the same connection when needed. The SDK auto-fulfills stateless elicitation `input_required` results through the existing form and URL elicitation handlers while `callTool`, `getPrompt`, and `readResource` remain 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 returning `McpServer` or `Server` from the exact-pinned `@modelcontextprotocol/server@2.0.0-beta.5` peer dependency to serve stateless MCP with legacy compatibility by default. The new `agents/mcp/server` entry exports the stateless Agents handler without retaining `McpAgent`, `WorkerTransport`, MCP client transports, PartyServer, or SDK v1 modules. The returned handler remains callable for Worker dispatch and exposes the lower-level SDK `fetch(request, options?)` method plus typed `notify` methods; upstream `close` and event-bus internals are not part of the Agents surface. The retained v1 server APIs use the exact-pinned `@modelcontextprotocol/sdk@1.29.0` peer 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 returns `405` for session-only GET and DELETE requests without constructing an application server. `createLegacyMcpHandler` remains 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-provider` releases to standard MCP `AuthInfo` while preserving `getMcpAuthContext().props`.

The Workers handler rejects malformed, opaque, and non-HTTP browser Origins. Its default allowlist includes localhost-class Origins, the endpoint's `workers.dev` hostname, and a concrete `corsOptions.origin` hostname. It applies matching Host checks to localhost and `workers.dev` endpoints. Custom-domain deployments with wildcard CORS can set `allowedHostnames` and `allowedOriginHostnames` explicitly, or set `allowedOriginHostnames: "*"` 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 stateless `Mcp-Method` and `Mcp-Name` request headers.

`@cloudflare/codemode` is now an optional peer. Applications that import `agents/skills` or `agents/browser` install Codemode explicitly; MCP-only applications no longer install it transitively.

Deprecations in this release:

- `McpAgent` is deprecated and feature-frozen as a stateful SDK v1 path. New servers should use an SDK v2 factory with `createMcpHandler` from `agents/mcp/server`.
- Passing an SDK v1 server to the overloaded `createMcpHandler` is deprecated for removal in the next major release. Move the server to an SDK v2 factory. Use `createLegacyMcpHandler` only to temporarily retain sessionful SDK v1 behavior while migrating.
- The explicit result-schema overloads `MCPClientManager.callTool(params, resultSchema, options)` and `withX402Client(...).callTool(confirm, params, resultSchema, options)` are deprecated. Use `callTool(params, options)` or `callTool(confirm, params, options)` instead.

`experimental_createMcpHandler` was already deprecated and remains scheduled for removal in the next major release. Its warning now directs users to an SDK v2 factory first and names `createLegacyMcpHandler` only as a temporary bridge for sessionful SDK v1 behavior.

## 0.5.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/codemode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudflare/codemode",
"version": "0.5.0",
"version": "0.5.1",
"description": "Code Mode: use LLMs to generate executable code that performs tool calls",
"repository": {
"directory": "packages/codemode",
Expand Down
2 changes: 1 addition & 1 deletion packages/hono-agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"description": "Add Cloudflare Agents to your Hono app",
"devDependencies": {
"agents": "^0.19.0",
"agents": "^0.20.0",
"hono": "^4.12.27"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.