feat: Add MCP example and enhance A2A example with Smart Account support#23
Merged
pcarranzav merged 19 commits intomainfrom Dec 10, 2025
Merged
feat: Add MCP example and enhance A2A example with Smart Account support#23pcarranzav merged 19 commits intomainfrom
pcarranzav merged 19 commits intomainfrom
Conversation
f731092 to
c29fda3
Compare
cmwhited
approved these changes
Dec 8, 2025
…ng defaults Migrate and enhance buyer examples with production-ready patterns: - Add MCP buyer example using McpToolset via ampersend-proxy - Update A2A buyer example with Smart Account + EOA auto-detection - Add AmpersendTreasurer vs NaiveTreasurer mode selection - Default to staging endpoints (testnet, free) - Add comprehensive inline documentation Documentation improvements: - Create running-mcp-proxy.md guide with installation and setup - Update python/README.md with Getting Started (Ampersend-first) - Document Standalone Alternative for testing - Link to Circle USDC faucet for testnet funding - Show production upgrade path All examples follow Ampersend-first pattern: - Primary: Smart Account + AmpersendTreasurer (with spend limits) - Alternative: EOA + NaiveTreasurer (standalone testing) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
SmartAccountConfig has OWNABLE_VALIDATOR as default, so validator_address parameter is not needed in examples and documentation.
- Mention AmpersendTreasurer as recommended option with spend limits - Clarify NaiveTreasurer is for testing only - Note SmartAccountWallet supports ERC-7579 OwnableValidator from Rhinestone
Clarify that users need to create an account at app.ampersend.ai before switching to production endpoints.
Include steps to create agent account, fund it, and update Smart Account credentials along with API and service endpoints.
SmartAccountConfig uses OWNABLE_VALIDATOR as default, so the validator_address env var is not needed.
Remove non-null assertion on BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS since the env schema provides OWNABLE_VALIDATOR as default. Also remove from documentation as it's not required to be set.
Note that app.staging.ampersend.ai is for testnet and app.ampersend.ai is for production/mainnet.
Clarify that users can replace The Graph subgraph service URLs with any other MCP-x402 or A2A-x402 compatible service.
b2b790f to
611ddd8
Compare
Add AmpersendTreasurer as the default treasurer for MCP proxy when AMPERSEND_API_URL is provided, with NaiveTreasurer as fallback. Changes: - Import createAmpersendTreasurer in cli.ts - Select treasurer based on AMPERSEND_API_URL presence - Export AmpersendTreasurer from ampersend/index.ts - Add AMPERSEND_API_URL to env schema - Update logging to show treasurer type Documentation updates: - Explain TS__MCP_PROXY__ env prefix used by pnpm proxy:dev - Document --env-prefix flag to disable prefix - Show both prefixed and non-prefixed examples - Promote Smart Account + Ampersend as recommended - Document EOA + Naive as standalone alternative The proxy now follows the same Ampersend-first pattern as the A2A examples with spend limits and monitoring by default.
Update MCP proxy README and MCP buyer example to document: - Environment variable prefix (TS__MCP_PROXY__ for pnpm proxy:dev) - AmpersendTreasurer as recommended (with AMPERSEND_API_URL) - NaiveTreasurer as standalone alternative - Correct proxy startup commands with prefix
Parse AMPERSEND_API_URL with the env prefix so it's correctly read when using --env-prefix flag.
Use CustomMcpError from FastMCP fork to solve instanceof failures
across module boundaries when using tsx or different bundlers.
Changes:
- Import CustomMcpError instead of McpError in middleware
- Update fastmcp dependency to github:edgeandnode/fastmcp#598d18f
- Fix bridge to process ALL responses through middleware (not just errors)
- This allows payment response detection in successful results
- Enables onStatus('accepted') to be called properly
Fixes payment status reporting so payments appear as 'Accepted' in
dashboard instead of staying 'Pending'.
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
Add MCP buyer example and enhance existing A2A buyer example with production-ready patterns and comprehensive documentation.
Builds on: #22 (X402RemoteAgentToolset)
Chain: This PR targets
feat/x402-local-agent-toolsetbranch (will rebase tomainafter #22 merges)What's Included
New: MCP Buyer Example
Location:
examples/src/examples/mcp/buyer/adk/Example demonstrating MCP protocol integration with x402 payments via ampersend-proxy.
McpToolsetto connect through proxyEnhanced: A2A Buyer Example
Location:
examples/src/examples/a2a/buyer/adk/Enhanced with production-ready patterns:
Documentation
MCP Proxy Guide
Location:
examples/docs/running-mcp-proxy.mdComplete guide for running the MCP x402 proxy:
Updated Python README
Location:
python/README.mdComprehensive update with Ampersend-first approach:
Documentation Approach
All examples follow consistent pattern:
Staging Defaults
All examples default to staging (free testnet):
https://app.staging.ampersend.aihttps://api.staging.ampersend.aihttps://subgraph-a2a.x402.staging.thegraph.comhttps://subgraph-mcp.x402.staging.ampersend.aiWith clear notes that staging is rate-limited, and production endpoints documented.
Testing
🤖 Generated with Claude Code