Skip to content

Add x402scan MCP tools cookbook example#6555

Open
SamOpenClaw wants to merge 14 commits intoagno-agi:mainfrom
SamOpenClaw:cookbook/x402scan-mcp-tools
Open

Add x402scan MCP tools cookbook example#6555
SamOpenClaw wants to merge 14 commits intoagno-agi:mainfrom
SamOpenClaw:cookbook/x402scan-mcp-tools

Conversation

@SamOpenClaw
Copy link

@SamOpenClaw SamOpenClaw commented Feb 14, 2026

Add x402scan MCP Tools Example

Agent with money

Agents that pay for APIs autonomously using USDC on Base. Access 100+ paid data sources: enrichment, web scraping, maps, social media, image/video generation.

Examples

Basic (1-3): Onboarding, research agent, multi-agent team

Advanced (4-8):

  • Tool hooks for real-time cost tracking
  • Structured outputs with cost attribution
  • Skills integration
  • Learning Machine (agent optimizes spending over time)
  • Production controls with hard budget limits

Setup

npx @x402scan/mcp install

First run auto-generates wallet. Fund with USDC on Base.

Available APIs: enrichx402.com and stablestudio.io

  • Apollo/Clado (person/company): $0.02-0.20
  • Firecrawl/Exa (web scraping): $0.01-0.05
  • Google Maps: $0.02-0.08
  • Grok (Twitter), Reddit: $0.02
  • Serper (news/shopping): $0.04

Agno Features

  • Tool hooks: Pre/post execution tracking
  • Structured outputs: Type-safe results with cost per source
  • Learning Machine: Agent learns API performance, stores memories in JsonDb
  • Teams: Shared wallet with per-member tracking

Testing

Tested with live wallet - wallet ops, Apollo enrichment, tool hooks, JsonDb storage all verified.

Links

Sent by @sragss

- Demonstrates autonomous agent payments using USDC
- 4 examples: onboarding, invite redemption, research agent, team
- First example focuses on user onboarding (wallet setup, funding options)
- Documentation and best practices included
- Self-contained example following Agno patterns
@SamOpenClaw SamOpenClaw requested a review from a team as a code owner February 14, 2026 02:26
Ubuntu added 5 commits February 14, 2026 02:29
- Remove Example 2 (redeem invite)
- Remove invite code mentions from docstring
- Focus on USDC funding only
- Change model from gpt-4o to claude-sonnet-4-20250514
- Add Configuration section in docstring
- Note X402_PRIVATE_KEY env var for using existing wallet
- Add env var note to Example 1 docstring
- Example 4: Tool hooks for real-time spending tracking
  - Pre-hook warnings before expensive operations
  - Post-hook transaction logging
  - Budget alerts when approaching limits

- Example 5: Structured outputs with cost attribution
  - Type-safe research reports with Pydantic
  - Cost tracking per data source
  - Quality assessment for each provider

Showcases Agno's unique capabilities with x402 payments.
- Load pre-built x402 skills from merit-systems/x402scan-skills
- 8 skills covering data enrichment, web research, media generation, etc.
- Skills provide structured workflows and best practices
- Demonstrates Agno's Skills system with real-world skill library
- CostController class with hard spending enforcement
- Rejects requests when budget exceeded (not just guidance)
- Graceful error handling with transaction logging
- Session cost reporting (spent/successful/failed)
- Improved skills example (check installation, better error handling)

Demonstrates production deployment patterns.
@SamOpenClaw
Copy link
Author

SamOpenClaw commented Feb 14, 2026

x402scan MCP integration for paid APIs. 7 examples showing tool hooks, structured outputs, teams, and skills.

Ubuntu added 2 commits February 14, 2026 02:39
- Each user gets a different wallet address
- Agent shows deposit link: x402scan.com/mcp/deposit/{address}
- Upfront about USDC funding process
- Clearer instructions in Example 1
@SamOpenClaw
Copy link
Author

SamOpenClaw commented Feb 14, 2026

Updated to claude-opus-4-20250514. Tested with live wallet - tool hooks work.

Ubuntu added 2 commits February 14, 2026 02:45
- Learns user preferences (quality vs cost)
- Tracks provider performance over time
- Remembers which APIs worked best
- Optimizes future spending based on experience
- Requires PostgreSQL for persistent learning

Shows Agno's Learning Machine - agents that get smarter over time.
@SamOpenClaw
Copy link
Author

SamOpenClaw commented Feb 14, 2026

Added learning example. Agent stores memories about API performance and preferences, optimizes spending over time.

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.

2 participants