feat(mcp): expose x402 receipt metadata and explorer URL from paid MCP tools - #296
Merged
Emmy123222 merged 7 commits intoSep 3, 2026
Merged
Conversation
…labels-and-4-4h8dgn88 Update 15 files
|
@AGWAM001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@AGWAM001 is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
AbuJulaybeeb
requested changes
Sep 1, 2026
AbuJulaybeeb
left a comment
Collaborator
There was a problem hiding this comment.
kindly fetch upstream, rebase branch ad push
Contributor
Author
|
ready for merge |
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
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.
Closes #172
Summary
Extends paid MCP tool output in mcp-server/index.ts to include the versioned x402 receipt object and an explorer URL, alongside the existing amount/network reporting. Missing or unverified receipts are now represented explicitly rather than being folded into a generic "paid success" response.
Problem
MCP search output currently reports payment amount and network, but omits the actual verifiable receipt and a transaction link — so a caller has no way to independently verify that a reported payment actually settled, short of trusting the amount/network fields at face value. There's also no distinction in output between "payment verified with receipt" and "receipt missing/unverified" — both would currently look like a normal paid success.
Changes
Receipt object in output: paid tool responses now include the versioned x402 receipt object as returned/verified during settlement, not just the derived amount/network summary.
Explorer URL: added a transaction explorer link derived from the settlement result, so a caller can independently inspect the on-chain transaction.
Explicit missing/unverified state: when a receipt is missing or fails verification, the response now surfaces that explicitly (e.g. a distinct status/field indicating unverified payment) rather than silently reporting the same shape as a verified paid success. This prevents a caller from mistaking an unverified payment for a confirmed one.
Cross-runtime consistency: verified this behavior is aligned across Express, Vercel, browser, and MCP contexts — the receipt/explorer-URL exposure and the missing/unverified distinction behave the same regardless of which runtime is serving the request.
x402 settlement semantics preserved: no change to the underlying settlement verification logic itself — this PR only changes what's exposed in the tool's output, not how payment is verified.
Tests/docs: added coverage asserting the receipt object and explorer URL are present on verified paid responses, and that the explicit unverified/missing state is returned (not a false paid-success shape) when applicable. Updated relevant documentation describing the new response fields.
Why this approach
Surfacing the actual receipt object (rather than just amount/network) gives callers something independently verifiable instead of asking them to trust the server's summary. Making "missing/unverified" an explicit, distinct output state — rather than silently omitting the receipt field while still returning a success-shaped response — closes a gap where a caller could mistakenly treat an unverified payment as settled.
Testing
Unit/integration test: verified paid tool call returns response including receipt object and explorer URL.
Unit/integration test: simulated missing/failed receipt verification returns the explicit unverified state, not a paid-success shape.
Verified consistent behavior across Express, Vercel, browser, and MCP invocation paths.
Confirmed no change to underlying x402 settlement verification logic — existing settlement tests still pass unchanged.