Skip to content

test(mcp, cloudflare): test against the 2026-07-28 protocol only - #2552

Merged
dinwwwh merged 7 commits into
mainfrom
claude/musing-gould-c9ed96
Nov 25, 2026
Merged

dinwwwh merged 7 commits into
mainfrom
claude/musing-gould-c9ed96

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

@orpc/mcp targets the 2026-07-28 MCP protocol only, so the tests no longer run against the 2025-era protocol.

  • The test helpers always connect a negotiating client through createMcpHandler with legacy: 'reject', so every test runs on 2026-07-28. The in-memory legacy path and the per-era test matrix are gone, and the per-request context test reuses the helpers instead of building its own client.
  • Assertions that branched on the era, such as the result nesting the MCP SDK applies for older clients, are reduced to the 2026-07-28 shape, and tests the new cases duplicate are removed.
  • The Cloudflare lazy-router test sends a 2026-07-28 tools/call request instead of a legacy one.
  • Adds coverage for non-object outputs: string, number, boolean, null, and array outputs with and without an output schema, and an object output whose output schema has no object root (a union).
  • Removes internal comments in registrar.ts and utils.ts that only restate what a test already asserts. Public JSDoc is unchanged.

No behavior change.

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2552

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2552

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@2552

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2552

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@2552

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2552

@orpc/effect

npm i https://pkg.pr.new/@orpc/effect@2552

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@2552

@orpc/hibernation

npm i https://pkg.pr.new/@orpc/hibernation@2552

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2552

@orpc/experimental-lock

npm i https://pkg.pr.new/@orpc/experimental-lock@2552

@orpc/mcp

npm i https://pkg.pr.new/@orpc/mcp@2552

@orpc/msw

npm i https://pkg.pr.new/@orpc/msw@2552

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2552

@orpc/next

npm i https://pkg.pr.new/@orpc/next@2552

@orpc/node

npm i https://pkg.pr.new/@orpc/node@2552

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2552

@orpc/experimental-openapi-inference

npm i https://pkg.pr.new/@orpc/experimental-openapi-inference@2552

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@2552

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@2552

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@2552

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@2552

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@2552

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2552

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2552

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@2552

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2552

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2552

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2552

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2552

commit: afc11b6

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
orpc afc11b6 Commit Preview URL

Branch Preview URL
Nov 25 2026, 06:07 AM

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Clarified support for the 2026-07-28 protocol revision and documented how to reject connections from older clients.
  • Tests
    • Expanded coverage for schema-matched primitive and object outputs, undefined outputs, and nested file outputs.
    • Updated integration checks to verify structured tool results and response content.
    • Added coverage confirming requests from different users receive distinct contexts.

The shared MCP test utilities now use Streamable HTTP, and registrar tests no longer run across protocol eras. Cloudflare tests and the integration guide cover legacy request rejection and the supported protocol revision.

Changes: MCP protocol and output test updates

Layer / File(s) Summary
Shared test client configuration
packages/mcp/src/__tests__/utils.ts
The helper removes protocol-era selection and the in-memory transport path. It connects through Streamable HTTP with automatic version negotiation, rejects legacy requests, and registers cleanup callbacks.
Registrar protocol and output coverage
packages/mcp/src/registrar.test.ts, packages/mcp/src/registrar.ts, packages/mcp/src/utils.ts
Tests use the shared client setup instead of running across protocol eras. Output checks cover schemas and returned content for primitive, array, and union-schema results, plus undefined and file-containing outputs. Comments are removed or shortened; executable logic in the implementation files is unchanged.
Cloudflare handler and integration guidance
packages/cloudflare/tests/mcp-registrar.test.ts, apps/content/docs/integrations/mcp.mdx
The Cloudflare test sends protocol headers and metadata, then checks parsed JSON output. The guide identifies the supported protocol revision and shows how to reject older clients.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: Minimal · up to 570eb

This change narrows the MCP tests and docs to the 2026-07-28 protocol revision and removes comments, with no runtime behavior change. No concrete merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title names the test changes and the 2026-07-28 protocol scope. The changeset removes the 2025-era test matrix and in-memory legacy path, and the Cloudflare test now sends a 2026-07-28 tools/call …
Description check Passed The description states that @orpc/mcp now targets only the 2026-07-28 protocol and that tests no longer run against the 2025-era protocol. It lists the helper changes, the Cloudflare lazy-router chang…
Full details: Title check

Explanation

The title names the test changes and the 2026-07-28 protocol scope. The changeset removes the 2025-era test matrix and in-memory legacy path, and the Cloudflare test now sends a 2026-07-28 tools/call request. The title is specific and matches the main change, though it does not mention the removed legacy path or the new non-object output coverage.

Full details: Description check

Explanation

The description states that @orpc/mcp now targets only the 2026-07-28 protocol and that tests no longer run against the 2025-era protocol. It lists the helper changes, the Cloudflare lazy-router change, the added non-object output coverage, and the removed internal comments. This matches the changeset and the PR objectives.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f94ff629-cc11-4df4-a87a-abf6acfe5346
Commits

