How mikeypetrillo/agent402 works
Agent402 is a self-hostable marketplace and paid tool server for AI agents, with human-facing reports and a separate pay-per-crawl product. The main agent workflow is discovery through MCP, then a tool call whose paid access can use x402 or MPP; framework adapters provide additional entry points. Other documented branches include tool routing, seller rankings, metered model access, decision planning, and tollbooth deployment. The supplied excerpts do not include the main server or most tool implementations, so edges are limited to README statements and visible imports; some subsystem paths use existing source directories where implementation files were not shown.
Main entry points: mcp/index.js MCP server · tollbooth/index.js Tollbooth gate · server.js Decision service · client/index.js Payment client
Components 20
Agent access
- MCP server
mcp/index.js - Framework adapters
adapters - Payment client
client/index.js
Discovery and planning
- Tool catalog
mcp/output-schemas.js - Tool search
src/tools/search.js - Smart router
src/routing-proof.js - Seller leaderboard
src - Decision planner
services/decide/planner.js - Decision service
services/decide/server.js
Paid services
- Tool execution
src/tools - LLM gateway
src/tools/llm-gateway-kit.js - Payment facilitator
facilitator/index.js - Reports and monitors
services/live
Site monetization
- Tollbooth gate
tollbooth/index.js - Edge tollbooth
tollbooth/edge.js - Tollbooth dashboard
tollbooth/dashboard.js
Other components
- AI agent
- x402 seller
- Payment networks
- Website or API
Connections 19
- AI agent → MCP server: calls tools
README.md - AI agent → Framework adapters: uses integration
README.md - MCP server → Tool catalog: resolves names
mcp/index.js - MCP server → Tool search: searches tools
README.md - MCP server → Tool execution: invokes tools
README.md - Tool search → Tool catalog: finds matches
- AI agent → Smart router: requests routing
README.md - AI agent → Seller leaderboard: reads rankings
README.md - Decision service → Decision planner: parses decisions
services/decide/server.js - Decision service → AI agent: returns candidates
- Tool execution → LLM gateway: serves inference
src/tools/llm-gateway-kit.js - AI agent → Payment client: pays per call
README.md - Payment client → x402 seller: pays request
README.md - x402 seller → Payment networks: settles payments
README.md - AI agent → Reports and monitors: buys reports
README.md - Website or API → Tollbooth gate: gates requests
README.md - Tollbooth gate → Payment networks: collects payment
tollbooth/index.js - Edge tollbooth → Tollbooth gate: runs gate
- Tollbooth dashboard → Tollbooth gate: shows analytics
tollbooth/index.js