Skip to content

Conversation

@mattzcarey
Copy link
Contributor

@mattzcarey mattzcarey commented Dec 8, 2025

Remove strict version matching after initialization. Now accepts any supported protocol version in request headers and only rejects truly unsupported versions.

This aligns with the move to stateless transports/protocol

fixes: #719

Remove strict version matching after initialization. Now accepts any supported protocol version in request headers, or defaults to negotiated version when header is absent. Only rejects truly unsupported versions.

- Remove unused imports (InitializeRequest) and local SUPPORTED_PROTOCOL_VERSIONS constant
- Capture negotiated protocol version from initialize response instead of request
- Simplify validateProtocolVersion to only reject
@changeset-bot
Copy link

changeset-bot bot commented Dec 8, 2025

🦋 Changeset detected

Latest commit: 3f7016e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@claude
Copy link

claude bot commented Dec 8, 2025

Claude Code Review

Issue in changeset: Typo - "isse" should be "issue"

Architecture concern: The PR removes version tracking entirely but the comment in validateProtocolVersion() states the SDK handles version negotiation. However, there's a semantic gap:

  • The transport now accepts any supported version in subsequent requests, even if different from the negotiated version
  • Test at worker-transport.test.ts:403 confirms this: "should accept any supported version header regardless of negotiated version"
  • This could allow clients to switch protocol versions mid-session without re-negotiating

Question: Is this intentional? If the SDK negotiates a version during initialization, should the transport enforce that specific version for the session lifetime, or is the stateless approach (accept any supported version at any time) the correct design?

Otherwise the changes look good - simplifies the code, removes ~60 lines, and aligns with stateless transport goals.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@720

commit: 3f7016e

agents-git-bot bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Dec 8, 2025
Sync documentation with cloudflare/agents PR #720:
- Remove protocolVersion from TransportState interface (no longer stored)
- Update protocol version validation behavior documentation
- Clarify that protocol version validation is per-request, not session-bound

The WorkerTransport now accepts any supported protocol version on each
request or defaults to the negotiated version when header is absent,
removing the need to track protocol version in persistent state.

Related PR: cloudflare/agents#720

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mattzcarey mattzcarey changed the title fix: simplify protocol version validation in worker transport fix: protocol version validation in worker transport (move to stateless transport) Dec 8, 2025
@mattzcarey mattzcarey changed the title fix: protocol version validation in worker transport (move to stateless transport) fix: protocol version validation in worker transport Dec 8, 2025
agents-git-bot bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Dec 8, 2025
Update documentation to reflect the simplified protocol version validation
in WorkerTransport (cloudflare/agents#720). The transport now uses stateless
validation that accepts any supported protocol version, rather than enforcing
strict version consistency after negotiation.

Changes:
- Add new "Protocol version handling" section explaining stateless validation
- Clarify that version headers are optional after initialization
- Document that only unsupported versions are rejected

Related PR: cloudflare/agents#720

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@whoiskatrin whoiskatrin self-requested a review December 8, 2025 15:56
agents-git-bot bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Dec 8, 2025
Sync from cloudflare/agents PR #720

Changes:
- Remove protocolVersion field from TransportState interface (no longer stored)
- Update persistent storage benefits to remove protocol version tracking
- Add new Protocol Version Validation section explaining stateless validation approach

The WorkerTransport now validates protocol version headers without tracking
negotiated versions. It accepts any supported version or missing headers,
only rejecting explicitly unsupported versions. Protocol negotiation is
handled by the MCP SDK.

Related: cloudflare/agents#720
@mattzcarey mattzcarey merged commit 380c597 into main Dec 8, 2025
5 checks passed
@mattzcarey mattzcarey deleted the fix-transport-protocol-validation branch December 8, 2025 16:06
@github-actions github-actions bot mentioned this pull request Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Support MCP-Protocol-Version 2025-11-25

2 participants