-
Notifications
You must be signed in to change notification settings - Fork 357
Migrate x402 MCP integration to @x402/core v2 + parallelize test suites #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Upgrade x402 MCP integration to x402 v2: replace legacy `x402` usage with `@x402/core`, `@x402/evm` and related v2 packages. Update agents implementation, examples (examples/x402, examples/x402-mcp) and package dependencies to use CAIP-2 network identifiers, viem signers, and new v2 APIs; adjust imports and middleware accordingly. Add migration changelog (.changeset) and new Vitest tests for x402 integration; update package.json files to include v2 deps and viem where needed.
Consolidate Vitest project configuration and simplify test scripts. Added top-level vitest.config.ts to packages/agents and packages/ai-chat to declare test projects, and set per-project names in existing vitest configs (react, cli, workers, x402). Updated package.json test scripts to use `vitest --run` and `--project <name>` instead of chaining runs. Removed the agents e2e test suite and related remote-mcp and utils files (deleted src/e2e/*), cleaning up flaky/legacy end-to-end tests.
🦋 Changeset detectedLatest commit: 4341d8b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
Add TestWorkflowAgent.expectThrow to safely call methods expected to throw and capture their error messages (avoids unhandled RPC rejections in workerd). Update workflow tests to replace expect(...).rejects.toThrow(...) with expectThrow checks and assert threw/message for various error cases (duplicate tracking insert, binding migration, terminate/pause/resume/restart errors, pagination cursor validation, sendApprovalEvent). Changes in packages/agents/src/tests/agents/workflow.ts and packages/agents/src/tests/workflow.test.ts.
Merged
This was referenced Feb 9, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
x402package to@x402/coreand@x402/evmv2. Updates both server-side (withX402) and client-side (withX402Client) wrappers, with backward-compatiblenormalizeNetworkfor legacy network names (e.g."base-sepolia"→"eip155:84532"). The deprecatedversionfield is preserved as a no-op for existing consumers. Adds 33 new unit tests covering payment flows, lazy initialization, token parsing, and error handling.examples/x402andexamples/x402-mcp) to use the v2@x402/*packages and CAIP-2 network identifiers.vitest.config.tswithtest.projectsto bothpackages/agents(4 projects: workers, react, cli, x402) andpackages/ai-chat(2 projects: workers, react). All test suites now run in parallel within a singlevitest --runinvocation, with named projects for clear output labeling and--projectfiltering for focused runs.check:test:*scripts from both packages. Thetestscript is now justvitest --run, and individual suites are accessible viatest:workers,test:react, etc. using--project.src/e2e/directory (5 files, ~800 lines) tested MCP tool listing/calling and OAuth flows over real Cloudflare deploys viaalchemy. All scenarios are already covered by the workers pool tests (streamable-http.test.ts,sse.test.ts,oauth2-mcp-client.test.ts,add-mcp-server.test.ts), making the e2e suite unnecessary overhead.Test plan
npm run test -w agentspasses — all 4 projects (workers, react, cli, x402) run in parallelnpm run test -w @cloudflare/ai-chatpasses — both projects (workers, react) run in parallelnpm run test:x402 -w agents)npm run checkpasses (typecheck, lint, format, exports)