Reviewing files that changed from the base of the PR and between c99ed79 and 570eb39.

Files selected for processing: 5

  • apps/content/docs/integrations/mcp.mdx
  • packages/mcp/src/__tests__/utils.ts
  • packages/mcp/src/registrar.test.ts
  • packages/mcp/src/registrar.ts
  • packages/mcp/src/utils.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: sound — the tests pin the era-dependent MCP SDK projection at the exact seam (tools/list schema wrapping and tools/call structuredContent wrapping) rather than duplicating registrar logic.

Reviewed changes

  • Non-object output matrix — an it.each table covers string, number, boolean, null, and array outputs against both PROTOCOL_ERAS, asserting the typed tool's advertised schema (wrapped as { type: 'object', properties: { result: … }, required: ['result'] } on legacy, unwrapped on modern), the untyped tool's absent outputSchema, and the unchanged text block plus era-dependent structuredContent.
  • Non-object schema root — covers a union-root output schema (z.union([planetSchema, z.array(planetSchema)])) where the value is an object but the schema root is not, exercising the SDK's advertisedOutputSchema-driven wrapping path rather than the value-driven one.

I verified the assertions against @modelcontextprotocol/server@2.4.0: isNonObjectJsonSchemaRoot is type !== 'object', and the 2025 codec wraps when either the value or the schema root is non-object. pnpm exec vitest run packages/mcp/src/registrar.test.ts passes (76 tests) and npx oxlint packages/mcp/src/registrar.test.ts is clean.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 5 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 40 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/musing-gould-c9ed96 (afc11b6) with main (1eddb43)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (01cf38a) during the generation of this report, so 1eddb43 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@dinwwwh dinwwwh changed the title test(mcp): cover non-object outputs on both protocol eras test(mcp, cloudflare): test against the 2026-07-28 protocol only Nov 25, 2026
@dinwwwh dinwwwh changed the title test(mcp, cloudflare): test against the 2026-07-28 protocol only chore(mcp, cloudflare): support the 2026-07-28 protocol only Nov 25, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one coverage note inline.

Approach: sound — narrowing the suite to the 2026-07-28 protocol removes the per-era branching and lets the assertions pin one shape; the registrar itself is era-agnostic, so the test helper now drives it through the real modern serving path (createMcpHandler with legacy: 'reject').

Reviewed changes

  • Era matrix collapsed — describe.each(PROTOCOL_ERAS) became a single suite, and every era === 'legacy' conditional (schema wrapping, result nesting) was reduced to the 2026-07-28 shape.
  • Helper simplified — createTestClient always serves fresh servers over StreamableHTTPClientTransport with a client pinned to 2026-07-28; the InMemoryTransport legacy branch is gone.
  • Cloudflare request made modern — the lazy-router test now sends mcp-protocol-version/mcp-method/mcp-name headers plus params._meta and parses a plain JSON response instead of an SSE frame.
  • Non-object outputs covered — an it.each over string/number/boolean/null/array plus a union-root output schema pin the advertised schema, the text block, and structuredContent.
  • Modern result shape pinned — assertions now account for the _meta every 2026-07-28 result carries and for File values serializing to {} over HTTP.

I verified the delta locally: registrar.test.ts (62 tests) and the @orpc/cloudflare suite (92 tests, workerd) pass, oxlint and tsc --noEmit on packages/mcp are clean.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/mcp/src/registrar.test.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in the two follow-up commits — the docs statement checks out and the test cleanup removes real duplication.

Reviewed changes

  • Protocol scope documented — mcp.mdx now states that only the 2026-07-28 revision is supported and shows createMcpHandler(factory, { legacy: 'reject' }) as the way to reject older clients; I confirmed the spec link resolves and that legacy: 'reject' really drops the legacy serving path in @modelcontextprotocol/server 2.4.0.
  • Duplicated output tests removed — the standalone planet_list and planet_describe output tests are gone; the it.each table already asserts the same text and structuredContent for array and string outputs on both typed and untyped tools.
  • Duplicate suite merged — the second describe('mcpRegistrar') block was folded into the first, so the file no longer has two sibling suites with the same name.

packages/mcp/src/registrar.test.ts passes (60 tests).

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the one-line change since the prior pullfrog review (6f31736), which switches the shared test client to versionNegotiation: { mode: 'auto' }.

  • Negotiation path covered again — connectTestClient now lets every test client probe server/discover and negotiate against the legacy: 'reject' handler instead of pinning 2026-07-28, which retires the earlier coverage note; the handler still rejects the legacy initialize fallback, so a run can only pass on a mutually negotiated modern revision (2026-07-28 is the only modern revision in SDK 2.4.0).

Verified locally: pnpm exec vitest run packages/mcp/src — 95 passed (60 in registrar.test.ts).

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@dinwwwh dinwwwh changed the title chore(mcp, cloudflare): support the 2026-07-28 protocol only test(mcp, cloudflare): test against the 2026-07-28 protocol only Nov 25, 2026
@dinwwwh
dinwwwh merged commit 69d2a58 into main Nov 25, 2026
13 checks passed
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.

1 participant