Add example: agent identity verification before x402 payment - #142
Open
saneGuy wants to merge 2 commits into
Open
Add example: agent identity verification before x402 payment#142saneGuy wants to merge 2 commits into
saneGuy wants to merge 2 commits into
Conversation
Signed-off-by: lordviswa <lordviswa@lordviswas-MacBook-Air.local>
- Remove @bolyra/sdk from dependencies (was never imported) - Remove @edgeandnode/ scope from package name - Replace Bolyra-specific types with generic IdentityVerifier<TProof> interface - Fix payment as any cast: read agent proof from context.requestMetadata - Trim README: less Bolyra, more generic, honest about structural-only stub - Separate identity verification (withIdentityGate) from payment settlement Signed-off-by: Viswanadha Pratap Kondoju <kondojuviswanadha@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Viswanadha Pratap Kondoju <kondojuviswanadha@gmail.com>
saneGuy
force-pushed
the
example/agent-identity-gate
branch
from
June 28, 2026 21:10
0089a48 to
ba132d8
Compare
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.
Summary
Adds an example service that verifies an AI agent's identity and permissions before accepting x402 payments. Follows the pattern of existing examples (e.g.,
fastmcp-x402-server).The problem: ampersend manages x402 payments, but any wallet-equipped agent can pay for a service. There's no standard way to check whether the agent behind the wallet is authorized to access the endpoint.
What this example does:
Files added:
typescript/examples/agent-identity-gate/src/server.ts— MCP server with identity gatetypescript/examples/agent-identity-gate/src/identity.ts— identity verification logictypescript/examples/agent-identity-gate/src/cli.ts— CLI for testingtypescript/examples/agent-identity-gate/src/index.ts— entry pointtypescript/examples/agent-identity-gate/README.md— setup and usagetypescript/examples/agent-identity-gate/package.json— dependenciesUses @bolyra/sdk for the identity verification layer. Related to #119 (seller-side server patterns).
Test plan
npm installin the example directorynpm run buildcompiles cleanlynpm startruns the server with identity verificationnpm run clitests the full authorize → pay → serve flow