Skip to content

Instantly share code, notes, and snippets.

@rplryan
rplryan / x402_discovery_quickstart.md
Created February 27, 2026 23:48
x402 Service Discovery API — Find and route to 251+ x402-enabled services from your AI agent

x402 Service Discovery API — Quickstart

The missing discovery layer for x402-enabled services. 251+ services indexed from x402.org/ecosystem, Coinbase Bazaar, and awesome-x402 — with quality signals, health checks, and routing metadata that the official ecosystem page doesn't provide.

Live API: https://x402-discovery-api.onrender.com
MCP Server: ghcr.io/rplryan/x402-discovery-mcp:latest
GitHub: https://github.com/rplryan/x402-discovery-mcp


@rplryan
rplryan / README.md
Created February 26, 2026 02:50
x402 Discovery MCP server - use x402_discover tool from Claude Desktop or Cursor

x402 Discovery MCP Tool for Claude Desktop / Cursor / Windsurf

Adds an x402_discover tool to your AI assistant. The tool finds x402-payable API services at runtime.

What is x402?

x402 is an HTTP payment protocol. A server returns HTTP 402 with payment instructions; the client pays $0.001-0.01 USDC on Base and gets the response. No API keys, no accounts.

Setup (Claude Desktop)

@rplryan
rplryan / crewai_x402_discovery.py
Created February 26, 2026 02:50
CrewAI + x402 Service Discovery - AI crew that autonomously discovers and pays for external APIs
# CrewAI + x402 Service Discovery
# pip install crewai-x402-discovery x402discovery crewai
from crewai import Agent, Task, Crew
from crewai_x402_discovery import X402DiscoveryTool
# x402 discovery tool - finds pay-per-call APIs at runtime
discovery_tool = X402DiscoveryTool(
wallet_private_key="YOUR_PRIVATE_KEY", # Base wallet with USDC
max_price_usd=0.20
@rplryan
rplryan / x402_discovery_raw.py
Created February 26, 2026 02:49
x402 Service Discovery - raw Python API call without any framework
# Raw x402 Service Discovery - no framework required
# pip install x402discovery requests
import requests
from x402discovery import discover, health_check, discover_and_execute
# === Option 1: Simple discovery ===
# Find the best available service for a capability
service = discover(
capability="research", # or: data, compute, monitoring, generation, etc.
@rplryan
rplryan / autogen_x402_discovery.py
Created February 26, 2026 02:49
AutoGen + x402 Service Discovery - autonomous agents that pay for API access with x402 micropayments
# AutoGen + x402 Service Discovery
# pip install autogen-x402-discovery x402discovery
from autogen_x402_discovery import X402DiscoveryFunction
import autogen
# Configure the x402 discovery function
x402_discover = X402DiscoveryFunction(
wallet_private_key="YOUR_PRIVATE_KEY",
discovery_api_url="https://x402-discovery-api.onrender.com"
@rplryan
rplryan / langchain_x402_discovery.py
Created February 26, 2026 02:49
x402 Service Discovery - LangChain agent that discovers and pays for x402 APIs autonomously
# LangChain + x402 Service Discovery
# pip install langchain-x402-discovery x402discovery
from langchain_x402_discovery import X402DiscoveryTool
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
# The discovery tool finds x402-payable APIs at runtime
# Each discovery query costs $0.005 USDC on Base (paid automatically)
tool = X402DiscoveryTool(